Add Unicode parsing

Add Linebreak parsing
This commit is contained in:
Till Wegmueller 2021-09-04 23:58:43 -03:00
parent 4476b85936
commit d129518d33
15 changed files with 20017 additions and 20 deletions

2
Cargo.lock generated
View file

@ -561,7 +561,7 @@ checksum = "ba4aede83fc3617411dc6993bc8c70919750c1c257c6ca6a502aed6e0e2394ae"
[[package]] [[package]]
name = "libips" name = "libips"
version = "0.1.1" version = "0.1.2"
dependencies = [ dependencies = [
"failure", "failure",
"maplit 0.1.6", "maplit 0.1.6",

View file

@ -5,7 +5,7 @@
[package] [package]
name = "libips" name = "libips"
version = "0.1.1" version = "0.1.2"
authors = ["Till Wegmueller <till.wegmueller@openflowlabs.com>"] authors = ["Till Wegmueller <till.wegmueller@openflowlabs.com>"]
edition = "2018" edition = "2018"
license-file = "../LICENSE" license-file = "../LICENSE"

View file

@ -33,17 +33,13 @@ quoted_string = @{
~ quoted_character* ~ quoted_character*
~ "\"" ~ "\""
} }
quoted_character = { quoted_character = {
!"\"" // if the following text is not three apostrophes !"\"" // if the following text is not three apostrophes
~ ANY // then consume one character ~ ANY // then consume one character
} }
payload_character = { COMMENT = _{
!" " // if the following text is not three apostrophes
~ ANY // then consume one character
}
comment_string = @{
"#" "#"
~ comment_character* ~ comment_character*
~ NEWLINE ~ NEWLINE
@ -58,12 +54,19 @@ transform_character = {
~ ANY // then consume one character ~ ANY // then consume one character
} }
unicode_character = {
!(WHITESPACE | NEWLINE) // if the following text is not three apostrophes
~ ANY // then consume one character
}
WHITESPACE = _{ "\\" ~ NEWLINE | " " | "\t" }
transform_action = @{ transform_character*} transform_action = @{ transform_character*}
transform = {"<transform " ~ action_name ~ " " ~ property+ ~ " "? ~ "->" ~ " "? ~ transform_action ~ ">" } transform = {"<transform " ~ action_name ~ property+ ~ "->" ~ transform_action ~ ">" }
property_name = @{ ( ASCII_ALPHANUMERIC | "." | "_" | "-" | "/" )+ } property_name = @{ ( ASCII_ALPHANUMERIC | "." | "_" | "-" | "/" )+ }
property_value = @{ ( ASCII_ALPHANUMERIC | "/" | "," | "." | "_" | "-" | "%" | "*" | "@" | "(" | ")" | "$" | ":" | "+" | "'" | "\\" | "!" )+ | quoted_string } property_value = @{ quoted_string | unicode_character+ }
payload = @{ property_value } payload = @{ property_value }
property = { property_name ~ "=" ~ property_value } property = { property_name ~ "=" ~ property_value }
action = { action_name ~ (( " " ~ payload ~ " " ) | " ")? ~ (property ~ " "?)+ ~ (" " | NEWLINE | EOI) } action = { action_name ~ (property | payload) ~ property* ~ (NEWLINE | EOI) }
manifest = { SOI ~ ( NEWLINE | comment_string | transform | action )+ ~ EOI } manifest = { SOI ~ ( NEWLINE | transform | action )+ ~ EOI }

View file

@ -509,12 +509,12 @@ impl Manifest {
m.add_action(act); m.add_action(act);
} }
Rule::EOI => (), Rule::EOI => (),
Rule::comment_string => (),
Rule::transform => (), Rule::transform => (),
_ => panic!("unexpected rule {:?} inside manifest expected action", manifest.as_rule()), _ => panic!("unexpected rule {:?} inside manifest expected action", manifest.as_rule()),
} }
} }
} }
Rule::WHITESPACE => (),
_ => panic!("unexpected rule {:?} inside pair expected manifest", p.as_rule()), _ => panic!("unexpected rule {:?} inside pair expected manifest", p.as_rule()),
} }
} }

View file

@ -22,7 +22,7 @@ extern crate maplit;
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::actions::{Manifest, Property, Dir, File, Dependency, Facet}; use crate::actions::{Manifest, Property, Dir, File, Dependency, Facet, Link};
use crate::actions::{Attr}; use crate::actions::{Attr};
use std::collections::{HashMap}; use std::collections::{HashMap};
use crate::payload::Payload; use crate::payload::Payload;
@ -234,7 +234,8 @@ file 379c1e2a2a5ffb8c91a07328d4c9be2bc58799fd chash=2c75c59e0de9208a9b96460d0566
file cc2fcdb4605dcac23d59f667889ccbdfdc6e3668 chash=62320c6c207a26bf9c68c39d0372f4d4b97b905f group=bin mode=0644 owner=root path=etc/nginx/uwsgi_params pkg.content-hash=file:sha512t_256:eb133ae0a357df02b4b02615bc47dc2e5328105dac2dbcbd647667e9bbc3b2fd pkg.content-hash=gzip:sha512t_256:e5a2625a67f5502c5911d7e7a850030b6af89929e182b2da74ecf6e79df0e9d2 pkg.csize=284 pkg.size=664 preserve=true file cc2fcdb4605dcac23d59f667889ccbdfdc6e3668 chash=62320c6c207a26bf9c68c39d0372f4d4b97b905f group=bin mode=0644 owner=root path=etc/nginx/uwsgi_params pkg.content-hash=file:sha512t_256:eb133ae0a357df02b4b02615bc47dc2e5328105dac2dbcbd647667e9bbc3b2fd pkg.content-hash=gzip:sha512t_256:e5a2625a67f5502c5911d7e7a850030b6af89929e182b2da74ecf6e79df0e9d2 pkg.csize=284 pkg.size=664 preserve=true
file e10f2d42c9e581901d810928d01a3bf8f3372838 chash=fd231cdd1a726fcb2abeba90b31cbf4c7df6df4d group=bin mode=0644 owner=root path=etc/nginx/win-utf pkg.content-hash=file:sha512t_256:7620f21db4c06f3eb863c0cb0a8b3f62c435abd2f8f47794c42f08ad434d90dd pkg.content-hash=gzip:sha512t_256:ca16a95ddd6ef2043969db20915935829b8ccb6134588e1710b24baf45afd7bb pkg.csize=1197 pkg.size=3610 preserve=true file e10f2d42c9e581901d810928d01a3bf8f3372838 chash=fd231cdd1a726fcb2abeba90b31cbf4c7df6df4d group=bin mode=0644 owner=root path=etc/nginx/win-utf pkg.content-hash=file:sha512t_256:7620f21db4c06f3eb863c0cb0a8b3f62c435abd2f8f47794c42f08ad434d90dd pkg.content-hash=gzip:sha512t_256:ca16a95ddd6ef2043969db20915935829b8ccb6134588e1710b24baf45afd7bb pkg.csize=1197 pkg.size=3610 preserve=true
file 6d5f820bb1d67594c7b757c79ef6f9242df49e98 chash=3ab17dde089f1eac7abd37d8efd700b5139d70b2 elfarch=i386 elfbits=64 elfhash=25b0cdd7736cddad78ce91b61385a8fdde91f7b2 group=bin mode=0555 owner=root path=usr/sbin/nginx pkg.content-hash=gelf:sha512t_256:add9bfb171c2a173b8f12d375884711527f40e592d100a337a9fae078c8beabd pkg.content-hash=gelf.unsigned:sha512t_256:add9bfb171c2a173b8f12d375884711527f40e592d100a337a9fae078c8beabd pkg.content-hash=file:sha512t_256:3d87b058a8e69b3a8dfab142f5e856549dcd531a371e3ca4d2be391655b0d076 pkg.content-hash=gzip:sha512t_256:7f93c48194b3e164ea35a9d2ddff310215769dbd27b45e9ab72beef1cce0d4f6 pkg.csize=657230 pkg.size=1598048 file 6d5f820bb1d67594c7b757c79ef6f9242df49e98 chash=3ab17dde089f1eac7abd37d8efd700b5139d70b2 elfarch=i386 elfbits=64 elfhash=25b0cdd7736cddad78ce91b61385a8fdde91f7b2 group=bin mode=0555 owner=root path=usr/sbin/nginx pkg.content-hash=gelf:sha512t_256:add9bfb171c2a173b8f12d375884711527f40e592d100a337a9fae078c8beabd pkg.content-hash=gelf.unsigned:sha512t_256:add9bfb171c2a173b8f12d375884711527f40e592d100a337a9fae078c8beabd pkg.content-hash=file:sha512t_256:3d87b058a8e69b3a8dfab142f5e856549dcd531a371e3ca4d2be391655b0d076 pkg.content-hash=gzip:sha512t_256:7f93c48194b3e164ea35a9d2ddff310215769dbd27b45e9ab72beef1cce0d4f6 pkg.csize=657230 pkg.size=1598048
file path=usr/lib/golang/1.16/src/cmd/go/testdata/mod/rsc.io_!c!g!o_v1.0.0.txt"); file path=usr/lib/golang/1.16/src/cmd/go/testdata/mod/rsc.io_!c!g!o_v1.0.0.txt
file path=usr/lib/golang/1.16/src/runtime/runtime-gdb_test.go.~1~");
let test_results = vec![ let test_results = vec![
File{ File{
@ -803,8 +804,12 @@ file path=usr/lib/golang/1.16/src/cmd/go/testdata/mod/rsc.io_!c!g!o_v1.0.0.txt")
}, },
File{ File{
path: "usr/lib/golang/1.16/src/cmd/go/testdata/mod/rsc.io_!c!g!o_v1.0.0.txt".into(), path: "usr/lib/golang/1.16/src/cmd/go/testdata/mod/rsc.io_!c!g!o_v1.0.0.txt".into(),
..File::default() ..File::default()
} },
File{
path: "usr/lib/golang/1.16/src/runtime/runtime-gdb_test.go.~1~".into(),
..File::default()
},
]; ];
let res = Manifest::parse_string(manifest_string); let res = Manifest::parse_string(manifest_string);
@ -911,6 +916,140 @@ depend facet.version-lock.system/mozilla-nss=true fmri=system/mozilla-nss@3.51.1
} }
} }
#[test]
fn parse_line_breaks() {
let manifest_string = String::from("link \
path=usr/lib/cups/backend/http \
target=ipp
file Solaris/desktop-print-management mode=0555 \
path=usr/lib/cups/bin/desktop-print-management
file Solaris/desktop-print-management-applet mode=0555 \
path=usr/lib/cups/bin/desktop-print-management-applet
file Solaris/smb mode=0555 \
path=usr/lib/cups/backend/smb
# SMF service start method script
file Solaris/svc-cupsd mode=0644 path=lib/svc/method/svc-cupsd
# SMF help
file Solaris/ManageCUPS.html mode=0444 \
path=usr/lib/help/auths/locale/C/ManageCUPS.html");
let file_results = vec![
File{
path: "usr/lib/cups/bin/desktop-print-management".to_string(),
mode: "0555".to_string(),
properties: vec![
Property{
key: "original-path".to_string(),
value: "Solaris/desktop-print-management".to_string(),
}
],
..File::default()
},
File{
path: "usr/lib/cups/bin/desktop-print-management-applet".to_string(),
mode: "0555".to_string(),
properties: vec![
Property{
key: "original-path".to_string(),
value: "Solaris/desktop-print-management-applet".to_string(),
}
],
..File::default()
},
File{
path: "usr/lib/cups/backend/smb".to_string(),
mode: "0555".to_string(),
properties: vec![
Property{
key: "original-path".to_string(),
value: "Solaris/smb".to_string(),
}
],
..File::default()
},
File{
path: "lib/svc/method/svc-cupsd".to_string(),
mode: "0644".to_string(),
properties: vec![
Property{
key: "original-path".to_string(),
value: "Solaris/svc-cupsd".to_string(),
}
],
..File::default()
},
File{
path: "usr/lib/help/auths/locale/C/ManageCUPS.html".to_string(),
mode: "0444".to_string(),
properties: vec![
Property{
key: "original-path".to_string(),
value: "Solaris/ManageCUPS.html".to_string(),
}
],
..File::default()
},
];
let link_results = vec![
Link{
path: "usr/lib/cups/backend/http".to_string(),
target: "ipp".to_string(),
..Link::default()
},
];
let res = Manifest::parse_string(manifest_string);
assert!(res.is_ok(), "error during Manifest parsing: {:?}", res);
let manifest = res.unwrap();
for (pos, file) in manifest.files.iter().enumerate() {
assert_eq!(file.path, file_results[pos].path);
assert_eq!(file.properties[0].key, file_results[pos].properties[0].key);
assert_eq!(file.properties[0].value, file_results[pos].properties[0].value);
assert_eq!(file.mode, file_results[pos].mode);
}
for (pos, link) in manifest.links.iter().enumerate() {
assert_eq!(link.path, link_results[pos].path);
assert_eq!(link.target, link_results[pos].target);
}
}
#[test]
fn parse_unicode() {
let manifest_string = String::from("link \
path=usr/lib/cups/пертинах/http \
target=Про
# SMF blub
link path=usr/lib/cups/пертинах/http target=blub");
let link_results = vec![
Link{
path: "usr/lib/cups/пертинах/http".to_string(),
target: "Про".to_string(),
..Link::default()
},
Link{
path: "usr/lib/cups/пертинах/http".to_string(),
target: "blub".to_string(),
..Link::default()
},
];
let res = Manifest::parse_string(manifest_string);
assert!(res.is_ok(), "error during Manifest parsing: {:?}", res);
let manifest = res.unwrap();
for (pos, link) in manifest.links.iter().enumerate() {
assert_eq!(link.path, link_results[pos].path);
assert_eq!(link.target, link_results[pos].target);
}
}
} }

View file

@ -22,8 +22,8 @@ use userland::repology::{find_newest_version};
fn main() { fn main() {
let component_arg = Arg::new("component") let component_arg = Arg::new("component")
.takes_value(true) .takes_value(true)
//.default_value("../sample_data/pkgs/cups"); .default_value("../sample_data/pkgs/golang-116");
.default_value("./"); //.default_value("./");
let opts = app_from_crate!().subcommand(App::new("diff-component") let opts = app_from_crate!().subcommand(App::new("diff-component")
.about("shows differences between sample-manifest and manifests") .about("shows differences between sample-manifest and manifests")
.arg(&component_arg) .arg(&component_arg)
@ -31,7 +31,7 @@ fn main() {
.about("Show informations about the component") .about("Show informations about the component")
.arg(&component_arg) .arg(&component_arg)
).get_matches(); ).get_matches();
//.get_matches_from(vec!["pkg6dev", "show-component"]); //.get_matches_from(vec!["pkg6dev", "diff-component"]);
if let Some(diff_component_opts) = opts.subcommand_matches("diff-component") { if let Some(diff_component_opts) = opts.subcommand_matches("diff-component") {
let res = diff_component(diff_component_opts); let res = diff_component(diff_component_opts);

View file

@ -0,0 +1,121 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2021 Till Wegmueller
#
include ../../../make-rules/shared-macros.mk
PATCH_EACH_ARCHIVE= 1
COMPONENT_NAME= golang
COMPONENT_MAJOR_VERSION= 1.16
COMPONENT_VERSION= $(COMPONENT_MAJOR_VERSION).3
COMPONENT_FMRI= developer/golang
COMPONENT_CLASSIFICATION= Development/Other Languages
COMPONENT_SUMMARY= The Go Programming Language
COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
COMPONENT_PROJECT_URL= https://golang.org/
COMPONENT_ARCHIVE= go$(COMPONENT_VERSION).src.tar.gz
COMPONENT_ARCHIVE_URL= https://storage.googleapis.com/golang/$(COMPONENT_ARCHIVE)
COMPONENT_ARCHIVE_HASH= sha256:b298d29de9236ca47a023e382313bcc2d2eed31dfa706b60a04103ce83a71a25
COMPONENT_LICENSE= BSD-style, Patent Grant
COMPONENT_LICENSE_FILE= $(COMPONENT_NAME).license
MEDIATEDUSRSHAREMAN1DIR= $(PROTO_DIR)/usr/share/golang/$(COMPONENT_MAJOR_VERSION)/man/man1
# Go has a number of supplementary tools and packages that are located in
# separate archives or source repositories. Because Go currently forces a
# recompile of all packages whenever the compiler changes, building and
# delivering them within the same build component build process is the best
# option for now.
# Bake in where Go package will be installed.
GOROOT_FINAL= /usr/lib/golang/$(COMPONENT_MAJOR_VERSION)
# Enable easier stack unwinding for debugging.
GOEXPERIMENT=
COMPONENT_BUILD_ENV += GOROOT_FINAL="$(GOROOT_FINAL)"
COMPONENT_BUILD_ENV += GOEXPERIMENT="$(GOEXPERIMENT)"
COMPONENT_BUILD_ENV += GOOS="illumos"
COMPONENT_BUILD_ENV += GOCACHE="$(SOURCE_DIR)/gocache"
COMPONENT_BUILD_ENV += GOPATH="$(SOURCE_DIR)/gopath"
COMPONENT_BUILD_ENV += \
GOROOT_BOOTSTRAP="/usr/lib/golang/$(COMPONENT_MAJOR_VERSION)"
# For convenience during installation of supplementary packages.
COMPONENT_INSTALL_ENV += PATH="$(PROTO_DIR)$(GOROOT_FINAL)/bin:$(PATH)"
COMPONENT_INSTALL_ENV += GOROOT="$(PROTO_DIR)$(GOROOT_FINAL)"
COMPONENT_INSTALL_ENV += GOCACHE="$(SOURCE_DIR)/gocache"
COMPONENT_INSTALL_ENV += GOPATH="$(SOURCE_DIR)/gopath"
BUILD_BITS= 64
BUILD_STYLE= justmake
include $(WS_MAKE_RULES)/common.mk
# We have to fiddle with the package archives to get them into the same source
# directory so that we can use the standard build targets. We're effectively
# building multiple components using a single target.
COMPONENT_POST_UNPACK_ACTION= \
$(MV) go $(COMPONENT_SRC)
# Go doesn't have a standard Makefile-based build process, so override the
# default.
COMPONENT_BUILD_ACTION= \
cd $(@D)/src; $(ENV) $(COMPONENT_BUILD_ENV) ./make.bash
COMPONENT_TARGET_DIR= \
$(PROTOUSRLIBDIR)/$(COMPONENT_NAME)/$(COMPONENT_MAJOR_VERSION)
# We can't do any ASLR'ing as the Go 6l linker has no understanding of the
# -z aslr=... option. So just override where needed in the .p5m files.
ASLR_MODE = $(ASLR_DISABLE)
COMPONENT_TEST_ENV += PATH="$(@D)/bin:$(PATH)"
COMPONENT_TEST_ENV += GOROOT="$(@D)"
COMPONENT_TEST_DIR= $(@D)/src
COMPONENT_TEST_CMD= ./run.bash
COMPONENT_TEST_TARGETS=
# Use this Command to copy the Go Source tree into the proto area. In order to deliver the Go SDK under GOROOT
# Additionally nuke all the funky binary files used for test suites. They keep bothering the packaging tools
define COMPONENT_INSTALL_ACTION=
($(MKDIR) $(COMPONENT_TARGET_DIR)/src); \
(cd $(SOURCE_DIR) && \
/usr/gnu/bin/find . -maxdepth 1 -path "./$(COMPONENT_SRC_NAME)" \
-prune -o \( ! -iname ".*" \) -print \
-exec /usr/gnu/bin/cp -r \
--parents {} $(COMPONENT_TARGET_DIR) \;); \
(cd $(BUILD_DIR_64) && \
/usr/gnu/bin/find src -type f \
-exec /usr/gnu/bin/cp --parents {} $(COMPONENT_TARGET_DIR) \;); \
(cd $(BUILD_DIR_64) && $(CP) -r bin $(COMPONENT_TARGET_DIR)/); \
(cd $(BUILD_DIR_64) && $(CP) -r pkg $(COMPONENT_TARGET_DIR)/); \
(rm -r $(COMPONENT_TARGET_DIR)/pkg/obj); \
($(MKDIR) -p $(MEDIATEDUSRSHAREMAN1DIR)); \
/usr/gnu/bin/find $(COMPONENT_TARGET_DIR)/src -type f \
| egrep -v '\.go|\.s|\.bash|\.txt|\.c|\.tmpl|\.h|\.pl|\.md|\.S|\.py|\.dist|\.rc|\.bat|README|Makefile|\.awk|\.rules|\.mod|\.json|LICENSE|PATENTS'\
| xargs rm;
endef
REQUIRED_PACKAGES += developer/golang-115
# Auto-generated dependencies
REQUIRED_PACKAGES += system/library

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,27 @@
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1,25 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2021 Till Wegmueller
#
set name=pkg.fmri value=pkg:/$(COMPONENT_FMRI)@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.summary value="$(COMPONENT_SUMMARY)"
set name=info.classification value="$(COMPONENT_CLASSIFICATION)"
set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
license $(COMPONENT_LICENSE_FILE) license='$(COMPONENT_LICENSE)'
depend type=require fmri=developer/golang-116

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,12 @@
diff -ruN golang-1.9.orig/src/runtime/runtime-gdb_test.go golang-1.9/src/runtime/runtime-gdb_test.go
--- golang-1.9.orig/src/runtime/runtime-gdb_test.go 2017-08-24 14:50:31.000000000 -0700
+++ golang-1.9/src/runtime/runtime-gdb_test.go 2017-08-27 08:46:28.054298530 -0700
@@ -60,7 +60,7 @@
t.Skip("skipping gdb python tests on solaris; see golang.org/issue/20821")
}
- cmd := exec.Command("gdb", "-nx", "-q", "--batch", "-iex", "python import sys; print('go gdb python support')")
+ cmd := exec.Command("gdb", "-nx", "-q", "--batch", "-iex", "/usr/bin/amd64/python import sys; print('go gdb python support')")
out, err := cmd.CombinedOutput()
if err != nil {

View file

@ -0,0 +1,41 @@
--- golang-1.10/src/syscall/zsyscall_solaris_amd64.go 2018-02-16 09:12:19.000000000 +0000
+++ golang-1.10/src/syscall/zsyscall_solaris_amd64.go.1 2018-05-01 03:21:18.224140250 +0000
@@ -21,6 +21,7 @@
//go:cgo_import_dynamic libc_Chroot chroot "libc.so"
//go:cgo_import_dynamic libc_Close close "libc.so"
//go:cgo_import_dynamic libc_Dup dup "libc.so"
+//go:cgo_import_dynamic libc_Dup2 dup2 "libc.so"
//go:cgo_import_dynamic libc_Fchdir fchdir "libc.so"
//go:cgo_import_dynamic libc_Fchmod fchmod "libc.so"
//go:cgo_import_dynamic libc_Fchown fchown "libc.so"
@@ -105,6 +106,7 @@
//go:linkname libc_Chroot libc_Chroot
//go:linkname libc_Close libc_Close
//go:linkname libc_Dup libc_Dup
+//go:linkname libc_Dup2 libc_Dup2
//go:linkname libc_Fchdir libc_Fchdir
//go:linkname libc_Fchmod libc_Fchmod
//go:linkname libc_Fchown libc_Fchown
@@ -192,6 +194,7 @@
libc_Chroot,
libc_Close,
libc_Dup,
+ libc_Dup2,
libc_Fchdir,
libc_Fchmod,
libc_Fchown,
@@ -410,6 +413,14 @@
return
}
+func Dup2(oldfd int, newfd int) (err error) {
+ _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&libc_Dup2)), 2, uintptr(oldfd), uintptr(newfd), 0, 0, 0, 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
func Fchdir(fd int) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&libc_Fchdir)), 1, uintptr(fd), 0, 0, 0, 0, 0)
if e1 != 0 {

View file

@ -0,0 +1,284 @@
Generated by the following ruby script
puts(<<HEADER)
// +build amd64,solaris
package syscall
const (
HEADER
syscall_h = File.readlines('/usr/include/sys/syscall.h')
calls = {}
syscall_h.each do |line|
m = line.match(/#define\s(SYS_[^\s]*)\s+(\d+)/)
if m
calls[m[1].upcase] = m[2]
end
end
width = calls.keys.max_by { |x| x.length }.length + 1
calls.each do |call, num|
printf("\t%-#{width}s = %d\n", call, num)
end
puts ")"
--- golang-1.6.2/src/syscall/zsysnum_solaris_amd64.go.orig 2016-04-27 22:29:15.592868144 +0300
+++ golang-1.6.2/src/syscall/zsysnum_solaris_amd64.go 2016-04-27 22:29:34.483620796 +0300
@@ -1,13 +1,250 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
// +build amd64,solaris
package syscall
-// TODO(aram): remove these before Go 1.3.
const (
- SYS_EXECVE = 59
- SYS_FCNTL = 62
+ SYS_SYSCALL = 0
+ SYS_EXIT = 1
+ SYS_READ = 3
+ SYS_WRITE = 4
+ SYS_OPEN = 5
+ SYS_CLOSE = 6
+ SYS_LINKAT = 7
+ SYS_LINK = 9
+ SYS_UNLINK = 10
+ SYS_SYMLINKAT = 11
+ SYS_CHDIR = 12
+ SYS_TIME = 13
+ SYS_MKNOD = 14
+ SYS_CHMOD = 15
+ SYS_CHOWN = 16
+ SYS_BRK = 17
+ SYS_STAT = 18
+ SYS_LSEEK = 19
+ SYS_GETPID = 20
+ SYS_MOUNT = 21
+ SYS_READLINKAT = 22
+ SYS_SETUID = 23
+ SYS_GETUID = 24
+ SYS_STIME = 25
+ SYS_PCSAMPLE = 26
+ SYS_ALARM = 27
+ SYS_FSTAT = 28
+ SYS_PAUSE = 29
+ SYS_STTY = 31
+ SYS_GTTY = 32
+ SYS_ACCESS = 33
+ SYS_NICE = 34
+ SYS_STATFS = 35
+ SYS_SYNC = 36
+ SYS_KILL = 37
+ SYS_FSTATFS = 38
+ SYS_PGRPSYS = 39
+ SYS_UUCOPYSTR = 40
+ SYS_PIPE = 42
+ SYS_TIMES = 43
+ SYS_PROFIL = 44
+ SYS_FACCESSAT = 45
+ SYS_SETGID = 46
+ SYS_GETGID = 47
+ SYS_MKNODAT = 48
+ SYS_MSGSYS = 49
+ SYS_SYSI86 = 50
+ SYS_ACCT = 51
+ SYS_SHMSYS = 52
+ SYS_SEMSYS = 53
+ SYS_IOCTL = 54
+ SYS_UADMIN = 55
+ SYS_FCHOWNAT = 56
+ SYS_UTSSYS = 57
+ SYS_FDSYNC = 58
+ SYS_EXECVE = 59
+ SYS_UMASK = 60
+ SYS_CHROOT = 61
+ SYS_FCNTL = 62
+ SYS_ULIMIT = 63
+ SYS_RENAMEAT = 64
+ SYS_UNLINKAT = 65
+ SYS_FSTATAT = 66
+ SYS_FSTATAT64 = 67
+ SYS_OPENAT = 68
+ SYS_OPENAT64 = 69
+ SYS_TASKSYS = 70
+ SYS_ACCTCTL = 71
+ SYS_EXACCTSYS = 72
+ SYS_GETPAGESIZES = 73
+ SYS_RCTLSYS = 74
+ SYS_SIDSYS = 75
+ SYS_LWP_PARK = 77
+ SYS_SENDFILEV = 78
+ SYS_RMDIR = 79
+ SYS_MKDIR = 80
+ SYS_GETDENTS = 81
+ SYS_PRIVSYS = 82
+ SYS_UCREDSYS = 83
+ SYS_SYSFS = 84
+ SYS_GETMSG = 85
+ SYS_PUTMSG = 86
+ SYS_LSTAT = 88
+ SYS_SYMLINK = 89
+ SYS_READLINK = 90
+ SYS_SETGROUPS = 91
+ SYS_GETGROUPS = 92
+ SYS_FCHMOD = 93
+ SYS_FCHOWN = 94
+ SYS_SIGPROCMASK = 95
+ SYS_SIGSUSPEND = 96
+ SYS_SIGALTSTACK = 97
+ SYS_SIGACTION = 98
+ SYS_SIGPENDING = 99
+ SYS_CONTEXT = 100
+ SYS_FCHMODAT = 101
+ SYS_MKDIRAT = 102
+ SYS_STATVFS = 103
+ SYS_FSTATVFS = 104
+ SYS_GETLOADAVG = 105
+ SYS_NFSSYS = 106
+ SYS_WAITID = 107
+ SYS_SIGSENDSYS = 108
+ SYS_HRTSYS = 109
+ SYS_UTIMESYS = 110
+ SYS_SIGRESEND = 111
+ SYS_PRIOCNTLSYS = 112
+ SYS_PATHCONF = 113
+ SYS_MINCORE = 114
+ SYS_MMAP = 115
+ SYS_MPROTECT = 116
+ SYS_MUNMAP = 117
+ SYS_FPATHCONF = 118
+ SYS_VFORK = 119
+ SYS_FCHDIR = 120
+ SYS_READV = 121
+ SYS_WRITEV = 122
+ SYS_PREADV = 123
+ SYS_PWRITEV = 124
+ SYS_GETRANDOM = 126
+ SYS_MMAPOBJ = 127
+ SYS_SETRLIMIT = 128
+ SYS_GETRLIMIT = 129
+ SYS_LCHOWN = 130
+ SYS_MEMCNTL = 131
+ SYS_GETPMSG = 132
+ SYS_PUTPMSG = 133
+ SYS_RENAME = 134
+ SYS_UNAME = 135
+ SYS_SETEGID = 136
+ SYS_SYSCONFIG = 137
+ SYS_ADJTIME = 138
+ SYS_SYSTEMINFO = 139
+ SYS_SHAREFS = 140
+ SYS_SETEUID = 141
+ SYS_FORKSYS = 142
+ SYS_SIGTIMEDWAIT = 144
+ SYS_LWP_INFO = 145
+ SYS_YIELD = 146
+ SYS_LWP_SEMA_POST = 148
+ SYS_LWP_SEMA_TRYWAIT = 149
+ SYS_LWP_DETACH = 150
+ SYS_CORECTL = 151
+ SYS_MODCTL = 152
+ SYS_FCHROOT = 153
+ SYS_VHANGUP = 155
+ SYS_GETTIMEOFDAY = 156
+ SYS_GETITIMER = 157
+ SYS_SETITIMER = 158
+ SYS_LWP_CREATE = 159
+ SYS_LWP_EXIT = 160
+ SYS_LWP_SUSPEND = 161
+ SYS_LWP_CONTINUE = 162
+ SYS_LWP_KILL = 163
+ SYS_LWP_SELF = 164
+ SYS_LWP_SIGMASK = 165
+ SYS_LWP_PRIVATE = 166
+ SYS_LWP_WAIT = 167
+ SYS_LWP_MUTEX_WAKEUP = 168
+ SYS_LWP_COND_WAIT = 170
+ SYS_LWP_COND_SIGNAL = 171
+ SYS_LWP_COND_BROADCAST = 172
+ SYS_PREAD = 173
+ SYS_PWRITE = 174
+ SYS_LLSEEK = 175
+ SYS_INST_SYNC = 176
+ SYS_BRAND = 177
+ SYS_KAIO = 178
+ SYS_CPC = 179
+ SYS_LGRPSYS = 180
+ SYS_RUSAGESYS = 181
+ SYS_PORT = 182
+ SYS_POLLSYS = 183
+ SYS_LABELSYS = 184
+ SYS_ACL = 185
+ SYS_AUDITSYS = 186
+ SYS_PROCESSOR_BIND = 187
+ SYS_PROCESSOR_INFO = 188
+ SYS_P_ONLINE = 189
+ SYS_SIGQUEUE = 190
+ SYS_CLOCK_GETTIME = 191
+ SYS_CLOCK_SETTIME = 192
+ SYS_CLOCK_GETRES = 193
+ SYS_TIMER_CREATE = 194
+ SYS_TIMER_DELETE = 195
+ SYS_TIMER_SETTIME = 196
+ SYS_TIMER_GETTIME = 197
+ SYS_TIMER_GETOVERRUN = 198
+ SYS_NANOSLEEP = 199
+ SYS_FACL = 200
+ SYS_DOOR = 201
+ SYS_SETREUID = 202
+ SYS_SETREGID = 203
+ SYS_INSTALL_UTRAP = 204
+ SYS_SIGNOTIFY = 205
+ SYS_SCHEDCTL = 206
+ SYS_PSET = 207
+ SYS_SPARC_UTRAP_INSTALL = 208
+ SYS_RESOLVEPATH = 209
+ SYS_LWP_MUTEX_TIMEDLOCK = 210
+ SYS_LWP_SEMA_TIMEDWAIT = 211
+ SYS_LWP_RWLOCK_SYS = 212
+ SYS_GETDENTS64 = 213
+ SYS_MMAP64 = 214
+ SYS_STAT64 = 215
+ SYS_LSTAT64 = 216
+ SYS_FSTAT64 = 217
+ SYS_STATVFS64 = 218
+ SYS_FSTATVFS64 = 219
+ SYS_SETRLIMIT64 = 220
+ SYS_GETRLIMIT64 = 221
+ SYS_PREAD64 = 222
+ SYS_PWRITE64 = 223
+ SYS_OPEN64 = 225
+ SYS_RPCSYS = 226
+ SYS_ZONE = 227
+ SYS_AUTOFSSYS = 228
+ SYS_GETCWD = 229
+ SYS_SO_SOCKET = 230
+ SYS_SO_SOCKETPAIR = 231
+ SYS_BIND = 232
+ SYS_LISTEN = 233
+ SYS_ACCEPT = 234
+ SYS_CONNECT = 235
+ SYS_SHUTDOWN = 236
+ SYS_RECV = 237
+ SYS_RECVFROM = 238
+ SYS_RECVMSG = 239
+ SYS_SEND = 240
+ SYS_SENDMSG = 241
+ SYS_SENDTO = 242
+ SYS_GETPEERNAME = 243
+ SYS_GETSOCKNAME = 244
+ SYS_GETSOCKOPT = 245
+ SYS_SETSOCKOPT = 246
+ SYS_SOCKCONFIG = 247
+ SYS_NTP_GETTIME = 248
+ SYS_NTP_ADJTIME = 249
+ SYS_LWP_MUTEX_UNLOCK = 250
+ SYS_LWP_MUTEX_TRYLOCK = 251
+ SYS_LWP_MUTEX_REGISTER = 252
+ SYS_CLADM = 253
+ SYS_UUCOPY = 254
+ SYS_UMOUNT2 = 255
)

View file

@ -0,0 +1,12 @@
{
"dependencies": [
"SUNWcs",
"developer/golang-115",
"system/library"
],
"fmris": [
"developer/golang",
"developer/golang-116"
],
"name": "golang"
}