From cb79bef594c597afb966bedc49480ae6ee89249a Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Thu, 29 Oct 2026 00:33:48 -0500 Subject: [PATCH 1/7] Update golang.org/x/net to v0.62.0 for CVE-2026-78661 and CVE-2026-97045 The Scan job failed on both: x/net v0.60.0 is affected and v0.62.0 fixes them. go get also raised x/crypto, x/sys, x/term, x/text, x/sync and x/tools to the versions x/net v0.62.0 requires. --- changelog.md | 1 + go.mod | 14 +- go.sum | 28 +- vendor/golang.org/x/crypto/acme/acme.go | 12 +- .../x/crypto/acme/autocert/autocert.go | 2 +- vendor/golang.org/x/crypto/acme/rfc8555.go | 79 ++- vendor/golang.org/x/crypto/acme/types.go | 42 +- .../x/crypto/argon2/blamka_generic.go | 4 + .../x/crypto/argon2/blamka_loong64.go | 49 ++ .../x/crypto/argon2/blamka_loong64.s | 240 ++++++++ .../golang.org/x/crypto/argon2/blamka_ref.go | 2 +- .../x/crypto/blake2b/blake2b_loong64.go | 20 + .../x/crypto/blake2b/blake2b_loong64.s | 252 ++++++++ .../x/crypto/blake2b/blake2b_ref.go | 2 +- .../x/crypto/chacha20/chacha_loong64.go | 22 + .../x/crypto/chacha20/chacha_loong64.s | 342 +++++++++++ .../x/crypto/chacha20/chacha_noasm.go | 2 +- .../golang.org/x/crypto/ssh/agent/client.go | 3 + vendor/golang.org/x/crypto/ssh/certs.go | 12 + vendor/golang.org/x/crypto/ssh/cipher.go | 212 ++++--- vendor/golang.org/x/crypto/ssh/common.go | 17 +- vendor/golang.org/x/crypto/ssh/doc.go | 1 + vendor/golang.org/x/crypto/ssh/keys.go | 75 ++- .../x/crypto/ssh/knownhosts/knownhosts.go | 4 +- vendor/golang.org/x/crypto/ssh/mldsa.go | 133 +++++ .../x/crypto/ssh/mldsa_unsupported.go | 29 + vendor/golang.org/x/sys/cpu/cpu.go | 5 + vendor/golang.org/x/sys/cpu/cpu_x86.go | 23 + .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 20 + .../golang.org/x/sys/unix/asm_linux_sparc64.s | 48 ++ vendor/golang.org/x/sys/unix/asm_zos_s390x.s | 190 +------ vendor/golang.org/x/sys/unix/bpxsvc_zos.s | 18 +- vendor/golang.org/x/sys/unix/fcntl_darwin.go | 4 +- vendor/golang.org/x/sys/unix/mkerrors.sh | 2 +- vendor/golang.org/x/sys/unix/ptrace_zos.go | 537 ++++++++++++++++++ .../x/sys/unix/ptrace_zos_singlestep.go | 425 ++++++++++++++ .../golang.org/x/sys/unix/syscall_darwin.go | 1 + .../golang.org/x/sys/unix/syscall_freebsd.go | 9 + vendor/golang.org/x/sys/unix/syscall_linux.go | 21 +- .../x/sys/unix/syscall_linux_sparc64.go | 6 +- .../golang.org/x/sys/unix/syscall_netbsd.go | 9 + .../golang.org/x/sys/unix/syscall_unix_gc.go | 2 +- .../x/sys/unix/syscall_unix_gc_ppc64x.go | 22 - .../x/sys/unix/syscall_zos_s390x.go | 4 - vendor/golang.org/x/sys/unix/xattr_bsd.go | 24 +- .../x/sys/unix/zerrors_darwin_amd64.go | 6 + .../x/sys/unix/zerrors_darwin_arm64.go | 6 + vendor/golang.org/x/sys/unix/zerrors_linux.go | 32 ++ .../x/sys/unix/zerrors_linux_386.go | 2 + .../x/sys/unix/zerrors_linux_amd64.go | 2 + .../x/sys/unix/zerrors_linux_arm.go | 2 + .../x/sys/unix/zerrors_linux_arm64.go | 2 + .../x/sys/unix/zerrors_linux_loong64.go | 2 + .../x/sys/unix/zerrors_linux_mips.go | 2 + .../x/sys/unix/zerrors_linux_mips64.go | 2 + .../x/sys/unix/zerrors_linux_mips64le.go | 2 + .../x/sys/unix/zerrors_linux_mipsle.go | 2 + .../x/sys/unix/zerrors_linux_ppc.go | 2 + .../x/sys/unix/zerrors_linux_ppc64.go | 2 + .../x/sys/unix/zerrors_linux_ppc64le.go | 2 + .../x/sys/unix/zerrors_linux_riscv64.go | 2 + .../x/sys/unix/zerrors_linux_s390x.go | 2 + .../x/sys/unix/zerrors_linux_sparc64.go | 2 + .../x/sys/unix/zsyscall_darwin_amd64.go | 11 + .../x/sys/unix/zsyscall_darwin_arm64.go | 11 + .../x/sys/unix/zsyscall_freebsd_386.go | 159 ++++++ .../x/sys/unix/zsyscall_freebsd_amd64.go | 159 ++++++ .../x/sys/unix/zsyscall_freebsd_arm.go | 159 ++++++ .../x/sys/unix/zsyscall_freebsd_arm64.go | 159 ++++++ .../x/sys/unix/zsyscall_freebsd_riscv64.go | 159 ++++++ .../golang.org/x/sys/unix/zsyscall_linux.go | 29 +- .../x/sys/unix/zsyscall_linux_sparc64.go | 6 +- .../x/sys/unix/zsyscall_netbsd_386.go | 159 ++++++ .../x/sys/unix/zsyscall_netbsd_amd64.go | 159 ++++++ .../x/sys/unix/zsyscall_netbsd_arm.go | 159 ++++++ .../x/sys/unix/zsyscall_netbsd_arm64.go | 159 ++++++ .../x/sys/unix/zsysnum_zos_s390x.go | 13 + vendor/golang.org/x/sys/unix/ztypes_linux.go | 101 ++-- .../golang.org/x/sys/unix/ztypes_linux_386.go | 6 + .../x/sys/unix/ztypes_linux_amd64.go | 7 + .../golang.org/x/sys/unix/ztypes_linux_arm.go | 6 + .../x/sys/unix/ztypes_linux_arm64.go | 7 + .../x/sys/unix/ztypes_linux_loong64.go | 7 + .../x/sys/unix/ztypes_linux_mips.go | 6 + .../x/sys/unix/ztypes_linux_mips64.go | 7 + .../x/sys/unix/ztypes_linux_mips64le.go | 7 + .../x/sys/unix/ztypes_linux_mipsle.go | 6 + .../golang.org/x/sys/unix/ztypes_linux_ppc.go | 6 + .../x/sys/unix/ztypes_linux_ppc64.go | 7 + .../x/sys/unix/ztypes_linux_ppc64le.go | 7 + .../x/sys/unix/ztypes_linux_riscv64.go | 7 + .../x/sys/unix/ztypes_linux_s390x.go | 7 + .../x/sys/unix/ztypes_linux_sparc64.go | 15 +- .../golang.org/x/sys/unix/ztypes_zos_s390x.go | 78 +++ .../x/sys/windows/types_windows_arm.go | 35 -- .../x/text/secure/bidirule/bidirule.go | 8 +- vendor/golang.org/x/text/unicode/bidi/core.go | 105 ++-- .../x/tools/go/gcexportdata/gcexportdata.go | 125 ++-- .../golang.org/x/tools/go/packages/golist.go | 82 +-- .../x/tools/go/packages/golist_overlay.go | 11 +- .../x/tools/go/packages/packages.go | 2 +- .../x/tools/go/types/objectpath/objectpath.go | 12 +- .../x/tools/internal/aliases/aliases.go | 18 - .../x/tools/internal/gcimporter/bimport.go | 1 + .../x/tools/internal/gcimporter/exportdata.go | 1 + .../x/tools/internal/gcimporter/gcimporter.go | 14 + .../x/tools/internal/gcimporter/iexport.go | 23 +- .../x/tools/internal/gcimporter/iimport.go | 32 +- .../tools/internal/gcimporter/predeclared.go | 1 + .../x/tools/internal/gcimporter/support.go | 1 + .../x/tools/internal/gcimporter/ureader.go | 64 ++- .../x/tools/internal/pkgbits/codes.go | 2 + .../x/tools/internal/pkgbits/decoder.go | 1 + .../x/tools/internal/pkgbits/doc.go | 2 + .../x/tools/internal/pkgbits/encoder.go | 1 + .../x/tools/internal/pkgbits/reloc.go | 2 + .../x/tools/internal/pkgbits/support.go | 1 + .../x/tools/internal/pkgbits/sync.go | 1 + .../x/tools/internal/pkgbits/version.go | 11 + .../x/tools/internal/stdlib/deps.go | 6 +- .../x/tools/internal/typesinternal/isnamed.go | 10 +- .../x/tools/internal/typesinternal/recv.go | 35 +- .../x/tools/internal/typesinternal/types.go | 16 +- .../x/tools/internal/typesinternal/varkind.go | 23 - .../internal/typesinternal/varkind_go124.go | 39 -- vendor/modules.txt | 17 +- 126 files changed, 4753 insertions(+), 780 deletions(-) create mode 100644 vendor/golang.org/x/crypto/argon2/blamka_loong64.go create mode 100644 vendor/golang.org/x/crypto/argon2/blamka_loong64.s create mode 100644 vendor/golang.org/x/crypto/blake2b/blake2b_loong64.go create mode 100644 vendor/golang.org/x/crypto/blake2b/blake2b_loong64.s create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_loong64.go create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_loong64.s create mode 100644 vendor/golang.org/x/crypto/ssh/mldsa.go create mode 100644 vendor/golang.org/x/crypto/ssh/mldsa_unsupported.go create mode 100644 vendor/golang.org/x/sys/unix/asm_linux_sparc64.s create mode 100644 vendor/golang.org/x/sys/unix/ptrace_zos.go create mode 100644 vendor/golang.org/x/sys/unix/ptrace_zos_singlestep.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows_arm.go delete mode 100644 vendor/golang.org/x/tools/internal/aliases/aliases.go delete mode 100644 vendor/golang.org/x/tools/internal/typesinternal/varkind.go delete mode 100644 vendor/golang.org/x/tools/internal/typesinternal/varkind_go124.go diff --git a/changelog.md b/changelog.md index 088671b97e..4ee3a59f75 100644 --- a/changelog.md +++ b/changelog.md @@ -45,6 +45,7 @@ and this project adheres to - Updated `github.com/klauspost/compress` to v1.18.7 to remediate CVE-2026-63209 (GHSA-259r-337f-4rfw). - Updated to Go 1.26.10 and `golang.org/x/net` v0.60.0 to remediate 14 CVEs in the Go standard library and HTTP/2 handling. +- Updated `golang.org/x/net` to v0.62.0 to remediate CVE-2026-78661 and CVE-2026-97045. - Updated `github.com/labstack/echo/v4` to v4.16.1 to remediate GHSA-cxf3-9h37-7rr8, GHSA-9969-6676-49h5, GHSA-f48p-c9v4-h7xv and GHSA-h7wr-284f-5qvc. diff --git a/go.mod b/go.mod index 91660e8763..f1db3695bc 100644 --- a/go.mod +++ b/go.mod @@ -51,11 +51,11 @@ require ( github.com/thoas/go-funk v0.8.0 github.com/vbauerster/mpb/v7 v7.1.5 github.com/vektah/gqlparser/v2 v2.5.16 - golang.org/x/crypto v0.57.0 // indirect - golang.org/x/net v0.60.0 - golang.org/x/sys v0.48.0 - golang.org/x/term v0.46.0 - golang.org/x/text v0.42.0 + golang.org/x/crypto v0.58.0 // indirect + golang.org/x/net v0.62.0 + golang.org/x/sys v0.49.0 + golang.org/x/term v0.47.0 + golang.org/x/text v0.43.0 gopkg.in/AlecAivazis/survey.v1 v1.8.8 gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2 gopkg.in/yaml.v2 v2.4.0 @@ -136,7 +136,7 @@ require ( github.com/spf13/afero v1.15.0 // indirect github.com/yosida95/uritemplate/v3 v3.0.2 // indirect go4.org v0.0.0-20230225012048-214862532bf5 // indirect - golang.org/x/sync v0.23.0 // indirect + golang.org/x/sync v0.24.0 // indirect ) require ( @@ -191,7 +191,7 @@ require ( go.mongodb.org/mongo-driver v1.17.7 // indirect golang.org/x/mod v0.41.0 golang.org/x/time v0.15.0 // indirect - golang.org/x/tools v0.49.0 // indirect + golang.org/x/tools v0.51.0 // indirect gopkg.in/fsnotify.v1 v1.4.7 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/go.sum b/go.sum index 0b1cf68135..4497782e6a 100644 --- a/go.sum +++ b/go.sum @@ -784,8 +784,8 @@ golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M= -golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA= +golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= +golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -850,8 +850,8 @@ golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1 golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU= -golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= +golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= +golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -866,8 +866,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= -golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -914,13 +914,13 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= -golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= +golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE= -golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc= +golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM= +golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -931,8 +931,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= -golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= +golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= +golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= @@ -974,8 +974,8 @@ golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= -golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= +golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI= +golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/vendor/golang.org/x/crypto/acme/acme.go b/vendor/golang.org/x/crypto/acme/acme.go index b53ea28891..7d1226932f 100644 --- a/vendor/golang.org/x/crypto/acme/acme.go +++ b/vendor/golang.org/x/crypto/acme/acme.go @@ -185,10 +185,11 @@ func (c *Client) Discover(ctx context.Context) (Directory, error) { Nonce string `json:"newNonce"` KeyChange string `json:"keyChange"` Meta struct { - Terms string `json:"termsOfService"` - Website string `json:"website"` - CAA []string `json:"caaIdentities"` - ExternalAcct bool `json:"externalAccountRequired"` + Terms string `json:"termsOfService"` + Website string `json:"website"` + CAA []string `json:"caaIdentities"` + ExternalAcct bool `json:"externalAccountRequired"` + Profiles map[ProfileName]string `json:"profiles"` } } if err := json.NewDecoder(res.Body).Decode(&v); err != nil { @@ -208,6 +209,7 @@ func (c *Client) Discover(ctx context.Context) (Directory, error) { Website: v.Meta.Website, CAA: v.Meta.CAA, ExternalAccountRequired: v.Meta.ExternalAcct, + Profiles: v.Meta.Profiles, } return *c.dir, nil } @@ -221,7 +223,7 @@ func (c *Client) directoryURL() string { // CreateCert was part of the old version of ACME. It is incompatible with RFC 8555. // -// Deprecated: this was for the pre-RFC 8555 version of ACME. Callers should use CreateOrderCert. +// Deprecated: this was for the pre-RFC 8555 version of ACME. Callers should use CreateCertFromOrder. func (c *Client) CreateCert(ctx context.Context, csr []byte, exp time.Duration, bundle bool) (der [][]byte, certURL string, err error) { return nil, "", errPreRFC } diff --git a/vendor/golang.org/x/crypto/acme/autocert/autocert.go b/vendor/golang.org/x/crypto/acme/autocert/autocert.go index bee6de9ce8..1fbbbe8f1d 100644 --- a/vendor/golang.org/x/crypto/acme/autocert/autocert.go +++ b/vendor/golang.org/x/crypto/acme/autocert/autocert.go @@ -671,7 +671,7 @@ func (m *Manager) authorizedCert(ctx context.Context, key crypto.Signer, ck cert if err != nil { return nil, nil, err } - chain, _, err := client.CreateOrderCert(ctx, o.FinalizeURL, csr, true) + chain, _, err := client.CreateCertFromOrder(ctx, o, csr, true) if err != nil { return nil, nil, err } diff --git a/vendor/golang.org/x/crypto/acme/rfc8555.go b/vendor/golang.org/x/crypto/acme/rfc8555.go index 1fb110e08a..4eeaad57df 100644 --- a/vendor/golang.org/x/crypto/acme/rfc8555.go +++ b/vendor/golang.org/x/crypto/acme/rfc8555.go @@ -14,6 +14,8 @@ import ( "fmt" "io" "net/http" + "slices" + "strings" "time" ) @@ -197,7 +199,7 @@ func (c *Client) accountKeyRollover(ctx context.Context, newKey crypto.Signer) e // identify those with StatusPending status and fulfill a challenge using Accept. // Once all authorizations are satisfied, the caller will typically want to poll // order status using WaitOrder until it's in StatusReady state. -// To finalize the order and obtain a certificate, the caller submits a CSR with CreateOrderCert. +// To finalize the order and obtain a certificate, the caller submits a CSR with CreateCertFromOrder. func (c *Client) AuthorizeOrder(ctx context.Context, id []AuthzID, opt ...OrderOption) (*Order, error) { dir, err := c.Discover(ctx) if err != nil { @@ -208,6 +210,7 @@ func (c *Client) AuthorizeOrder(ctx context.Context, id []AuthzID, opt ...OrderO Identifiers []wireAuthzID `json:"identifiers"` NotBefore string `json:"notBefore,omitempty"` NotAfter string `json:"notAfter,omitempty"` + Profile string `json:"profile,omitempty"` }{} for _, v := range id { req.Identifiers = append(req.Identifiers, wireAuthzID{ @@ -221,6 +224,19 @@ func (c *Client) AuthorizeOrder(ctx context.Context, id []AuthzID, opt ...OrderO req.NotBefore = time.Time(o).Format(time.RFC3339) case orderNotAfterOpt: req.NotAfter = time.Time(o).Format(time.RFC3339) + case orderProfileOpt: + if len(dir.Profiles) == 0 { + return nil, errCADoesNotSupportProfiles + } + profileName := o.profileName() + if _, ok := dir.Profiles[profileName]; !ok { + return nil, fmt.Errorf( + "%w %s (supported profiles: %s)", + errProfileNotInSetOfSupportedProfiles, + profileName, + strings.Join(profileNames(dir.Profiles), ", ")) + } + req.Profile = string(profileName) default: // Package's fault if we let this happen. panic(fmt.Sprintf("unsupported order option type %T", o)) @@ -235,6 +251,15 @@ func (c *Client) AuthorizeOrder(ctx context.Context, id []AuthzID, opt ...OrderO return responseOrder(res) } +func profileNames(profiles map[ProfileName]string) []string { + names := make([]string, 0, len(profiles)) + for name := range profiles { + names = append(names, string(name)) + } + slices.Sort(names) + return names +} + // GetOrder retrieves an order identified by the given URL. // For orders created with AuthorizeOrder, the url value is Order.URI. // @@ -250,7 +275,11 @@ func (c *Client) GetOrder(ctx context.Context, url string) (*Order, error) { return nil, err } defer res.Body.Close() - return responseOrder(res) + o, err := responseOrder(res) + if err == nil && o.URI == "" { + o.URI = url + } + return o, err } // WaitOrder polls an order from the given URL until it is in one of the final states, @@ -271,6 +300,9 @@ func (c *Client) WaitOrder(ctx context.Context, url string) (*Order, error) { } o, err := responseOrder(res) res.Body.Close() + if err == nil && o.URI == "" { + o.URI = url + } switch { case err != nil: // Skip and retry. @@ -308,6 +340,7 @@ func responseOrder(res *http.Response) (*Order, error) { Authorizations []string Finalize string Certificate string + Profile string } if err := json.NewDecoder(res.Body).Decode(&v); err != nil { return nil, fmt.Errorf("acme: error reading order: %v", err) @@ -321,6 +354,7 @@ func responseOrder(res *http.Response) (*Order, error) { AuthzURLs: v.Authorizations, FinalizeURL: v.Finalize, CertURL: v.Certificate, + Profile: ProfileName(v.Profile), } for _, id := range v.Identifiers { o.Identifiers = append(o.Identifiers, AuthzID{Type: id.Type, Value: id.Value}) @@ -338,11 +372,43 @@ func responseOrder(res *http.Response) (*Order, error) { // certificate chain. Otherwise, only a leaf certificate is returned. // The returned URL can be used to re-fetch the certificate using FetchCert. // -// This method is only supported by CAs implementing RFC 8555. See CreateCert for pre-RFC CAs. +// This method is only supported by CAs implementing RFC 8555 that return a +// Location header for order finalization responses. Most users should prefer +// CreateCertFromOrder, an alternative that has better interoperation with RFC 8555 +// compliant CAs. See CreateCert for pre-RFC CAs. // // CreateOrderCert returns an error if the CA's response is unreasonably large. // Callers are encouraged to parse the returned value to ensure the certificate is valid and has the expected features. func (c *Client) CreateOrderCert(ctx context.Context, url string, csr []byte, bundle bool) (der [][]byte, certURL string, err error) { + return c.createOrderCert(ctx, url, "", csr, bundle) +} + +// CreateCertFromOrder submits the CSR (Certificate Signing Request) to a CA for +// the specified Order created with AuthorizeOrder. +// +// If the bundle argument is true, the returned value also contain the CA (issuer) +// certificate chain. Otherwise, only a leaf certificate is returned. +// The returned URL can be used to re-fetch the certificate using FetchCert. +// +// This method is only supported by CAs implementing RFC 8555. +// See CreateCert for pre-RFC CAs. +// +// CreateCertFromOrder returns an error if the CA's response is unreasonably large. +// Callers are encouraged to parse the returned value to ensure the certificate is valid and has the expected features. +func (c *Client) CreateCertFromOrder(ctx context.Context, order *Order, csr []byte, bundle bool) (der [][]byte, certURL string, err error) { + if order == nil { + return nil, "", errors.New("acme: nil order") + } + if order.URI == "" { + return nil, "", errors.New("acme: order URI is empty") + } + if order.FinalizeURL == "" { + return nil, "", errors.New("acme: order finalize URL is empty") + } + return c.createOrderCert(ctx, order.FinalizeURL, order.URI, csr, bundle) +} + +func (c *Client) createOrderCert(ctx context.Context, finalizeURL, orderURL string, csr []byte, bundle bool) (der [][]byte, certURL string, err error) { if _, err := c.Discover(ctx); err != nil { // required by c.accountKID return nil, "", err } @@ -353,7 +419,7 @@ func (c *Client) CreateOrderCert(ctx context.Context, url string, csr []byte, bu }{ CSR: base64.RawURLEncoding.EncodeToString(csr), } - res, err := c.post(ctx, nil, url, req, wantStatus(http.StatusOK)) + res, err := c.post(ctx, nil, finalizeURL, req, wantStatus(http.StatusOK)) if err != nil { return nil, "", err } @@ -365,7 +431,10 @@ func (c *Client) CreateOrderCert(ctx context.Context, url string, csr []byte, bu // Wait for CA to issue the cert if they haven't. if o.Status != StatusValid { - o, err = c.WaitOrder(ctx, o.URI) + if orderURL == "" { + orderURL = o.URI + } + o, err = c.WaitOrder(ctx, orderURL) } if err != nil { return nil, "", err diff --git a/vendor/golang.org/x/crypto/acme/types.go b/vendor/golang.org/x/crypto/acme/types.go index 4df7e6df0e..7f9caf703a 100644 --- a/vendor/golang.org/x/crypto/acme/types.go +++ b/vendor/golang.org/x/crypto/acme/types.go @@ -60,6 +60,15 @@ var ( // errPreAuthorizationNotSupported indicates that the server does not // support pre-authorization of identifiers. errPreAuthorizationNotSupported = errors.New("acme: pre-authorization is not supported") + + // errCADoesNotSupportProfiles indicates that [WithOrderIssuanceProfile] was + // included with a CA that does not advertise support for profiles in + // their directory. + errCADoesNotSupportProfiles = errors.New("acme: certificate authority does not support profiles") + + // errProfileNotInSetOfSupportedProfiles indicates that the profile + // specified with [WithOrderIssuanceProfile] is not one supported by the CA + errProfileNotInSetOfSupportedProfiles = errors.New("acme: certificate authority does not advertise a profile with name") ) // A Subproblem describes an ACME subproblem as reported in an Error. @@ -316,6 +325,14 @@ type Directory struct { // ExternalAccountRequired indicates that the CA requires for all account-related // requests to include external account binding information. ExternalAccountRequired bool + + // Profiles is a map of profile identifiers to URLs containing the description of the + // profile. The identifiers can be used with [WithOrderIssuanceProfile] to + // request issuance with a specific profile. If the map is empty, the + // CA does not support issuance profiles. Per the draft, "CAs MAY use data + // URIs to provide an in-line text description if they do not wish to host + // external documentation pages" (e.g., `data://` URLs). + Profiles map[ProfileName]string } // Order represents a client's request for a certificate. @@ -330,7 +347,7 @@ type Order struct { // Possible values are StatusPending, StatusReady, StatusProcessing, StatusValid and StatusInvalid. // Pending means the CA does not believe that the client has fulfilled the requirements. // Ready indicates that the client has fulfilled all the requirements and can submit a CSR - // to obtain a certificate. This is done with Client's CreateOrderCert. + // to obtain a certificate. This is done with Client's CreateCertFromOrder. // Processing means the certificate is being issued. // Valid indicates the CA has issued the certificate. It can be downloaded // from the Order's CertURL. This is done with Client's FetchCert. @@ -374,6 +391,9 @@ type Order struct { // The error that occurred while processing the order as received from a CA, if any. Error *Error + + // Profile is the optional issuance profile used for this order. + Profile ProfileName } // OrderOption allows customizing Client.AuthorizeOrder call. @@ -391,6 +411,18 @@ func WithOrderNotAfter(t time.Time) OrderOption { return orderNotAfterOpt(t) } +// WithOrderIssuanceProfile sets the order's profile field. It should be used +// with a profile present in the CA's [Directory.Profiles]. Specifying +// the profile name here will add it to the order request. If specified when a +// CA doesn't advertise support for profiles, an error will be returned prior +// to sending the request. If a name is not in the directory, an error will be +// returned prior to sending the request. +// See also: +// * https://datatracker.ietf.org/doc/draft-ietf-acme-profiles/ +func WithOrderIssuanceProfile(name ProfileName) OrderOption { + return orderProfileOpt(name) +} + type orderNotBeforeOpt time.Time func (orderNotBeforeOpt) privateOrderOpt() {} @@ -399,6 +431,12 @@ type orderNotAfterOpt time.Time func (orderNotAfterOpt) privateOrderOpt() {} +type orderProfileOpt string + +func (orderProfileOpt) privateOrderOpt() {} + +func (o orderProfileOpt) profileName() ProfileName { return ProfileName(o) } + // Authorization encodes an authorization response. type Authorization struct { // URI uniquely identifies a authorization. @@ -635,3 +673,5 @@ func WithTemplate(t *x509.Certificate) CertOption { type certOptTemplate x509.Certificate func (*certOptTemplate) privateCertOpt() {} + +type ProfileName string diff --git a/vendor/golang.org/x/crypto/argon2/blamka_generic.go b/vendor/golang.org/x/crypto/argon2/blamka_generic.go index a481b2243f..4c9dabbb2a 100644 --- a/vendor/golang.org/x/crypto/argon2/blamka_generic.go +++ b/vendor/golang.org/x/crypto/argon2/blamka_generic.go @@ -6,6 +6,10 @@ package argon2 var useSSE4 bool +// useLSX reports whether the loong64 LSX vector implementation should be +// used. It is set from cpu.Loong64.HasLSX in blamka_loong64.go's init(). +var useLSX bool + func processBlockGeneric(out, in1, in2 *block, xor bool) { var t block for i := range t { diff --git a/vendor/golang.org/x/crypto/argon2/blamka_loong64.go b/vendor/golang.org/x/crypto/argon2/blamka_loong64.go new file mode 100644 index 0000000000..e7daeb4c54 --- /dev/null +++ b/vendor/golang.org/x/crypto/argon2/blamka_loong64.go @@ -0,0 +1,49 @@ +// Copyright 2026 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. + +//go:build loong64 && gc && !purego + +package argon2 + +import "golang.org/x/sys/cpu" + +func init() { + // useLSX (declared in blamka_generic.go) gates the LSX vector path. + // If the running CPU lacks LSX support, processBlockVX falls back + // to processBlockGeneric. + useLSX = cpu.Loong64.HasLSX +} + +//go:noescape +func blamkaLOONG64(b *block) + +//go:noescape +func mixBlocksVX(out, a, b, c *block) + +//go:noescape +func xorBlocksVX(out, a, b, c *block) + +func processBlock(out, in1, in2 *block) { + processBlockVX(out, in1, in2, false) +} + +func processBlockXOR(out, in1, in2 *block) { + processBlockVX(out, in1, in2, true) +} + +func processBlockVX(out, in1, in2 *block, xor bool) { + if !useLSX { + processBlockGeneric(out, in1, in2, xor) + return + } + + var t block + mixBlocksVX(&t, in1, in2, &t) + blamkaLOONG64(&t) + if xor { + xorBlocksVX(out, in1, in2, &t) + } else { + mixBlocksVX(out, in1, in2, &t) + } +} diff --git a/vendor/golang.org/x/crypto/argon2/blamka_loong64.s b/vendor/golang.org/x/crypto/argon2/blamka_loong64.s new file mode 100644 index 0000000000..7843a7c2d1 --- /dev/null +++ b/vendor/golang.org/x/crypto/argon2/blamka_loong64.s @@ -0,0 +1,240 @@ +// Copyright 2026 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. + +//go:build loong64 && gc && !purego + +#include "textflag.h" + +// HALF_ROUND applies one BlaMka half-round (mul-add-xor-rotate) to two +// groups of 4 columns, each packed 2-wide into V registers (v0/v2/v4/v6 +// hold one pair of columns in lane0/lane1, v1/v3/v5/v7 hold the other). +// t0, t1 are scratch registers, one per independent column group. +#define HALF_ROUND(v0, v1, v2, v3, v4, v5, v6, v7, t0, t1) \ + VMULWEVVWU v0, v2, t0; \ + VADDV t0, t0, t0; \ + VADDV v0, v2, v0; \ + VADDV v0, t0, v0; \ + VXORV v6, v0, v6; \ + VROTRV $32, v6, v6; \ + VMULWEVVWU v1, v3, t1; \ + VADDV t1, t1, t1; \ + VADDV v1, v3, v1; \ + VADDV v1, t1, v1; \ + VXORV v7, v1, v7; \ + VROTRV $32, v7, v7; \ + VMULWEVVWU v4, v6, t0; \ + VADDV t0, t0, t0; \ + VADDV v4, v6, v4; \ + VADDV v4, t0, v4; \ + VXORV v2, v4, v2; \ + VROTRV $24, v2, v2; \ + VMULWEVVWU v5, v7, t1; \ + VADDV t1, t1, t1; \ + VADDV v5, v7, v5; \ + VADDV v5, t1, v5; \ + VXORV v3, v5, v3; \ + VROTRV $24, v3, v3; \ + VMULWEVVWU v0, v2, t0; \ + VADDV t0, t0, t0; \ + VADDV v0, v2, v0; \ + VADDV v0, t0, v0; \ + VXORV v6, v0, v6; \ + VROTRV $16, v6, v6; \ + VMULWEVVWU v1, v3, t1; \ + VADDV t1, t1, t1; \ + VADDV v1, v3, v1; \ + VADDV v1, t1, v1; \ + VXORV v7, v1, v7; \ + VROTRV $16, v7, v7; \ + VMULWEVVWU v4, v6, t0; \ + VADDV t0, t0, t0; \ + VADDV v4, v6, v4; \ + VADDV v4, t0, v4; \ + VXORV v2, v4, v2; \ + VROTRV $63, v2, v2; \ + VMULWEVVWU v5, v7, t1; \ + VADDV t1, t1, t1; \ + VADDV v5, v7, v5; \ + VADDV v5, t1, v5; \ + VXORV v3, v5, v3; \ + VROTRV $63, v3, v3 + +// SHUFFLE / SHUFFLE_INV: reused verbatim from blake2b_loong64.s -- amd64 +// avo source confirms argon2's SHUFFLE/SHUFFLE_INV and blake2b's SHUFFLE +// are byte-for-byte identical macros (diagonalize / undiagonalize), +// operating only on V2..V7 (V0/V1 untouched), with V13 held at zero. +#define SHUFFLE \ + VADDV V2, V13, V12; \ + VADDV V6, V13, V16; \ + VADDV V4, V13, V14; \ + VADDV V5, V13, V4; \ + VADDV V14, V13, V5; \ + VSHUF4IV $9, V3, V2; \ + VSHUF4IV $9, V12, V3; \ + VSHUF4IV $3, V7, V6; \ + VSHUF4IV $3, V16, V7 + +#define SHUFFLE_INV \ + VADDV V2, V13, V12; \ + VADDV V6, V13, V16; \ + VADDV V4, V13, V14; \ + VADDV V5, V13, V4; \ + VADDV V14, V13, V5; \ + VSHUF4IV $3, V3, V2; \ + VSHUF4IV $3, V12, V3; \ + VSHUF4IV $9, V7, V6; \ + VSHUF4IV $9, V16, V7 + +// LOAD_MSG_0 / STORE_MSG_0: row pass. `off` is the byte offset of the +// 128-byte (16-uint64) row group; within the macro the 8 loads step by +// 16B (2 uint64 per V register). Called from blamkaLOONG64 with off +// stepping by 128B across the 8 row groups -- do not confuse the two +// strides. +#define LOAD_MSG_0(off) \ + VMOVQ (off+0)(R4), V0; \ + VMOVQ (off+16)(R4), V1; \ + VMOVQ (off+32)(R4), V2; \ + VMOVQ (off+48)(R4), V3; \ + VMOVQ (off+64)(R4), V4; \ + VMOVQ (off+80)(R4), V5; \ + VMOVQ (off+96)(R4), V6; \ + VMOVQ (off+112)(R4), V7 + +#define STORE_MSG_0(off) \ + VMOVQ V0, (off+0)(R4); \ + VMOVQ V1, (off+16)(R4); \ + VMOVQ V2, (off+32)(R4); \ + VMOVQ V3, (off+48)(R4); \ + VMOVQ V4, (off+64)(R4); \ + VMOVQ V5, (off+80)(R4); \ + VMOVQ V6, (off+96)(R4); \ + VMOVQ V7, (off+112)(R4) + +// LOAD_MSG_1 / STORE_MSG_1: diagonal pass. `off` is the byte offset within +// a 128-byte row group; within the macro the 8 loads step by 128B (one +// element from each of the 8 row groups, mirroring blamka_generic.go's +// t[off], t[128+off], t[256+off], ...). Called from blamkaLOONG64 with +// off stepping by 16B (2 uint64) across the 8 diagonal groups -- the +// inner/outer strides are swapped relative to LOAD_MSG_0/STORE_MSG_0. +#define LOAD_MSG_1(off) \ + VMOVQ (off+0)(R4), V0; \ + VMOVQ (off+128)(R4), V1; \ + VMOVQ (off+256)(R4), V2; \ + VMOVQ (off+384)(R4), V3; \ + VMOVQ (off+512)(R4), V4; \ + VMOVQ (off+640)(R4), V5; \ + VMOVQ (off+768)(R4), V6; \ + VMOVQ (off+896)(R4), V7 + +#define STORE_MSG_1(off) \ + VMOVQ V0, (off+0)(R4); \ + VMOVQ V1, (off+128)(R4); \ + VMOVQ V2, (off+256)(R4); \ + VMOVQ V3, (off+384)(R4); \ + VMOVQ V4, (off+512)(R4); \ + VMOVQ V5, (off+640)(R4); \ + VMOVQ V6, (off+768)(R4); \ + VMOVQ V7, (off+896)(R4) + +// BLAMKA_ROUND_0(off): one full row pass over the 16-uint64 group at +// byte offset off -- corresponds to a single call to blamkaGeneric +// with the "row" argument order (t[off]..t[off+15]). +#define BLAMKA_ROUND_0(off) \ + LOAD_MSG_0(off); \ + HALF_ROUND(V0, V1, V2, V3, V4, V5, V6, V7, V8, V9); \ + SHUFFLE; \ + HALF_ROUND(V0, V1, V2, V3, V4, V5, V6, V7, V8, V9); \ + SHUFFLE_INV; \ + STORE_MSG_0(off) + +// BLAMKA_ROUND_1(off): one full diagonal pass over the 16 uint64s at +// diagonal offset off -- corresponds to a single call to blamkaGeneric +// with the "diagonal" argument order (t[off], t[off+1], t[16+off], ...). +#define BLAMKA_ROUND_1(off) \ + LOAD_MSG_1(off); \ + HALF_ROUND(V0, V1, V2, V3, V4, V5, V6, V7, V8, V9); \ + SHUFFLE; \ + HALF_ROUND(V0, V1, V2, V3, V4, V5, V6, V7, V8, V9); \ + SHUFFLE_INV; \ + STORE_MSG_1(off) + +// func blamkaLOONG64(b *block) +TEXT ·blamkaLOONG64(SB), NOSPLIT, $0-8 + MOVV b+0(FP), R4 + + VXORV V13, V13, V13 // V13 = 0, used by SHUFFLE/SHUFFLE_INV + + // Round 0: 8 row passes, stride 128 bytes (16 uint64s). + BLAMKA_ROUND_0(0) + BLAMKA_ROUND_0(128) + BLAMKA_ROUND_0(256) + BLAMKA_ROUND_0(384) + BLAMKA_ROUND_0(512) + BLAMKA_ROUND_0(640) + BLAMKA_ROUND_0(768) + BLAMKA_ROUND_0(896) + + // Round 1: 8 diagonal passes, stride 16 bytes (2 uint64s). + BLAMKA_ROUND_1(0) + BLAMKA_ROUND_1(16) + BLAMKA_ROUND_1(32) + BLAMKA_ROUND_1(48) + BLAMKA_ROUND_1(64) + BLAMKA_ROUND_1(80) + BLAMKA_ROUND_1(96) + BLAMKA_ROUND_1(112) + + RET + +// func mixBlocksVX(out, a, b, c *block) +TEXT ·mixBlocksVX(SB), NOSPLIT, $0-32 + MOVV out+0(FP), R4 + MOVV a+8(FP), R5 + MOVV b+16(FP), R6 + MOVV c+24(FP), R7 + MOVV $1024, R8 + + PCALIGN $16 +mixloop: + VMOVQ (R5), V0 + VMOVQ (R6), V1 + VMOVQ (R7), V2 + VXORV V0, V1, V0 + VXORV V0, V2, V0 + VMOVQ V0, (R4) + ADDV $16, R4 + ADDV $16, R5 + ADDV $16, R6 + ADDV $16, R7 + SUBV $16, R8 + BNE R8, R0, mixloop + + RET + +// func xorBlocksVX(out, a, b, c *block) +TEXT ·xorBlocksVX(SB), NOSPLIT, $0-32 + MOVV out+0(FP), R4 + MOVV a+8(FP), R5 + MOVV b+16(FP), R6 + MOVV c+24(FP), R7 + MOVV $1024, R8 + + PCALIGN $16 +xorloop: + VMOVQ (R5), V0 + VMOVQ (R6), V1 + VMOVQ (R7), V2 + VMOVQ (R4), V3 + VXORV V0, V1, V0 + VXORV V0, V2, V0 + VXORV V0, V3, V0 + VMOVQ V0, (R4) + ADDV $16, R4 + ADDV $16, R5 + ADDV $16, R6 + ADDV $16, R7 + SUBV $16, R8 + BNE R8, R0, xorloop + + RET diff --git a/vendor/golang.org/x/crypto/argon2/blamka_ref.go b/vendor/golang.org/x/crypto/argon2/blamka_ref.go index 16d58c650e..cf3e141659 100644 --- a/vendor/golang.org/x/crypto/argon2/blamka_ref.go +++ b/vendor/golang.org/x/crypto/argon2/blamka_ref.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !amd64 || purego || !gc +//go:build (!amd64 && !loong64) || purego || !gc package argon2 diff --git a/vendor/golang.org/x/crypto/blake2b/blake2b_loong64.go b/vendor/golang.org/x/crypto/blake2b/blake2b_loong64.go new file mode 100644 index 0000000000..5e979ebee4 --- /dev/null +++ b/vendor/golang.org/x/crypto/blake2b/blake2b_loong64.go @@ -0,0 +1,20 @@ +// Copyright 2026 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. + +//go:build loong64 && gc && !purego + +package blake2b + +import "golang.org/x/sys/cpu" + +//go:noescape +func hashBlocksVX(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) + +func hashBlocks(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) { + if cpu.Loong64.HasLSX { + hashBlocksVX(h, c, flag, blocks) + } else { + hashBlocksGeneric(h, c, flag, blocks) + } +} diff --git a/vendor/golang.org/x/crypto/blake2b/blake2b_loong64.s b/vendor/golang.org/x/crypto/blake2b/blake2b_loong64.s new file mode 100644 index 0000000000..be9c436ee2 --- /dev/null +++ b/vendor/golang.org/x/crypto/blake2b/blake2b_loong64.s @@ -0,0 +1,252 @@ +// Copyright 2026 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. + +//go:build loong64 && gc && !purego + +#include "textflag.h" + +DATA ·iv0<>+0(SB)/8, $0x6a09e667f3bcc908 +DATA ·iv0<>+8(SB)/8, $0xbb67ae8584caa73b +GLOBL ·iv0<>(SB), RODATA|NOPTR, $16 + +DATA ·iv1<>+0(SB)/8, $0x3c6ef372fe94f82b +DATA ·iv1<>+8(SB)/8, $0xa54ff53a5f1d36f1 +GLOBL ·iv1<>(SB), RODATA|NOPTR, $16 + +DATA ·iv2<>+0(SB)/8, $0x510e527fade682d1 +DATA ·iv2<>+8(SB)/8, $0x9b05688c2b3e6c1f +GLOBL ·iv2<>(SB), RODATA|NOPTR, $16 + +DATA ·iv3<>+0(SB)/8, $0x1f83d9abfb41bd6b +DATA ·iv3<>+8(SB)/8, $0x5be0cd19137e2179 +GLOBL ·iv3<>(SB), RODATA|NOPTR, $16 + +#define SHUFFLE_1 \ + VADDV V2, V13, V12; \ // V12 = V2 + VADDV V6, V13, V16; \ // V16 = V6 + VADDV V4, V13, V14; \ // V14 = V4 + VADDV V5, V13, V4; \ // V4 = V5 + VADDV V14, V13, V5; \ // V5 = V4 + VSHUF4IV $9, V3, V2; \ + VSHUF4IV $9, V12, V3; \ + VSHUF4IV $3, V7, V6; \ + VSHUF4IV $3, V16, V7; \ + +#define SHUFFLE_2 \ + VADDV V2, V13, V12; \ // V12 = V2 + VADDV V6, V13, V16; \ // V16 = V6 + VADDV V4, V13, V14; \ // V14 = V4 + VADDV V5, V13, V4; \ // V4 = V5 + VADDV V14, V13, V5; \ // V5 = V4 + VSHUF4IV $3, V3, V2; \ + VSHUF4IV $3, V12, V3; \ + VSHUF4IV $9, V7, V6; \ + VSHUF4IV $9, V16, V7; \ + +#define LOAD_M(a, b, c, d, e, f, g, h) \ + VMOVQ a, V8.V[0]; \ + VMOVQ b, V8.V[1]; \ + VMOVQ c, V9.V[0]; \ + VMOVQ d, V9.V[1]; \ + VMOVQ e, V10.V[0]; \ + VMOVQ f, V10.V[1]; \ + VMOVQ g, V11.V[0]; \ + VMOVQ h, V11.V[1]; \ + +#define ROUND_0 \ + VADDV V0, V8, V0; \ + VADDV V1, V9, V1; \ + VADDV V0, V2, V0; \ + VADDV V1, V3, V1; \ + VXORV V6, V0, V6; \ + VXORV V7, V1, V7; \ + VROTRV $32, V6, V6; \ + VROTRV $32, V7, V7; \ + VADDV V4, V6, V4; \ + VADDV V5, V7, V5; \ + VXORV V2, V4, V2; \ + VXORV V3, V5, V3; \ + VROTRV $24, V2, V2; \ + VROTRV $24, V3, V3; \ + VADDV V0, V10, V0; \ + VADDV V1, V11, V1; \ + VADDV V0, V2, V0; \ + VADDV V1, V3, V1; \ + VXORV V6, V0, V6; \ + VXORV V7, V1, V7; \ + VROTRV $16, V6, V6; \ + VROTRV $16, V7, V7; \ + VADDV V4, V6, V4; \ + VADDV V5, V7, V5; \ + VXORV V2, V4, V2; \ + VXORV V3, V5, V3; \ + VROTRV $63, V2, V2; \ + VROTRV $63, V3, V3; \ + +#define ROUND_8 ROUND_0 + +// func hashBlocksVX(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) +TEXT ·hashBlocksVX(SB), NOSPLIT, $0-48 + MOVV h+0(FP), R4 + MOVV c+8(FP), R5 + MOVV flag+16(FP), R6 + MOVV blocks_base+24(FP), R7 + MOVV blocks_len+32(FP), R8 + MOVV (R5), R9 // c0 + MOVV 8(R5), R10 // c1 + +loop: + ADDV $0x80, R9 + SGTU $0x80, R9, R11 + ADDV R10, R11, R10 + VMOVQ R9, V8.V[0] + VMOVQ R10, V8.V[1] + + MOVV $·iv0<>(SB), R11 + MOVV $·iv1<>(SB), R12 + MOVV $·iv2<>(SB), R13 + MOVV $·iv3<>(SB), R14 + VMOVQ (R13), V6 + VMOVQ (R11), V4 + VMOVQ (R12), V5 + MOVV (R14), R15 // v14 + MOVV 8(R14), R16 + VXORV V6, V8, V6 + XOR R15, R6, R15 + VMOVQ R16, V7.V[1] + VMOVQ R15, V7.V[0] + + VMOVQ (R4), V0 + VMOVQ 16(R4), V1 + VMOVQ 32(R4), V2 + VMOVQ 48(R4), V3 + + MOVV 0(R7), R11 + MOVV 8(R7), R12 + MOVV 16(R7), R13 + MOVV 24(R7), R14 + MOVV 32(R7), R15 + MOVV 40(R7), R16 + MOVV 48(R7), R17 + MOVV 56(R7), R18 + MOVV 64(R7), R19 + MOVV 72(R7), R24 + MOVV 80(R7), R25 + MOVV 88(R7), R26 + MOVV 96(R7), R27 + MOVV 104(R7), R28 + MOVV 112(R7), R29 + MOVV 120(R7), R30 + + VXORV V13, V13, V13 // V13=0 + + LOAD_M(R11, R13, R15, R17, R12, R14, R16, R18) + ROUND_0 + SHUFFLE_1 + LOAD_M(R19, R25, R27, R29, R24, R26, R28, R30) + ROUND_8 + SHUFFLE_2 + + LOAD_M(R29, R15, R24, R28, R25, R19, R30, R17) + ROUND_0 + SHUFFLE_1 + LOAD_M(R12, R11, R26, R16, R27, R13, R18, R14) + ROUND_8 + SHUFFLE_2 + + LOAD_M(R26, R27, R16, R30, R19, R11, R13, R28) + ROUND_0 + SHUFFLE_1 + LOAD_M(R25, R14, R18, R24, R29, R17, R12, R15) + ROUND_8 + SHUFFLE_2 + + LOAD_M(R18, R14, R28, R26, R24, R12, R27, R29) + ROUND_0 + SHUFFLE_1 + LOAD_M(R13, R16, R15, R30, R17, R25, R11, R19) + ROUND_8 + SHUFFLE_2 + + LOAD_M(R24, R16, R13, R25, R11, R18, R15, R30) + ROUND_0 + SHUFFLE_1 + LOAD_M(R29, R26, R17, R14, R12, R27, R19, R28) + ROUND_8 + SHUFFLE_2 + + LOAD_M(R13, R17, R11, R19, R27, R25, R26, R14) + ROUND_0 + SHUFFLE_1 + LOAD_M(R15, R18, R30, R12, R28, R16, R29, R24) + ROUND_8 + SHUFFLE_2 + + LOAD_M(R27, R12, R29, R15, R16, R30, R28, R25) + ROUND_0 + SHUFFLE_1 + LOAD_M(R11, R17, R24, R19, R18, R14, R13, R26) + ROUND_8 + SHUFFLE_2 + + LOAD_M(R28, R18, R27, R14, R26, R29, R12, R24) + ROUND_0 + SHUFFLE_1 + LOAD_M(R16, R30, R19, R13, R11, R15, R17, R25) + ROUND_8 + SHUFFLE_2 + + LOAD_M(R17, R29, R26, R11, R30, R24, R14, R19) + ROUND_0 + SHUFFLE_1 + LOAD_M(R27, R28, R12, R25, R13, R18, R15, R16) + ROUND_8 + SHUFFLE_2 + + LOAD_M(R25, R19, R18, R12, R13, R15, R17, R16) + ROUND_0 + SHUFFLE_1 + LOAD_M(R30, R24, R14, R28, R26, R29, R27, R11) + ROUND_8 + SHUFFLE_2 + + LOAD_M(R11, R13, R15, R17, R12, R14, R16, R18) + ROUND_0 + SHUFFLE_1 + LOAD_M(R19, R25, R27, R29, R24, R26, R28, R30) + ROUND_8 + SHUFFLE_2 + + LOAD_M(R29, R15, R24, R28, R25, R19, R30, R17) + ROUND_0 + SHUFFLE_1 + LOAD_M(R12, R11, R26, R16, R27, R13, R18, R14) + ROUND_8 + SHUFFLE_2 + + VMOVQ (R4), V8 + VMOVQ 16(R4), V9 + VMOVQ 32(R4), V10 + VMOVQ 48(R4), V11 + VXORV V0, V4, V0 + VXORV V1, V5, V1 + VXORV V2, V6, V2 + VXORV V3, V7, V3 + VXORV V0, V8, V0 + VXORV V1, V9, V1 + VXORV V2, V10, V2 + VXORV V3, V11, V3 + VMOVQ V0, (R4) + VMOVQ V1, 16(R4) + VMOVQ V2, 32(R4) + VMOVQ V3, 48(R4) + + SUBV $128, R8 + ADDV $128, R7 + BNE R8, R0, loop + + MOVV R9, (R5) + MOVV R10, 8(R5) + + RET diff --git a/vendor/golang.org/x/crypto/blake2b/blake2b_ref.go b/vendor/golang.org/x/crypto/blake2b/blake2b_ref.go index 6e28668cd1..70852a0b48 100644 --- a/vendor/golang.org/x/crypto/blake2b/blake2b_ref.go +++ b/vendor/golang.org/x/crypto/blake2b/blake2b_ref.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !amd64 || purego || !gc +//go:build (!amd64 && !loong64) || purego || !gc package blake2b diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_loong64.go b/vendor/golang.org/x/crypto/chacha20/chacha_loong64.go new file mode 100644 index 0000000000..9679f9ee09 --- /dev/null +++ b/vendor/golang.org/x/crypto/chacha20/chacha_loong64.go @@ -0,0 +1,22 @@ +// Copyright 2026 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. + +//go:build gc && !purego + +package chacha20 + +import "golang.org/x/sys/cpu" + +const bufSize = 256 + +//go:noescape +func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32) + +func (c *Cipher) xorKeyStreamBlocks(dst, src []byte) { + if cpu.Loong64.HasLSX { + xorKeyStreamVX(dst, src, &c.key, &c.nonce, &c.counter) + } else { + c.xorKeyStreamBlocksGeneric(dst, src) + } +} diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_loong64.s b/vendor/golang.org/x/crypto/chacha20/chacha_loong64.s new file mode 100644 index 0000000000..e377b43273 --- /dev/null +++ b/vendor/golang.org/x/crypto/chacha20/chacha_loong64.s @@ -0,0 +1,342 @@ +// Copyright 2026 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. + +// derived from chacha_arm64.s + +//go:build gc && !purego + +#include "textflag.h" + +DATA ·constants+0x00(SB)/4, $0x61707865 +DATA ·constants+0x04(SB)/4, $0x3320646e +DATA ·constants+0x08(SB)/4, $0x79622d32 +DATA ·constants+0x0c(SB)/4, $0x6b206574 +GLOBL ·constants(SB), NOPTR|RODATA, $32 + +DATA ·incRotMatrix+0x00(SB)/4, $0x00000000 +DATA ·incRotMatrix+0x04(SB)/4, $0x00000001 +DATA ·incRotMatrix+0x08(SB)/4, $0x00000002 +DATA ·incRotMatrix+0x0c(SB)/4, $0x00000003 +GLOBL ·incRotMatrix(SB), NOPTR|RODATA, $32 + +#define NUM_ROUNDS 10 + +// func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32) +TEXT ·xorKeyStreamVX(SB), NOSPLIT, $0 + MOVV dst+0(FP), R4 + MOVV src+24(FP), R5 + MOVV src_len+32(FP), R6 + MOVV key+48(FP), R7 + MOVV nonce+56(FP), R8 + MOVV counter+64(FP), R9 + + MOVV $·constants(SB), R10 + MOVV $·incRotMatrix(SB), R11 + + MOVW (R9), R12 + +loop: + MOVV $NUM_ROUNDS, R15 + // load 4-32bit data from incRotMatrix added to counter + VMOVQ (R11), V30 + + // load contants + VMOVQ (R10), V0.W4 + VMOVQ 4(R10), V1.W4 + VMOVQ 8(R10), V2.W4 + VMOVQ 12(R10), V3.W4 + + // load keys + VMOVQ (R7), V4.W4 + VMOVQ 4(R7), V5.W4 + VMOVQ 8(R7), V6.W4 + VMOVQ 12(R7), V7.W4 + VMOVQ 16(R7), V8.W4 + VMOVQ 20(R7), V9.W4 + VMOVQ 24(R7), V10.W4 + VMOVQ 28(R7), V11.W4 + + // load counter + nonce + VMOVQ (R9), V12.W4 + + VMOVQ (R8), V13.W4 + VMOVQ 4(R8), V14.W4 + VMOVQ 8(R8), V15.W4 + + // update counter + VADDW V30, V12, V12 + +chacha: + // V0..V3 += V4..V7 + // V12..V15 <<<= ((V12..V15 XOR V0..V3), 16) + VADDW V0, V4, V0 + VADDW V1, V5, V1 + VADDW V2, V6, V2 + VADDW V3, V7, V3 + VXORV V12, V0, V12 + VXORV V13, V1, V13 + VXORV V14, V2, V14 + VXORV V15, V3, V15 + VROTRW $16, V12, V12 + VROTRW $16, V13, V13 + VROTRW $16, V14, V14 + VROTRW $16, V15, V15 + + // V8..V11 += V12..V15 + // V4..V7 <<<= ((V4..V7 XOR V8..V11), 12) + VADDW V8, V12, V8 + VADDW V9, V13, V9 + VADDW V10, V14, V10 + VADDW V11, V15, V11 + VXORV V4, V8, V4 + VXORV V5, V9, V5 + VXORV V6, V10, V6 + VXORV V7, V11, V7 + VROTRW $20, V4, V4 + VROTRW $20, V5, V5 + VROTRW $20, V6, V6 + VROTRW $20, V7, V7 + + // V0..V3 += V4..V7 + // V12..V15 <<<= ((V12..V15 XOR V0..V3), 8) + VADDW V0, V4, V0 + VADDW V1, V5, V1 + VADDW V2, V6, V2 + VADDW V3, V7, V3 + VXORV V12, V0, V12 + VXORV V13, V1, V13 + VXORV V14, V2, V14 + VXORV V15, V3, V15 + VROTRW $24, V12, V12 + VROTRW $24, V13, V13 + VROTRW $24, V14, V14 + VROTRW $24, V15, V15 + + // V8..V11 += V12..V15 + // V4..V7 <<<= ((V4..V7 XOR V8..V11), 7) + VADDW V12, V8, V8 + VADDW V13, V9, V9 + VADDW V14, V10, V10 + VADDW V15, V11, V11 + VXORV V4, V8, V4 + VXORV V5, V9, V5 + VXORV V6, V10, V6 + VXORV V7, V11, V7 + VROTRW $25, V4, V4 + VROTRW $25, V5, V5 + VROTRW $25, V6, V6 + VROTRW $25, V7, V7 + + // V0..V3 += V5..V7, V4 + // V15,V12-V14 <<<= ((V15,V12-V14 XOR V0..V3), 16) + VADDW V0, V5, V0 + VADDW V1, V6, V1 + VADDW V2, V7, V2 + VADDW V3, V4, V3 + VXORV V15, V0, V15 + VXORV V12, V1, V12 + VXORV V13, V2, V13 + VXORV V14, V3, V14 + VROTRW $16, V15, V15 + VROTRW $16, V12, V12 + VROTRW $16, V13, V13 + VROTRW $16, V14, V14 + + // V10,V11,V8,V9 += V15,V12,V13,V14 + // V5,V6,V7,V4 <<<= ((V5,V6,V7,V4 XOR V10,V11,V8,V9), 12) + VADDW V10, V15, V10 + VADDW V11, V12, V11 + VADDW V8, V13, V8 + VADDW V9, V14, V9 + VXORV V5, V10, V5 + VXORV V6, V11, V6 + VXORV V7, V8, V7 + VXORV V4, V9, V4 + VROTRW $20, V5, V5 + VROTRW $20, V6, V6 + VROTRW $20, V7, V7 + VROTRW $20, V4, V4 + + // V0..V3 += V5..V7, V4 + // V15,V12-V14 <<<= ((V15,V12-V14 XOR V0..V3), 8) + VADDW V5, V0, V0 + VADDW V6, V1, V1 + VADDW V7, V2, V2 + VADDW V4, V3, V3 + VXORV V15, V0, V15 + VXORV V12, V1, V12 + VXORV V13, V2, V13 + VXORV V14, V3, V14 + VROTRW $24, V15, V15 + VROTRW $24, V12, V12 + VROTRW $24, V13, V13 + VROTRW $24, V14, V14 + + // V10,V11,V8,V9 += V15,V12,V13,V14 + // V5,V6,V7,V4 <<<= ((V5,V6,V7,V4 XOR V10,V11,V8,V9), 7) + VADDW V15, V10, V10 + VADDW V12, V11, V11 + VADDW V13, V8, V8 + VADDW V14, V9, V9 + VXORV V5, V10, V5 + VXORV V6, V11, V6 + VXORV V7, V8, V7 + VXORV V4, V9, V4 + VROTRW $25, V5, V5 + VROTRW $25, V6, V6 + VROTRW $25, V7, V7 + VROTRW $25, V4, V4 + + SUBV $1, R15 + BNE R15, R0, chacha + + // load origin contants + VMOVQ (R10), V16.W4 + VMOVQ 4(R10), V17.W4 + VMOVQ 8(R10), V18.W4 + VMOVQ 12(R10), V19.W4 + + // load origin keys + VMOVQ (R7), V20.W4 + VMOVQ 4(R7), V21.W4 + VMOVQ 8(R7), V22.W4 + VMOVQ 12(R7), V23.W4 + VMOVQ 16(R7), V24.W4 + VMOVQ 20(R7), V25.W4 + VMOVQ 24(R7), V26.W4 + VMOVQ 28(R7), V27.W4 + + // add back the initial state to generate the key stream + VADDW V30, V12, V12 // update counter in advance to prevent V30 from being overwritten + VADDW V16, V0, V0 + VADDW V17, V1, V1 + VADDW V18, V2, V2 + VADDW V19, V3, V3 + + // load origin counter + nonce + VMOVQ (R9), V28.W4 + VMOVQ (R8), V29.W4 + VMOVQ 4(R8), V30.W4 + VMOVQ 8(R8), V31.W4 + + VADDW V20, V4, V4 + VADDW V21, V5, V5 + VADDW V22, V6, V6 + VADDW V23, V7, V7 + VADDW V24, V8, V8 + VADDW V25, V9, V9 + VADDW V26, V10, V10 + VADDW V27, V11, V11 + VADDW V28, V12, V12 + VADDW V29, V13, V13 + VADDW V30, V14, V14 + VADDW V31, V15, V15 + + // shuffle + VILVLW V0, V1, V16 + VILVHW V0, V1, V17 + VILVLW V2, V3, V18 + VILVHW V2, V3, V19 + VILVLW V4, V5 ,V20 + VILVHW V4, V5, V21 + VILVLW V6, V7, V22 + VILVHW V6, V7, V23 + VILVLW V8, V9, V24 + VILVHW V8, V9, V25 + VILVLW V10, V11, V26 + VILVHW V10, V11, V27 + VILVLW V12, V13, V28 + VILVHW V12, V13, V29 + VILVLW V14, V15, V30 + VILVHW V14, V15, V31 + VILVLV V16, V18, V0 + VILVHV V16, V18, V4 + VILVLV V17, V19, V8 + VILVHV V17, V19, V12 + + // load src data from R5 + VMOVQ 0(R5), V16 + VMOVQ 16(R5), V17 + VMOVQ 32(R5), V18 + VMOVQ 48(R5), V19 + + VILVLV V20, V22, V1 + VILVHV V20, V22, V5 + VILVLV V21, V23, V9 + VILVHV V21, V23, V13 + + VMOVQ 64(R5), V20 + VMOVQ 80(R5), V21 + VMOVQ 96(R5), V22 + VMOVQ 112(R5), V23 + + VILVLV V24, V26, V2 + VILVHV V24, V26, V6 + VILVLV V25, V27, V10 + VILVHV V25, V27, V14 + + VMOVQ 128(R5), V24 + VMOVQ 144(R5), V25 + VMOVQ 160(R5), V26 + VMOVQ 176(R5), V27 + + VILVLV V28, V30, V3 + VILVHV V28, V30, V7 + VILVLV V29, V31, V11 + VILVHV V29, V31, V15 + + VMOVQ 192(R5), V28 + VMOVQ 208(R5), V29 + VMOVQ 224(R5), V30 + VMOVQ 240(R5), V31 + + VXORV V0, V16, V16 + VXORV V1, V17, V17 + VXORV V2, V18, V18 + VXORV V3, V19, V19 + + VMOVQ V16, 0(R4) + VMOVQ V17, 16(R4) + VMOVQ V18, 32(R4) + VMOVQ V19, 48(R4) + + VXORV V4, V20, V20 + VXORV V5, V21, V21 + VXORV V6, V22, V22 + VXORV V7, V23, V23 + + VMOVQ V20, 64(R4) + VMOVQ V21, 80(R4) + VMOVQ V22, 96(R4) + VMOVQ V23, 112(R4) + + VXORV V8, V24, V24 + VXORV V9, V25, V25 + VXORV V10, V26, V26 + VXORV V11, V27, V27 + + VMOVQ V24, 128(R4) + VMOVQ V25, 144(R4) + VMOVQ V26, 160(R4) + VMOVQ V27, 176(R4) + + VXORV V12, V28, V28 + VXORV V13, V29, V29 + VXORV V14, V30, V30 + VXORV V15, V31, V31 + + VMOVQ V28, 192(R4) + VMOVQ V29, 208(R4) + VMOVQ V30, 224(R4) + VMOVQ V31, 240(R4) + + ADD $4, R12, R12 + MOVW R12, (R9) // update counter + + ADDV $256, R4, R4 + ADDV $256, R5, R5 + SUBV $256, R6, R6 + BNE R6, R0, loop + + RET diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_noasm.go b/vendor/golang.org/x/crypto/chacha20/chacha_noasm.go index c709b72847..3853cc0e0b 100644 --- a/vendor/golang.org/x/crypto/chacha20/chacha_noasm.go +++ b/vendor/golang.org/x/crypto/chacha20/chacha_noasm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build (!arm64 && !s390x && !ppc64 && !ppc64le) || !gc || purego +//go:build (!arm64 && !loong64 && !s390x && !ppc64 && !ppc64le) || !gc || purego package chacha20 diff --git a/vendor/golang.org/x/crypto/ssh/agent/client.go b/vendor/golang.org/x/crypto/ssh/agent/client.go index eb96184e4c..fad53dcc4a 100644 --- a/vendor/golang.org/x/crypto/ssh/agent/client.go +++ b/vendor/golang.org/x/crypto/ssh/agent/client.go @@ -878,6 +878,9 @@ var certKeyAlgoNames = map[string]string{ ssh.CertAlgoSKECDSA256v01: ssh.KeyAlgoSKECDSA256, ssh.CertAlgoED25519v01: ssh.KeyAlgoED25519, ssh.CertAlgoSKED25519v01: ssh.KeyAlgoSKED25519, + ssh.CertAlgoMLDSA44v01Go: ssh.KeyAlgoMLDSA44, + ssh.CertAlgoMLDSA65v01Go: ssh.KeyAlgoMLDSA65, + ssh.CertAlgoMLDSA87v01Go: ssh.KeyAlgoMLDSA87, } // underlyingAlgo returns the signature algorithm associated with algo (which is diff --git a/vendor/golang.org/x/crypto/ssh/certs.go b/vendor/golang.org/x/crypto/ssh/certs.go index a3b802e4b8..8788a94b0e 100644 --- a/vendor/golang.org/x/crypto/ssh/certs.go +++ b/vendor/golang.org/x/crypto/ssh/certs.go @@ -35,6 +35,15 @@ const ( CertAlgoED25519v01 = "ssh-ed25519-cert-v01@openssh.com" CertAlgoSKED25519v01 = "sk-ssh-ed25519-cert-v01@openssh.com" + // CertAlgoMLDSA44v01Go, CertAlgoMLDSA65v01Go and CertAlgoMLDSA87v01Go + // are certificate algorithms based on ML-DSA. No specification defines + // them, so these are vendor names as per RFC 4251, Section 4.2. The + // format is that of [SSH-CERTS], with the public key encoded as in + // [SSH-MLDSA], Section 4. + CertAlgoMLDSA44v01Go = "ssh-mldsa-44-cert-v01@golang.org" + CertAlgoMLDSA65v01Go = "ssh-mldsa-65-cert-v01@golang.org" + CertAlgoMLDSA87v01Go = "ssh-mldsa-87-cert-v01@golang.org" + // CertAlgoRSASHA256v01 and CertAlgoRSASHA512v01 can't appear as a // Certificate.Type (or PublicKey.Type), but only in // ClientConfig.HostKeyAlgorithms. @@ -525,6 +534,9 @@ var certKeyAlgoNames = map[string]string{ CertAlgoSKECDSA256v01: KeyAlgoSKECDSA256, CertAlgoED25519v01: KeyAlgoED25519, CertAlgoSKED25519v01: KeyAlgoSKED25519, + CertAlgoMLDSA44v01Go: KeyAlgoMLDSA44, + CertAlgoMLDSA65v01Go: KeyAlgoMLDSA65, + CertAlgoMLDSA87v01Go: KeyAlgoMLDSA87, } // underlyingAlgo returns the signature algorithm associated with algo (which is diff --git a/vendor/golang.org/x/crypto/ssh/cipher.go b/vendor/golang.org/x/crypto/ssh/cipher.go index 48d0199545..d83cacfd37 100644 --- a/vendor/golang.org/x/crypto/ssh/cipher.go +++ b/vendor/golang.org/x/crypto/ssh/cipher.go @@ -414,10 +414,34 @@ func (c *gcmCipher) readCipherPacket(seqNum uint32, r io.Reader) ([]byte, error) return plain, nil } -// cbcCipher implements aes128-cbc cipher defined in RFC 4253 section 6.1 +// cbcCipher implements the CBC ciphers defined in RFC 4253 section 6.1, in +// MAC-then-encrypt mode and, for the *-etm@openssh.com MACs, in the +// encrypt-then-MAC mode defined in [PROTOCOL], section 1.5. +// +// 0 4 prefixLen macStart +// | | | | +// +---------------+----------------+---------+-----------------+-----------+ +// | packet_length | padding_length | payload | random padding | mac | +// +---------------+----------------+---------+-----------------+-----------+ +// |<--------- length = packet_length --------->|< macSize >| +// |< paddingLength >| +// |<-------------------------- entirePacketSize -------------------------->| +// +// MAC-then-encrypt (encStart = 0) +// |<----------------------- encLength ------------------------>| +// |<-------------- MAC'd (seqNum || plaintext) --------------->| +// +// encrypt-then-MAC (encStart = 4) +// |<--------------- encLength ---------------->| +// |<-------------- MAC'd (seqNum || ciphertext) -------------->| +// +// encLength is always a multiple of effectiveBlockSize, and in ETM mode the +// packet_length field is not part of it. The padding is only trustworthy once +// the MAC has been verified. type cbcCipher struct { mac hash.Hash macSize uint32 + etm bool decrypter cipher.BlockMode encrypter cipher.BlockMode @@ -431,16 +455,20 @@ type cbcCipher struct { oracleCamouflage uint32 } -func newCBCCipher(c cipher.Block, key, iv, macKey []byte, algs DirectionAlgorithms) (packetCipher, error) { +func newCBCCipher(c cipher.Block, _, iv, macKey []byte, algs DirectionAlgorithms) (packetCipher, error) { + macMode := macModes[algs.MAC] + if macMode == nil { + return nil, fmt.Errorf("ssh: unsupported MAC %v", algs.MAC) + } + mac := macMode.new(macKey) cbc := &cbcCipher{ - mac: macModes[algs.MAC].new(macKey), + mac: mac, + macSize: uint32(mac.Size()), + etm: macMode.etm, decrypter: cipher.NewCBCDecrypter(c, iv), encrypter: cipher.NewCBCEncrypter(c, iv), packetData: make([]byte, 1024), } - if cbc.mac != nil { - cbc.macSize = uint32(cbc.mac.Size()) - } return cbc, nil } @@ -473,13 +501,6 @@ func newTripleDESCBCCipher(key, iv, macKey []byte, algs DirectionAlgorithms) (pa return cbc, nil } -func maxUInt32(a, b int) uint32 { - if a > b { - return uint32(a) - } - return uint32(b) -} - const ( cbcMinPacketSizeMultiple = 8 cbcMinPacketSize = 16 @@ -493,25 +514,38 @@ func (e cbcError) Error() string { return string(e) } func (c *cbcCipher) readCipherPacket(seqNum uint32, r io.Reader) ([]byte, error) { p, err := c.readCipherPacketLeaky(seqNum, r) - if err != nil { - if _, ok := err.(cbcError); ok { - // Verification error: read a fixed amount of - // data, to make distinguishing between - // failing MAC and failing length check more - // difficult. - io.CopyN(io.Discard, r, int64(c.oracleCamouflage)) - } + if _, ok := err.(cbcError); ok { + // Verification error: read a fixed amount of + // data, to make distinguishing between + // failing MAC and failing length check more + // difficult. + io.CopyN(io.Discard, r, int64(c.oracleCamouflage)) } return p, err } func (c *cbcCipher) readCipherPacketLeaky(seqNum uint32, r io.Reader) ([]byte, error) { blockSize := c.decrypter.BlockSize() + // The encrypted portion of a packet is a multiple of the cipher block size + // or 8, whichever is larger. + effectiveBlockSize := uint32(max(cbcMinPacketSizeMultiple, blockSize)) + encStart := uint32(0) + // A packet is at least 16 bytes, or the cipher block size if larger. This does + // not apply to EtM (but the encrypted length still can't be zero). + minEncLength := uint32(max(cbcMinPacketSize, blockSize)) + // For EtM MACs the packet length is transmitted in the clear and is not part + // of the encrypted data, which starts after it. + if c.etm { + encStart = 4 + minEncLength = effectiveBlockSize + } // Read the header, which will include some of the subsequent data in the - // case of block ciphers - this is copied back to the payload later. - // How many bytes of payload/padding will be read with this first read. - firstBlockLength := uint32((prefixLen + blockSize - 1) / blockSize * blockSize) + // case of block ciphers - this is copied back to the payload later. The + // rounding up to the block size covers at least prefixLen bytes, so the + // padding length is always within firstBlock. + headerEncLength := prefixLen - encStart + firstBlockLength := encStart + (headerEncLength+uint32(blockSize)-1)/uint32(blockSize)*uint32(blockSize) firstBlock := c.packetData[:firstBlockLength] if _, err := io.ReadFull(r, firstBlock); err != nil { return nil, err @@ -519,30 +553,49 @@ func (c *cbcCipher) readCipherPacketLeaky(seqNum uint32, r io.Reader) ([]byte, e c.oracleCamouflage = maxPacket + 4 + c.macSize - firstBlockLength - c.decrypter.CryptBlocks(firstBlock, firstBlock) - length := binary.BigEndian.Uint32(firstBlock[:4]) + c.mac.Reset() + binary.BigEndian.PutUint32(c.seqNumBytes[:], seqNum) + c.mac.Write(c.seqNumBytes[:]) + + var length uint32 + if c.etm { + // For EtM MACs the MAC is computed over the cleartext packet length + // followed by the ciphertext, so it is updated before decrypting. + length = binary.BigEndian.Uint32(firstBlock[:encStart]) + c.mac.Write(firstBlock[:encStart]) + c.mac.Write(firstBlock[encStart:]) + c.decrypter.CryptBlocks(firstBlock[encStart:], firstBlock[encStart:]) + } else { + c.decrypter.CryptBlocks(firstBlock, firstBlock) + length = binary.BigEndian.Uint32(firstBlock[:4]) + } + if length > maxPacket { return nil, cbcError("ssh: packet too large") } - if length+4 < maxUInt32(cbcMinPacketSize, blockSize) { - // The minimum size of a packet is 16 (or the cipher block size, whichever - // is larger) bytes. + // Length of the encrypted portion of the packet, which includes the packet + // length field only for non-EtM MACs. + encLength := 4 + length - encStart + if encLength < minEncLength { return nil, cbcError("ssh: packet too small") } - // The length of the packet (including the length field but not the MAC) must - // be a multiple of the block size or 8, whichever is larger. - if (length+4)%maxUInt32(cbcMinPacketSizeMultiple, blockSize) != 0 { + if encLength%effectiveBlockSize != 0 { return nil, cbcError("ssh: invalid packet length multiple") } + // The padding length is part of the encrypted data. For EtM MACs it is not + // acted upon before the MAC is verified, otherwise the CBC padding would + // still be usable as an oracle, which is what EtM prevents. paddingLength := uint32(firstBlock[4]) - if paddingLength < cbcMinPaddingSize || length <= paddingLength+1 { - return nil, cbcError("ssh: invalid packet length") + if !c.etm { + if paddingLength < cbcMinPaddingSize || length <= paddingLength+1 { + return nil, cbcError("ssh: invalid packet length") + } } - // Positions within the c.packetData buffer: - macStart := 4 + length - paddingStart := macStart - paddingLength + // Positions within the c.packetData buffer: the MAC follows the encrypted + // data. + macStart := encStart + encLength // Entire packet size, starting before length, ending at end of mac. entirePacketSize := macStart + c.macSize @@ -564,42 +617,58 @@ func (c *cbcCipher) readCipherPacketLeaky(seqNum uint32, r io.Reader) ([]byte, e c.oracleCamouflage -= uint32(n) remainingCrypted := c.packetData[firstBlockLength:macStart] + if c.etm { + c.mac.Write(remainingCrypted) + } c.decrypter.CryptBlocks(remainingCrypted, remainingCrypted) - mac := c.packetData[macStart:] - if c.mac != nil { - c.mac.Reset() - binary.BigEndian.PutUint32(c.seqNumBytes[:], seqNum) - c.mac.Write(c.seqNumBytes[:]) + if !c.etm { c.mac.Write(c.packetData[:macStart]) - c.macResult = c.mac.Sum(c.macResult[:0]) - if subtle.ConstantTimeCompare(c.macResult, mac) != 1 { - return nil, cbcError("ssh: MAC failure") + } + c.macResult = c.mac.Sum(c.macResult[:0]) + if subtle.ConstantTimeCompare(c.macResult, c.packetData[macStart:]) != 1 { + return nil, cbcError("ssh: MAC failure") + } + + if c.etm { + if paddingLength < cbcMinPaddingSize || length <= paddingLength+1 { + return nil, cbcError("ssh: invalid packet length") } } - return c.packetData[prefixLen:paddingStart], nil + return c.packetData[prefixLen : macStart-paddingLength], nil } -func (c *cbcCipher) writeCipherPacket(seqNum uint32, w io.Writer, rand io.Reader, packet []byte) error { - effectiveBlockSize := maxUInt32(cbcMinPacketSizeMultiple, c.encrypter.BlockSize()) - - // Length of encrypted portion of the packet (header, payload, padding). - // Enforce minimum padding and packet size. - encLength := maxUInt32(prefixLen+len(packet)+cbcMinPaddingSize, cbcMinPacketSize) +func (c *cbcCipher) writeCipherPacket(seqNum uint32, w io.Writer, rand io.Reader, payload []byte) error { + blockSize := c.encrypter.BlockSize() + // The encrypted portion of a packet is a multiple of the cipher block size + // or 8, whichever is larger. + effectiveBlockSize := uint32(max(cbcMinPacketSizeMultiple, blockSize)) + // For EtM MACs the packet length is transmitted in the clear and is not part + // of the encrypted data, which starts after it. + encStart := uint32(0) + if c.etm { + encStart = 4 + } + // Length of the encrypted portion of the packet (header, payload, padding), + // enforcing the minimum padding and the minimum packet size of RFC 4253, + // Section 6: 16 bytes, or the cipher block size if larger, excluding the + // MAC. + encLength := uint32(max(prefixLen-int(encStart)+len(payload)+cbcMinPaddingSize, cbcMinPacketSize-int(encStart))) // Enforce block size. encLength = (encLength + effectiveBlockSize - 1) / effectiveBlockSize * effectiveBlockSize - - length := encLength - 4 - paddingLength := int(length) - (1 + len(packet)) + // The packet length field covers the whole packet except the field itself. + length := encStart + encLength - 4 + paddingLength := int(length) - (1 + len(payload)) // Overall buffer contains: header, payload, padding, mac. // Space for the MAC is reserved in the capacity but not the slice length. - bufferSize := encLength + c.macSize - if uint32(cap(c.packetData)) < bufferSize { - c.packetData = make([]byte, encLength, bufferSize) + macStart := encStart + encLength + entirePacketSize := macStart + c.macSize + if uint32(cap(c.packetData)) < entirePacketSize { + c.packetData = make([]byte, macStart, entirePacketSize) } else { - c.packetData = c.packetData[:encLength] + c.packetData = c.packetData[:macStart] } p := c.packetData @@ -611,24 +680,29 @@ func (c *cbcCipher) writeCipherPacket(seqNum uint32, w io.Writer, rand io.Reader // Payload. p = p[1:] - copy(p, packet) + copy(p, payload) // Padding. - p = p[len(packet):] + p = p[len(payload):] if _, err := io.ReadFull(rand, p); err != nil { return err } - if c.mac != nil { - c.mac.Reset() - binary.BigEndian.PutUint32(c.seqNumBytes[:], seqNum) - c.mac.Write(c.seqNumBytes[:]) + c.mac.Reset() + binary.BigEndian.PutUint32(c.seqNumBytes[:], seqNum) + c.mac.Write(c.seqNumBytes[:]) + if c.etm { + // For EtM MACs the MAC is computed over the cleartext packet length + // followed by the ciphertext. + c.mac.Write(c.packetData[:encStart]) + c.encrypter.CryptBlocks(c.packetData[encStart:], c.packetData[encStart:]) + c.mac.Write(c.packetData[encStart:]) + } else { c.mac.Write(c.packetData) - // The MAC is now appended into the capacity reserved for it earlier. - c.packetData = c.mac.Sum(c.packetData) + c.encrypter.CryptBlocks(c.packetData, c.packetData) } - - c.encrypter.CryptBlocks(c.packetData[:encLength], c.packetData[:encLength]) + // The MAC is now appended into the capacity reserved for it earlier. + c.packetData = c.mac.Sum(c.packetData) if _, err := w.Write(c.packetData); err != nil { return err diff --git a/vendor/golang.org/x/crypto/ssh/common.go b/vendor/golang.org/x/crypto/ssh/common.go index aed0fd926a..544eb93d78 100644 --- a/vendor/golang.org/x/crypto/ssh/common.go +++ b/vendor/golang.org/x/crypto/ssh/common.go @@ -258,6 +258,11 @@ type Algorithms struct { } func init() { + supportedHostKeyAlgos = slices.Concat(supportedHostKeyAlgos, mldsaCertAlgos, mldsaKeyAlgos) + defaultHostKeyAlgos = slices.Concat(defaultHostKeyAlgos, mldsaCertAlgos, mldsaKeyAlgos) + supportedPubKeyAuthAlgos = slices.Concat(supportedPubKeyAuthAlgos, mldsaKeyAlgos) + defaultPubKeyAuthAlgos = slices.Concat(defaultPubKeyAuthAlgos, mldsaKeyAlgos) + if fips140.Enabled() { defaultHostKeyAlgos = slices.DeleteFunc(defaultHostKeyAlgos, func(algo string) bool { _, err := hashFunc(underlyingAlgo(algo)) @@ -281,6 +286,10 @@ func hashFunc(format string) (crypto.Hash, error) { case KeyAlgoED25519: // KeyAlgoED25519 doesn't pre-hash. return 0, nil + case KeyAlgoMLDSA44, KeyAlgoMLDSA65, KeyAlgoMLDSA87: + // ML-DSA doesn't pre-hash. This case is not build tagged, availability + // is decided by mldsaKeyAlgos. + return 0, nil case KeyAlgoRSA, InsecureKeyAlgoDSA: if fips140.Enabled() { return 0, fmt.Errorf("ssh: hash algorithm for format %q not allowed in FIPS 140 mode", format) @@ -354,7 +363,13 @@ func keyFormatForAlgorithm(sigAlgo string) string { CertAlgoECDSA521v01, CertAlgoSKECDSA256v01, CertAlgoED25519v01, - CertAlgoSKED25519v01: + CertAlgoSKED25519v01, + KeyAlgoMLDSA44, + KeyAlgoMLDSA65, + KeyAlgoMLDSA87, + CertAlgoMLDSA44v01Go, + CertAlgoMLDSA65v01Go, + CertAlgoMLDSA87v01Go: return sigAlgo default: return "" diff --git a/vendor/golang.org/x/crypto/ssh/doc.go b/vendor/golang.org/x/crypto/ssh/doc.go index 5b4de9effc..39ac133e4d 100644 --- a/vendor/golang.org/x/crypto/ssh/doc.go +++ b/vendor/golang.org/x/crypto/ssh/doc.go @@ -17,6 +17,7 @@ References: [PROTOCOL.certkeys]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?rev=HEAD [SSH-PARAMETERS]: http://www.iana.org/assignments/ssh-parameters/ssh-parameters.xml#ssh-parameters-1 [SSH-CERTS]: https://datatracker.ietf.org/doc/html/draft-miller-ssh-cert-01 + [SSH-MLDSA]: https://datatracker.ietf.org/doc/html/draft-sfluhrer-ssh-mldsa-08 [FIPS 140-3 mode]: https://go.dev/doc/security/fips140 This package does not fall under the stability promise of the Go language itself, diff --git a/vendor/golang.org/x/crypto/ssh/keys.go b/vendor/golang.org/x/crypto/ssh/keys.go index fbbfb6cf42..eb052381c3 100644 --- a/vendor/golang.org/x/crypto/ssh/keys.go +++ b/vendor/golang.org/x/crypto/ssh/keys.go @@ -51,6 +51,12 @@ const ( KeyAlgoED25519 = "ssh-ed25519" KeyAlgoSKED25519 = "sk-ssh-ed25519@openssh.com" + // KeyAlgoMLDSA44, KeyAlgoMLDSA65 and KeyAlgoMLDSA87 are the ML-DSA + // algorithms of [SSH-MLDSA]. + KeyAlgoMLDSA44 = "ssh-mldsa-44" + KeyAlgoMLDSA65 = "ssh-mldsa-65" + KeyAlgoMLDSA87 = "ssh-mldsa-87" + // KeyAlgoRSASHA256 and KeyAlgoRSASHA512 are only public key algorithms, not // public key formats, so they can't appear as a PublicKey.Type. The // corresponding PublicKey.Type is KeyAlgoRSA. See RFC 8332, Section 2. @@ -83,7 +89,10 @@ func parsePubKey(in []byte, algo string) (pubKey PublicKey, rest []byte, err err return parseED25519(in) case KeyAlgoSKED25519: return parseSKEd25519(in) - case CertAlgoRSAv01, InsecureCertAlgoDSAv01, CertAlgoECDSA256v01, CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoSKECDSA256v01, CertAlgoED25519v01, CertAlgoSKED25519v01: + case KeyAlgoMLDSA44, KeyAlgoMLDSA65, KeyAlgoMLDSA87: + return parseMLDSA(in, algo) + case CertAlgoRSAv01, InsecureCertAlgoDSAv01, CertAlgoECDSA256v01, CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoSKECDSA256v01, CertAlgoED25519v01, CertAlgoSKED25519v01, + CertAlgoMLDSA44v01Go, CertAlgoMLDSA65v01Go, CertAlgoMLDSA87v01Go: cert, err := parseCert(in, certKeyAlgoNames[algo]) if err != nil { return nil, nil, err @@ -98,11 +107,30 @@ func parsePubKey(in []byte, algo string) (pubKey PublicKey, rest []byte, err err return nil, nil, fmt.Errorf("ssh: unknown key algorithm: %v", algo) } +// trimSpace removes leading and trailing ASCII space and tab. +func trimSpace(in []byte) []byte { + return bytes.Trim(in, " \t") +} + +// asciiFields splits in around each run of ASCII space and tab. +func asciiFields(in []byte) [][]byte { + return bytes.FieldsFunc(in, func(r rune) bool { + return r == ' ' || r == '\t' + }) +} + +// dropCR removes a single trailing carriage return, so that an entry written +// with CRLF line endings is read like one written with LF endings. A carriage +// return anywhere else belongs to the field that holds it. +func dropCR(in []byte) []byte { + return bytes.TrimSuffix(in, []byte("\r")) +} + // parseAuthorizedKey parses a public key in OpenSSH authorized_keys format // (see sshd(8) manual page) once the options and key type fields have been // removed. func parseAuthorizedKey(in []byte) (out PublicKey, comment string, err error) { - in = bytes.TrimSpace(in) + in = trimSpace(in) i := bytes.IndexAny(in, " \t") if i == -1 { @@ -120,7 +148,7 @@ func parseAuthorizedKey(in []byte) (out PublicKey, comment string, err error) { if err != nil { return nil, "", err } - comment = string(bytes.TrimSpace(in[i:])) + comment = string(trimSpace(in[i:])) return out, comment, nil } @@ -149,12 +177,9 @@ func ParseKnownHosts(in []byte) (marker string, hosts []string, pubKey PublicKey rest = nil } - end = bytes.IndexByte(in, '\r') - if end != -1 { - in = in[:end] - } + in = dropCR(in) - in = bytes.TrimSpace(in) + in = trimSpace(in) if len(in) == 0 || in[0] == '#' { in = rest continue @@ -168,8 +193,10 @@ func ParseKnownHosts(in []byte) (marker string, hosts []string, pubKey PublicKey // Strip out the beginning of the known_host key. // This is either an optional marker or a (set of) hostname(s). - keyFields := bytes.Fields(in) - if len(keyFields) < 3 || len(keyFields) > 5 { + // The comment is not delimited, so there is no upper bound on the + // number of fields. + keyFields := asciiFields(in) + if len(keyFields) < 3 { return "", nil, nil, "", nil, errors.New("ssh: invalid entry in known_hosts data") } @@ -215,12 +242,9 @@ func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []str rest = nil } - end = bytes.IndexByte(in, '\r') - if end != -1 { - in = in[:end] - } + in = dropCR(in) - in = bytes.TrimSpace(in) + in = trimSpace(in) if len(in) == 0 || in[0] == '#' { in = rest continue @@ -334,7 +358,8 @@ func MarshalAuthorizedKey(key PublicKey) []byte { } // MarshalPrivateKey returns a PEM block with the private key serialized in the -// OpenSSH format. +// OpenSSH format. ML-DSA keys are not supported, since no OpenSSH format is +// defined for them: use [x509.MarshalPKCS8PrivateKey] instead. func MarshalPrivateKey(key crypto.PrivateKey, comment string) (*pem.Block, error) { return marshalOpenSSHPrivateKey(key, comment, unencryptedOpenSSHMarshaler) } @@ -1173,9 +1198,9 @@ func (k *skEd25519PublicKey) CryptoPublicKey() crypto.PublicKey { } // NewSignerFromKey takes an *rsa.PrivateKey, *dsa.PrivateKey, -// *ecdsa.PrivateKey or any other crypto.Signer and returns a -// corresponding Signer instance. ECDSA keys must use P-256, P-384 or -// P-521. DSA keys must use parameter size L1024N160. +// *ecdsa.PrivateKey, *mldsa.PrivateKey, or any other crypto.Signer and returns +// a corresponding Signer instance. ECDSA keys must use P-256, P-384 or P-521. +// DSA keys must use parameter size L1024N160. func NewSignerFromKey(key interface{}) (Signer, error) { switch key := key.(type) { case crypto.Signer: @@ -1285,8 +1310,8 @@ func (s *wrappedSigner) SignWithAlgorithm(rand io.Reader, data []byte, algorithm } // NewPublicKey takes an *rsa.PublicKey, *dsa.PublicKey, *ecdsa.PublicKey, -// or ed25519.PublicKey returns a corresponding PublicKey instance. -// ECDSA keys must use P-256, P-384 or P-521. +// ed25519.PublicKey, or an *mldsa.PublicKey, and returns a corresponding +// PublicKey instance. ECDSA keys must use P-256, P-384 or P-521. func NewPublicKey(key interface{}) (PublicKey, error) { switch key := key.(type) { case *rsa.PublicKey: @@ -1304,7 +1329,13 @@ func NewPublicKey(key interface{}) (PublicKey, error) { } return ed25519PublicKey(key), nil default: - return nil, fmt.Errorf("ssh: unsupported key type %T", key) + pub, err := newMLDSAPublicKey(key) + if errors.Is(err, errNotMLDSAKey) { + return nil, fmt.Errorf("ssh: unsupported key type %T", key) + } else if err != nil { + return nil, err + } + return pub, nil } } diff --git a/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go b/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go index 017c696a42..40de878746 100644 --- a/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go +++ b/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go @@ -554,9 +554,7 @@ func (h *hashedHost) match(a addr) bool { return bytes.Equal(hashHost(Normalize(a.String()), h.salt), h.hash) } -// trimSpace removes leading and trailing ASCII whitespace (space and tab). It -// is used instead of bytes.TrimSpace to match OpenSSH behavior, which strictly -// parses only ASCII space (0x20) and tab (0x09) as whitespace. +// trimSpace removes leading and trailing ASCII space and tab. func trimSpace(in []byte) []byte { return bytes.Trim(in, " \t") } diff --git a/vendor/golang.org/x/crypto/ssh/mldsa.go b/vendor/golang.org/x/crypto/ssh/mldsa.go new file mode 100644 index 0000000000..09176b652d --- /dev/null +++ b/vendor/golang.org/x/crypto/ssh/mldsa.go @@ -0,0 +1,133 @@ +// Copyright 2026 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. + +//go:build go1.27 && !fips140v1.0 + +package ssh + +import ( + "crypto" + "crypto/mldsa" + "errors" + "fmt" +) + +// mldsaKeyAlgos are the ML-DSA public key algorithms implemented by this +// package. +var mldsaKeyAlgos = []string{ + KeyAlgoMLDSA44, + KeyAlgoMLDSA65, + KeyAlgoMLDSA87, +} + +// mldsaCertAlgos are the certificate algorithms for the keys in mldsaKeyAlgos. +var mldsaCertAlgos = []string{ + CertAlgoMLDSA44v01Go, + CertAlgoMLDSA65v01Go, + CertAlgoMLDSA87v01Go, +} + +var errNotMLDSAKey = errors.New("ssh: not an ML-DSA key") + +// mldsaParameters returns the ML-DSA parameter set for the given public key +// algorithm name. +func mldsaParameters(algo string) (mldsa.Parameters, error) { + switch algo { + case KeyAlgoMLDSA44: + return mldsa.MLDSA44(), nil + case KeyAlgoMLDSA65: + return mldsa.MLDSA65(), nil + case KeyAlgoMLDSA87: + return mldsa.MLDSA87(), nil + default: + return mldsa.Parameters{}, fmt.Errorf("ssh: not an ML-DSA algorithm: %q", algo) + } +} + +// mldsaKeyAlgo returns the public key algorithm name for the given ML-DSA +// parameter set. +func mldsaKeyAlgo(params mldsa.Parameters) string { + switch params { + case mldsa.MLDSA44(): + return KeyAlgoMLDSA44 + case mldsa.MLDSA65(): + return KeyAlgoMLDSA65 + case mldsa.MLDSA87(): + return KeyAlgoMLDSA87 + default: + panic("ssh: internal error: unknown ML-DSA parameter set: " + params.String()) + } +} + +// mldsaPublicKey implements PublicKey for the ML-DSA algorithms of [SSH-MLDSA]. +type mldsaPublicKey struct { + key *mldsa.PublicKey +} + +func (k *mldsaPublicKey) Type() string { + return mldsaKeyAlgo(k.key.Parameters()) +} + +func parseMLDSA(in []byte, algo string) (out PublicKey, rest []byte, err error) { + params, err := mldsaParameters(algo) + if err != nil { + return nil, nil, err + } + + var w struct { + KeyBytes []byte + Rest []byte `ssh:"rest"` + } + + if err := Unmarshal(in, &w); err != nil { + return nil, nil, err + } + + key, err := mldsa.NewPublicKey(params, w.KeyBytes) + if err != nil { + return nil, nil, fmt.Errorf("ssh: invalid %s public key: %v", params, err) + } + + return &mldsaPublicKey{key: key}, w.Rest, nil +} + +func (k *mldsaPublicKey) Marshal() []byte { + w := struct { + Name string + KeyBytes []byte + }{ + k.Type(), + k.key.Bytes(), + } + return Marshal(&w) +} + +func (k *mldsaPublicKey) Verify(b []byte, sig *Signature) error { + if sig.Format != k.Type() { + return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type()) + } + // nil options select pure ML-DSA with an empty context, as required by + // [SSH-MLDSA], Sections 6 and 8. + if err := mldsa.Verify(k.key, b, sig.Blob, nil); err != nil { + return errors.New("ssh: signature did not verify") + } + + return nil +} + +func (k *mldsaPublicKey) CryptoPublicKey() crypto.PublicKey { + return k.key +} + +// newMLDSAPublicKey returns a PublicKey wrapping key. +func newMLDSAPublicKey(key crypto.PublicKey) (PublicKey, error) { + k, ok := key.(*mldsa.PublicKey) + if !ok { + return nil, errNotMLDSAKey + } + if k == nil || *k == (mldsa.PublicKey{}) { + return nil, errors.New("ssh: invalid ML-DSA public key") + } + return &mldsaPublicKey{key: k}, nil +} diff --git a/vendor/golang.org/x/crypto/ssh/mldsa_unsupported.go b/vendor/golang.org/x/crypto/ssh/mldsa_unsupported.go new file mode 100644 index 0000000000..9fec354a8d --- /dev/null +++ b/vendor/golang.org/x/crypto/ssh/mldsa_unsupported.go @@ -0,0 +1,29 @@ +// Copyright 2026 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. + +//go:build !go1.27 || fips140v1.0 + +package ssh + +import ( + "crypto" + "errors" + "fmt" +) + +var mldsaKeyAlgos, mldsaCertAlgos []string + +var errMLDSAUnsupported = fmt.Errorf("ssh: ML-DSA is not available in this build: %w", + errors.ErrUnsupported) + +var errNotMLDSAKey = errors.New("ssh: not an ML-DSA key") + +func parseMLDSA(in []byte, algo string) (out PublicKey, rest []byte, err error) { + return nil, nil, errMLDSAUnsupported +} + +func newMLDSAPublicKey(key crypto.PublicKey) (PublicKey, error) { + // In this version of Go, *mldsa.PublicKey does not exist. + return nil, errNotMLDSAKey +} diff --git a/vendor/golang.org/x/sys/cpu/cpu.go b/vendor/golang.org/x/sys/cpu/cpu.go index df8dbd1dbf..422b139cdf 100644 --- a/vendor/golang.org/x/sys/cpu/cpu.go +++ b/vendor/golang.org/x/sys/cpu/cpu.go @@ -61,7 +61,11 @@ var X86 struct { HasBMI2 bool // Bit manipulation instruction set 2 HasCX16 bool // Compare and exchange 16 Bytes HasERMS bool // Enhanced REP for MOVSB and STOSB + HasF16C bool // 16-bit floating-point conversion instructions HasFMA bool // Fused-multiply-add instructions + HasLAHF bool // LAHF/SAHF available in 64-bit mode + HasLZCNT bool // Leading zeros count instruction + HasMOVBE bool // Move data after byte swap HasOSXSAVE bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers. HasPCLMULQDQ bool // PCLMULQDQ instruction - most often used for AES-GCM HasPOPCNT bool // Hamming weight instruction POPCNT. @@ -75,6 +79,7 @@ var X86 struct { HasAVXIFMA bool // Advanced vector extension Integer Fused Multiply Add HasAVXVNNI bool // Advanced vector extension Vector Neural Network Instructions HasAVXVNNIInt8 bool // Advanced vector extension Vector Neural Network Int8 instructions + HasXSAVE bool // XSAVE/XRSTOR/XSETBV/XGETBV instructions (hardware support; see also HasOSXSAVE) _ CacheLinePad } diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.go b/vendor/golang.org/x/sys/cpu/cpu_x86.go index f5723d4f7e..7e6cead53e 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_x86.go +++ b/vendor/golang.org/x/sys/cpu/cpu_x86.go @@ -43,7 +43,11 @@ func initOptions() { {Name: "bmi2", Feature: &X86.HasBMI2}, {Name: "cx16", Feature: &X86.HasCX16}, {Name: "erms", Feature: &X86.HasERMS}, + {Name: "f16c", Feature: &X86.HasF16C}, {Name: "fma", Feature: &X86.HasFMA}, + {Name: "lahf", Feature: &X86.HasLAHF}, + {Name: "lzcnt", Feature: &X86.HasLZCNT}, + {Name: "movbe", Feature: &X86.HasMOVBE}, {Name: "osxsave", Feature: &X86.HasOSXSAVE}, {Name: "pclmulqdq", Feature: &X86.HasPCLMULQDQ}, {Name: "popcnt", Feature: &X86.HasPOPCNT}, @@ -56,6 +60,7 @@ func initOptions() { {Name: "avxifma", Feature: &X86.HasAVXIFMA}, {Name: "avxvnni", Feature: &X86.HasAVXVNNI}, {Name: "avxvnniint8", Feature: &X86.HasAVXVNNIInt8}, + {Name: "xsave", Feature: &X86.HasXSAVE}, // These capabilities should always be enabled on amd64: {Name: "sse2", Feature: &X86.HasSSE2, Required: runtime.GOARCH == "amd64"}, @@ -83,10 +88,13 @@ func archInit() { cpuid_AVX512VPOPCNTDQ = 1 << 14 cpuid_SSE41 = 1 << 19 cpuid_SSE42 = 1 << 20 + cpuid_MOVBE = 1 << 22 cpuid_POPCNT = 1 << 23 cpuid_AES = 1 << 25 + cpuid_XSAVE = 1 << 26 cpuid_OSXSAVE = 1 << 27 cpuid_AVX = 1 << 28 + cpuid_F16C = 1 << 29 // "Extended Feature Flag" bits returned in EBX for CPUID EAX=0x7 ECX=0x0 cpuid_BMI1 = 1 << 3 @@ -110,6 +118,9 @@ func archInit() { // edx bits cpuid_FSRM = 1 << 4 + // ecx bits for CPUID 0x80000001 + cpuid_LAHF = 1 << 0 + cpuid_LZCNT = 1 << 5 // edx bits for CPUID 0x80000001 cpuid_RDTSCP = 1 << 27 ) @@ -158,9 +169,21 @@ func archInit() { X86.HasSSE42 = isSet(ecx1, cpuid_SSE42) X86.HasPOPCNT = isSet(ecx1, cpuid_POPCNT) X86.HasAES = isSet(ecx1, cpuid_AES) + X86.HasXSAVE = isSet(ecx1, cpuid_XSAVE) X86.HasOSXSAVE = isSet(ecx1, cpuid_OSXSAVE) + X86.HasF16C = isSet(ecx1, cpuid_F16C) + X86.HasMOVBE = isSet(ecx1, cpuid_MOVBE) X86.HasRDRAND = isSet(ecx1, cpuid_RDRAND) + // Extended processor info and feature bits, under the separate extended + // (0x8000_0000-prefixed) leaf hierarchy, so maxID (the basic leaf count) + // doesn't gate it. + if maxExtID, _, _, _ := cpuid(0x80000000, 0); maxExtID >= 0x80000001 { + _, _, ecxExt1, _ := cpuid(0x80000001, 0) + X86.HasLAHF = isSet(ecxExt1, cpuid_LAHF) + X86.HasLZCNT = isSet(ecxExt1, cpuid_LZCNT) + } + var osSupportsAVX, osSupportsAVX512 bool // For XGETBV, OSXSAVE bit is required and sufficient. if X86.HasOSXSAVE { diff --git a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s index bdfc024d2d..2e1f4c3e73 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s @@ -13,6 +13,16 @@ // Just jump to package syscall's implementation for all these functions. // The runtime may know about them. +TEXT ·Syscall(SB),NOSPLIT,$0-56 + MOVD $syscall·Syscall(SB), R31 + MOVD R31, CTR + JMP (CTR) + +TEXT ·Syscall6(SB),NOSPLIT,$0-80 + MOVD $syscall·Syscall6(SB), R31 + MOVD R31, CTR + JMP (CTR) + TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 BL runtime·entersyscall(SB) MOVD a1+8(FP), R3 @@ -28,6 +38,16 @@ TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 BL runtime·exitsyscall(SB) RET +TEXT ·RawSyscall(SB),NOSPLIT,$0-56 + MOVD $syscall·RawSyscall(SB), R31 + MOVD R31, CTR + JMP (CTR) + +TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 + MOVD $syscall·RawSyscall6(SB), R31 + MOVD R31, CTR + JMP (CTR) + TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 MOVD a1+8(FP), R3 MOVD a2+16(FP), R4 diff --git a/vendor/golang.org/x/sys/unix/asm_linux_sparc64.s b/vendor/golang.org/x/sys/unix/asm_linux_sparc64.s new file mode 100644 index 0000000000..77e1e327ed --- /dev/null +++ b/vendor/golang.org/x/sys/unix/asm_linux_sparc64.s @@ -0,0 +1,48 @@ +// Copyright 2026 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. + +//go:build linux && sparc64 && gc + +#include "textflag.h" + +// +// System calls for sparc64, Linux +// + +// Just jump to package syscall's implementation for all these functions. +// The runtime may know about them. + +TEXT ·Syscall(SB), NOSPLIT, $0-56 + JMP syscall·Syscall(SB) + +TEXT ·Syscall6(SB), NOSPLIT, $0-80 + JMP syscall·Syscall6(SB) + +TEXT ·SyscallNoError(SB), NOSPLIT, $0-48 + CALL runtime·entersyscall(SB) + MOVD trap+0(FP), R1 // syscall entry + MOVD a1+8(FP), R8 + MOVD a2+16(FP), R9 + MOVD a3+24(FP), R10 + TA $0x6d + MOVD R8, r1+32(FP) + MOVD R9, r2+40(FP) + CALL runtime·exitsyscall(SB) + RET + +TEXT ·RawSyscall(SB), NOSPLIT, $0-56 + JMP syscall·RawSyscall(SB) + +TEXT ·RawSyscall6(SB), NOSPLIT, $0-80 + JMP syscall·RawSyscall6(SB) + +TEXT ·RawSyscallNoError(SB), NOSPLIT, $0-48 + MOVD trap+0(FP), R1 // syscall entry + MOVD a1+8(FP), R8 + MOVD a2+16(FP), R9 + MOVD a3+24(FP), R10 + TA $0x6d + MOVD R8, r1+32(FP) + MOVD R9, r2+40(FP) + RET diff --git a/vendor/golang.org/x/sys/unix/asm_zos_s390x.s b/vendor/golang.org/x/sys/unix/asm_zos_s390x.s index 813dfad7d2..980f07a3b6 100644 --- a/vendor/golang.org/x/sys/unix/asm_zos_s390x.s +++ b/vendor/golang.org/x/sys/unix/asm_zos_s390x.s @@ -30,21 +30,8 @@ #define SVC_LOAD BYTE $0x0A; BYTE $0x08 // SVC 08 LOAD #define SVC_DELETE BYTE $0x0A; BYTE $0x09 // SVC 09 DELETE -DATA zosLibVec<>(SB)/8, $0 -GLOBL zosLibVec<>(SB), NOPTR, $8 - -TEXT ·initZosLibVec(SB), NOSPLIT|NOFRAME, $0-0 - MOVW PSALAA, R8 - MOVD LCA64(R8), R8 - MOVD CAA(R8), R8 - MOVD EDCHPXV(R8), R8 - MOVD R8, zosLibVec<>(SB) - RET - TEXT ·GetZosLibVec(SB), NOSPLIT|NOFRAME, $0-0 - MOVD zosLibVec<>(SB), R8 - MOVD R8, ret+0(FP) - RET + JMP runtime·GetZosLibVec(SB) TEXT ·clearErrno(SB), NOSPLIT, $0-0 BL addrerrno<>(SB) @@ -160,163 +147,13 @@ TEXT ·gettid(SB), NOSPLIT, $0 // errno and errno2 is retrieved // TEXT ·CallLeFuncWithErr(SB), NOSPLIT, $0 - MOVW PSALAA, R8 - MOVD LCA64(R8), R8 - MOVD CAA(R8), R9 - MOVD g, GOCB(R9) - - // Restore LE stack. - MOVD SAVSTACK_ASYNC(R8), R9 // R9-> LE stack frame saving address - MOVD 0(R9), R4 // R4-> restore previously saved stack frame pointer - - MOVD parms_base+8(FP), R7 // R7 -> argument array - MOVD parms_len+16(FP), R8 // R8 number of arguments - - // arg 1 ---> R1 - CMP R8, $0 - BEQ docall - SUB $1, R8 - MOVD 0(R7), R1 - - // arg 2 ---> R2 - CMP R8, $0 - BEQ docall - SUB $1, R8 - ADD $8, R7 - MOVD 0(R7), R2 - - // arg 3 --> R3 - CMP R8, $0 - BEQ docall - SUB $1, R8 - ADD $8, R7 - MOVD 0(R7), R3 - - CMP R8, $0 - BEQ docall - MOVD $2176+16, R6 // starting LE stack address-8 to store 4th argument - -repeat: - ADD $8, R7 - MOVD 0(R7), R0 // advance arg pointer by 8 byte - ADD $8, R6 // advance LE argument address by 8 byte - MOVD R0, (R4)(R6*1) // copy argument from go-slice to le-frame - SUB $1, R8 - CMP R8, $0 - BNE repeat - -docall: - MOVD funcdesc+0(FP), R8 // R8-> function descriptor - LMG 0(R8), R5, R6 - MOVD $0, 0(R9) // R9 address of SAVSTACK_ASYNC - LE_CALL // balr R7, R6 (return #1) - NOPH - MOVD R3, ret+32(FP) - CMP R3, $-1 // compare result to -1 - BNE done - - // retrieve errno and errno2 - MOVD zosLibVec<>(SB), R8 - ADD $(__errno), R8 - LMG 0(R8), R5, R6 - LE_CALL // balr R7, R6 __errno (return #3) - NOPH - MOVWZ 0(R3), R3 - MOVD R3, err+48(FP) - MOVD zosLibVec<>(SB), R8 - ADD $(__err2ad), R8 - LMG 0(R8), R5, R6 - LE_CALL // balr R7, R6 __err2ad (return #2) - NOPH - MOVW (R3), R2 // retrieve errno2 - MOVD R2, errno2+40(FP) // store in return area - -done: - MOVD R4, 0(R9) // Save stack pointer. - RET - + JMP runtime·CallLeFuncWithErr(SB) // // Call LE function, if the return is 0 // errno and errno2 is retrieved // TEXT ·CallLeFuncWithPtrReturn(SB), NOSPLIT, $0 - MOVW PSALAA, R8 - MOVD LCA64(R8), R8 - MOVD CAA(R8), R9 - MOVD g, GOCB(R9) - - // Restore LE stack. - MOVD SAVSTACK_ASYNC(R8), R9 // R9-> LE stack frame saving address - MOVD 0(R9), R4 // R4-> restore previously saved stack frame pointer - - MOVD parms_base+8(FP), R7 // R7 -> argument array - MOVD parms_len+16(FP), R8 // R8 number of arguments - - // arg 1 ---> R1 - CMP R8, $0 - BEQ docall - SUB $1, R8 - MOVD 0(R7), R1 - - // arg 2 ---> R2 - CMP R8, $0 - BEQ docall - SUB $1, R8 - ADD $8, R7 - MOVD 0(R7), R2 - - // arg 3 --> R3 - CMP R8, $0 - BEQ docall - SUB $1, R8 - ADD $8, R7 - MOVD 0(R7), R3 - - CMP R8, $0 - BEQ docall - MOVD $2176+16, R6 // starting LE stack address-8 to store 4th argument - -repeat: - ADD $8, R7 - MOVD 0(R7), R0 // advance arg pointer by 8 byte - ADD $8, R6 // advance LE argument address by 8 byte - MOVD R0, (R4)(R6*1) // copy argument from go-slice to le-frame - SUB $1, R8 - CMP R8, $0 - BNE repeat - -docall: - MOVD funcdesc+0(FP), R8 // R8-> function descriptor - LMG 0(R8), R5, R6 - MOVD $0, 0(R9) // R9 address of SAVSTACK_ASYNC - LE_CALL // balr R7, R6 (return #1) - NOPH - MOVD R3, ret+32(FP) - CMP R3, $0 // compare result to 0 - BNE done - - // retrieve errno and errno2 - MOVD zosLibVec<>(SB), R8 - ADD $(__errno), R8 - LMG 0(R8), R5, R6 - LE_CALL // balr R7, R6 __errno (return #3) - NOPH - MOVWZ 0(R3), R3 - MOVD R3, err+48(FP) - MOVD zosLibVec<>(SB), R8 - ADD $(__err2ad), R8 - LMG 0(R8), R5, R6 - LE_CALL // balr R7, R6 __err2ad (return #2) - NOPH - MOVW (R3), R2 // retrieve errno2 - MOVD R2, errno2+40(FP) // store in return area - XOR R2, R2 - MOVWZ R2, (R3) // clear errno2 - -done: - MOVD R4, 0(R9) // Save stack pointer. - RET - + JMP runtime·CallLeFuncWithPtrReturn(SB) // // function to test if a pointer can be safely dereferenced (content read) // return 0 for succces @@ -360,23 +197,4 @@ TEXT ·ptrtest(SB), NOSPLIT, $0-16 // // func safeload(ptr uintptr) ( value uintptr, error uintptr) TEXT ·safeload(SB), NOSPLIT, $0-24 - MOVD ptr+0(FP), R10 // test pointer in R10 - MOVD $0x0, R6 - BYTE $0xE3; BYTE $0x20; BYTE $0x04; BYTE $0xB8; BYTE $0x00; BYTE $0x17 // llgt 2,1208 - BYTE $0xB9; BYTE $0x17; BYTE $0x00; BYTE $0x22 // llgtr 2,2 - BYTE $0xA5; BYTE $0x26; BYTE $0x7F; BYTE $0xFF // nilh 2,32767 - BYTE $0xE3; BYTE $0x22; BYTE $0x00; BYTE $0x58; BYTE $0x00; BYTE $0x04 // lg 2,88(2) - BYTE $0xE3; BYTE $0x22; BYTE $0x00; BYTE $0x08; BYTE $0x00; BYTE $0x04 // lg 2,8(2) - BYTE $0x41; BYTE $0x22; BYTE $0x03; BYTE $0x68 // la 2,872(2) - BYTE $0xB9; BYTE $0x82; BYTE $0x00; BYTE $0x33 // xgr 3,3 - BYTE $0xA7; BYTE $0x55; BYTE $0x00; BYTE $0x04 // bras 5,lbl1 - BYTE $0xA7; BYTE $0x39; BYTE $0x00; BYTE $0x01 // lghi 3,1 - BYTE $0xB9; BYTE $0x02; BYTE $0x00; BYTE $0x33 // lbl1 ltgr 3,3 - BYTE $0xA7; BYTE $0x74; BYTE $0x00; BYTE $0x08 // brc b'0111',lbl2 - BYTE $0xE3; BYTE $0x52; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x24 // stg 5,0(2) - BYTE $0xE3; BYTE $0x6A; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x04 // lg 6,0(10) - BYTE $0xB9; BYTE $0x82; BYTE $0x00; BYTE $0x99 // lbl2 xgr 9,9 - BYTE $0xE3; BYTE $0x92; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x24 // stg 9,0(2) - MOVD R6, value+8(FP) // result in R6 - MOVD R3, error+16(FP) // error in R3 - RET + JMP runtime·ZosSafeLoad(SB) diff --git a/vendor/golang.org/x/sys/unix/bpxsvc_zos.s b/vendor/golang.org/x/sys/unix/bpxsvc_zos.s index 4bd4a17982..1236e1e903 100644 --- a/vendor/golang.org/x/sys/unix/bpxsvc_zos.s +++ b/vendor/golang.org/x/sys/unix/bpxsvc_zos.s @@ -20,15 +20,15 @@ TEXT ·bpxcall(SB), NOSPLIT|NOFRAME, $0 MOVD plist_base+0(FP), R1 // r1 points to plist MOVD bpx_offset+24(FP), R2 // r2 offset to BPX vector table MOVD R14, R7 // save r14 - MOVD R15, R8 // save r15 - MOVWZ 16(R0), R9 - MOVWZ 544(R9), R9 - MOVWZ 24(R9), R9 // call vector in r9 - ADD R2, R9 // add offset to vector table - MOVWZ (R9), R9 // r9 points to entry point - BYTE $0x0D // BL R14,R9 --> basr r14,r9 - BYTE $0xE9 // clobbers 0,1,14,15 - MOVD R8, R15 // restore 15 + MOVD R15, R9 // save r15 + MOVWZ 16(R0), R15 + MOVWZ 544(R15), R15 + MOVWZ 24(R15), R15 // call vector in r15 + ADD R2, R15 // add offset to vector table + MOVWZ (R15), R15 // r15 points to entry point + BYTE $0x0D // BL R14,R15 --> basr r14,r15 + BYTE $0xEF // clobbers 0,1,14,15 + MOVD R9, R15 // restore 15 JMP R7 // return via saved return address // func A2e(arr [] byte) diff --git a/vendor/golang.org/x/sys/unix/fcntl_darwin.go b/vendor/golang.org/x/sys/unix/fcntl_darwin.go index a9911c7c1d..78c28a3dc0 100644 --- a/vendor/golang.org/x/sys/unix/fcntl_darwin.go +++ b/vendor/golang.org/x/sys/unix/fcntl_darwin.go @@ -13,12 +13,12 @@ func FcntlInt(fd uintptr, cmd, arg int) (int, error) { // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { - _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk)))) + _, err := fcntlPtr(int(fd), cmd, unsafe.Pointer(lk)) return err } // FcntlFstore performs a fcntl syscall for the F_PREALLOCATE command. func FcntlFstore(fd uintptr, cmd int, fstore *Fstore_t) error { - _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(fstore)))) + _, err := fcntlPtr(int(fd), cmd, unsafe.Pointer(fstore)) return err } diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 9e907ac296..e95eecd53c 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -579,7 +579,7 @@ ccflags="$@" $2 ~ /^DIOC/ || $2 ~ /^RUSAGE_(SELF|CHILDREN|THREAD)/ || $2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ || - $2 ~ /^PRIO_(PROCESS|PGRP|USER)/ || + $2 ~ /^PRIO_(PROCESS|PGRP|USER|DARWIN_(THREAD|PROCESS|BG|NONUI))/ || $2 ~ /^CLONE_[A-Z_]+/ || $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+|BPF_F_LINK)$/ && $2 ~ /^(BPF|DLT)_/ || diff --git a/vendor/golang.org/x/sys/unix/ptrace_zos.go b/vendor/golang.org/x/sys/unix/ptrace_zos.go new file mode 100644 index 0000000000..394fbd71b2 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ptrace_zos.go @@ -0,0 +1,537 @@ +// Copyright 2026 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. + +//go:build zos + +package unix + +import "unsafe" + +// z/OS ptrace implementation notes: +// +// This file provides ptrace wrappers for z/OS that match the Linux API as closely +// as possible. However, there are fundamental differences in how z/OS implements +// process tracing compared to Linux: +// +// 1. SYSTEM CALL INTERFACE: +// - z/OS uses BPX4PTR (5 parameters) vs Linux ptrace syscall (4 parameters) +// - The 5th parameter (buffer) is used for block operations +// +// 2. MEMORY OPERATIONS: +// - z/OS: PT_READ_BLOCK/PT_WRITE_BLOCK for efficient block transfers +// - Linux: PTRACE_PEEKTEXT/POKETEXT for word-by-word access +// +// 3. REGISTER OPERATIONS: +// - z/OS: PT_READ_GPR/PT_WRITE_GPR with register number for 64-bit values +// - Linux: PTRACE_GETREGSET/SETREGSET with iovec structure +// +// 4. SINGLE-STEPPING: +// - z/OS: No native single-step; requires temporary breakpoints or PER +// - Linux: PTRACE_SINGLESTEP natively supported +// a) Read instruction at current PSW +// b) Calculate next instruction address (handle branches) +// c) Set temporary breakpoint (SVC 144 = 0x0A90) at next address +// d) Continue execution until breakpoint hit +// e) Restore original instruction and adjust PSW +// +// 5. SYSCALL TRACING: +// - z/OS: No PTRACE_SYSCALL equivalent; requires breakpoint-based approach +// - Linux: PTRACE_SYSCALL stops at syscall entry/exit +// a) Identify BPX syscall vector location +// b) Set breakpoints at syscall entry points +// c) Detect BASR instructions calling into syscall vector +// d) Parse arguments from registers before/after syscall +// +// 6. LIMITATIONS: +// - PtraceSetOptions: No equivalent (returns ENOSYS) +// - PtraceGetEventMsg: No equivalent (returns ENOSYS) +// - PtraceSingleStep: Requires complex implementation (returns ENOSYS) +// - PtraceInterrupt: No equivalent (returns ENOSYS) +// - PtracePokeUser: No PT_WRITE_U (returns ENOSYS) +// +// For reference implementations of single-stepping and syscall tracing on z/OS, + +// ptrace is the basic wrapper for BPX4PTR on z/OS. +// Note: z/OS ptrace (BPX4PTR) takes 5 parameters vs 4 on Linux/Darwin. +// The 5th parameter (buffer) is used for operations like PT_READ_BLOCK/PT_WRITE_BLOCK. +// +// data is an integer-valued argument (signal number, register index, byte count, +// or a target-process address). It is not a Go-managed pointer. We must not pass +// it to Bpx4ptr as unsafe.Pointer(data) because the garbage collector would treat +// that integer as a pointer and may crash trying to follow it. +// +// Instead we inline the parms array that Bpx4ptr would construct, placing &data +// at parms[3]. BPX4PTR dereferences parms[3] to obtain the data value, so it +// receives data unchanged while the GC only ever sees a valid stack pointer. +func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { + req32 := int32(request) + pid32 := int32(pid) + var rv, rc, rn int32 + var buffer unsafe.Pointer + parms := [8]unsafe.Pointer{ + unsafe.Pointer(&req32), + unsafe.Pointer(&pid32), + unsafe.Pointer(&addr), + unsafe.Pointer(&data), // &data, not unsafe.Pointer(data) + unsafe.Pointer(&buffer), + unsafe.Pointer(&rv), + unsafe.Pointer(&rc), + unsafe.Pointer(&rn), + } + bpxcall(parms[:], BPX4PTR) + if rv != 0 { + err = errnoErr2(Errno(rc), uintptr(rn)) + } + return +} + +// ptracePtr is a variant that accepts unsafe.Pointer for the data parameter. +// addr is a target-process address (a raw integer), not a Go-managed pointer. +// We must not pass it to Bpx4ptr as unsafe.Pointer(addr); instead we inline the +// parms array and place &addr at parms[2], exactly as ptrace() does for data. +func ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) { + req32 := int32(request) + pid32 := int32(pid) + var rv, rc, rn int32 + var buffer unsafe.Pointer + parms := [8]unsafe.Pointer{ + unsafe.Pointer(&req32), + unsafe.Pointer(&pid32), + unsafe.Pointer(&addr), // &addr, not unsafe.Pointer(addr) + unsafe.Pointer(&data), + unsafe.Pointer(&buffer), + unsafe.Pointer(&rv), + unsafe.Pointer(&rc), + unsafe.Pointer(&rn), + } + bpxcall(parms[:], BPX4PTR) + if rv != 0 { + err = errnoErr2(Errno(rc), uintptr(rn)) + } + return +} + +// ptracePtrWithBuffer is used for operations that require the buffer parameter. +// addr is a target-process address; same &addr treatment as ptracePtr. +func ptracePtrWithBuffer(request int, pid int, addr uintptr, data unsafe.Pointer, buffer unsafe.Pointer) (err error) { + req32 := int32(request) + pid32 := int32(pid) + var rv, rc, rn int32 + parms := [8]unsafe.Pointer{ + unsafe.Pointer(&req32), + unsafe.Pointer(&pid32), + unsafe.Pointer(&addr), // &addr, not unsafe.Pointer(addr) + unsafe.Pointer(&data), + unsafe.Pointer(&buffer), + unsafe.Pointer(&rv), + unsafe.Pointer(&rc), + unsafe.Pointer(&rn), + } + bpxcall(parms[:], BPX4PTR) + if rv != 0 { + err = errnoErr2(Errno(rc), uintptr(rn)) + } + return +} + +// High-level convenience functions matching the Linux/Darwin API + +func PtraceAttach(pid int) (err error) { + return ptrace(PT_ATTACH, pid, 0, 0) +} + +func PtraceDetach(pid int) (err error) { + return ptrace(PT_DETACH, pid, 0, 0) +} + +func PtraceCont(pid int, signal int) (err error) { + // PT_CONTINUE can be interrupted by signals (EINTR), retry if needed + for { + err = ptrace(PT_CONTINUE, pid, 0, uintptr(signal)) + if err != EINTR { + break + } + } + return err +} + +func PtraceKill(pid int) (err error) { + return ptrace(PT_KILL, pid, 0, 0) +} + +// ptracePeek implements the peek operations using PT_READ_BLOCK. +// On z/OS, PT_READ_BLOCK can read arbitrary-length data efficiently. +// Unlike Linux which reads word-by-word, z/OS can read blocks directly. +func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err error) { + if len(out) == 0 { + return 0, nil + } + + // z/OS PT_READ_BLOCK can read blocks directly without word-by-word alignment + // The buffer parameter points to the output buffer + buffer := unsafe.Pointer(&out[0]) + err = ptracePtrWithBuffer(req, pid, addr, unsafe.Pointer(uintptr(len(out))), buffer) + if err != nil { + return 0, err + } + return len(out), nil +} + +// PtracePeekText reads from the traced process's text segment. +func PtracePeekText(pid int, addr uintptr, out []byte) (count int, err error) { + return ptracePeek(PT_READ_BLOCK, pid, addr, out) +} + +// PtracePeekData reads from the traced process's data segment. +func PtracePeekData(pid int, addr uintptr, out []byte) (count int, err error) { + return ptracePeek(PT_READ_BLOCK, pid, addr, out) +} + +// PtracePeekUser reads from the traced process's user area. +// On z/OS, PT_READ_U reads a 32-bit word from the user area at the specified offset. +// To match Linux behavior, we implement word-by-word reading for arbitrary lengths. +func PtracePeekUser(pid int, addr uintptr, out []byte) (count int, err error) { + if len(out) == 0 { + return 0, nil + } + + // PT_READ_U reads 32-bit words from user area + // We need to read word-by-word to handle arbitrary lengths + n := 0 + for n < len(out) { + var data uint32 + err = ptracePtr(PT_READ_U, pid, addr+uintptr(n), unsafe.Pointer(&data)) + if err != nil { + return n, err + } + + // Copy up to 4 bytes to output + remaining := len(out) - n + if remaining >= 4 { + out[n] = byte(data >> 24) + out[n+1] = byte(data >> 16) + out[n+2] = byte(data >> 8) + out[n+3] = byte(data) + n += 4 + } else { + // Handle partial word at the end + for i := 0; i < remaining; i++ { + out[n+i] = byte(data >> (24 - i*8)) + } + n += remaining + } + } + return n, nil +} + +// ptracePoke implements the poke operations using PT_WRITE_BLOCK. +func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (count int, err error) { + if len(data) == 0 { + return 0, nil + } + + // z/OS PT_WRITE_BLOCK can write blocks directly + buffer := unsafe.Pointer(&data[0]) + err = ptracePtrWithBuffer(pokeReq, pid, addr, unsafe.Pointer(uintptr(len(data))), buffer) + if err != nil { + return 0, err + } + return len(data), nil +} + +// PtracePokeText writes to the traced process's text segment. +func PtracePokeText(pid int, addr uintptr, data []byte) (count int, err error) { + return ptracePoke(PT_WRITE_BLOCK, PT_READ_BLOCK, pid, addr, data) +} + +// PtracePokeData writes to the traced process's data segment. +func PtracePokeData(pid int, addr uintptr, data []byte) (count int, err error) { + return ptracePoke(PT_WRITE_BLOCK, PT_READ_BLOCK, pid, addr, data) +} + +// PtracePokeUser writes to the traced process's user area. +// Note: z/OS does not have a direct PT_WRITE_U equivalent. +// This function returns ENOSYS to indicate it's not supported. +// DIFFERENCE FROM LINUX: Linux supports PTRACE_POKEUSR, z/OS does not. +func PtracePokeUser(pid int, addr uintptr, data []byte) (count int, err error) { + // z/OS doesn't have PT_WRITE_U + return 0, ENOSYS +} + +// PtraceGetRegs retrieves the general purpose registers from the traced process. +// On z/OS, PT_READ_GPR can read individual registers as 64-bit values when called +// with a register number, or read all registers when called with a buffer. +// This function reads each register individually to ensure full 64-bit values. +// DIFFERENCE FROM LINUX: Linux uses PTRACE_GETREGSET with iovec, z/OS uses PT_READ_GPR. +func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) { + // Use PT_REGHSET to enable reading high GPRs for AMODE 64 programs + rv, rc, rn := Bpx4ptr(int32(PT_REGHSET), int32(pid), nil, nil, nil) + _ = rv + _ = rc + _ = rn + + // Use PT_BLOCKREQ to read GPRs and PSW in one call + // dbx uses 3 requests: PT_READ_GPR, PT_READ_U, PT_READ_GPRH + // PT_READ_U is required for ptrace to populate PSW in GPR block + // + // IMPORTANT: z/OS ptrace always returns 64-bit ESA/390 format PSW in the Psw field. + // The 128-bit Pswg field is never populated, even with PSWG_Req bit set. + // We convert ESA/390 to z/Architecture format in software (matching DBX behavior). + const ( + numRequests = 3 + reqSize = int(unsafe.Sizeof(PtraceBlkReqReq{})) + gprSize = int(unsafe.Sizeof(PtraceBlkGpr{})) + uareaSize = int(unsafe.Sizeof(PtraceBlkUar{})) + 6*int(unsafe.Sizeof(PtraceBlkUarOcw{})) + totalSize = int(unsafe.Sizeof(PtraceBlkReq{})) + numRequests*reqSize + gprSize*2 + uareaSize + ) + + // Allocate buffer for block request + buf := make([]byte, totalSize) + + // Setup block request header + blkReq := (*PtraceBlkReq)(unsafe.Pointer(&buf[0])) + blkReq.Numreq = numRequests + + // Setup request array + reqOffset := int(unsafe.Sizeof(PtraceBlkReq{})) + reqs := (*[3]PtraceBlkReqReq)(unsafe.Pointer(&buf[reqOffset])) + + // Setup GPR block (lower 32 bits) + gprOffset := reqOffset + numRequests*reqSize + gprBlock := (*PtraceBlkGpr)(unsafe.Pointer(&buf[gprOffset])) + + // Setup user area block (required for PSW) + uareaOffset := gprOffset + gprSize + uareaBlock := (*PtraceBlkUar)(unsafe.Pointer(&buf[uareaOffset])) + uareaBlock.Num = 6 // Number of control info entries + + // Setup user area offset/control words + uareaOcw := (*[6]PtraceBlkUarOcw)(unsafe.Pointer(&buf[uareaOffset+int(unsafe.Sizeof(PtraceBlkUar{}))])) + uareaOcw[0].Ofs = 1025 // program interrupt code + uareaOcw[1].Ofs = 1026 // abend completion code + uareaOcw[2].Ofs = 1027 // abend reason code + uareaOcw[3].Ofs = 1028 // signal code + uareaOcw[4].Ofs = 1029 // instruction length code + uareaOcw[5].Ofs = 1030 // process flags + + // Setup high GPR block (upper 32 bits) + gprHighOffset := uareaOffset + uareaSize + gprHighBlock := (*PtraceBlkGpr)(unsafe.Pointer(&buf[gprHighOffset])) + + // Configure requests (order matters: GPR, U, GPRH) + // reqdata contains OFFSET from buffer start, not absolute address + // dbx: brr[0].reqdata=(unsigned long)brg; where brg is the offset + reqs[0].Reqtype = PT_READ_GPR + reqs[0].Reqdata = uint32(gprOffset) + reqs[1].Reqtype = PT_READ_U + reqs[1].Reqdata = uint32(uareaOffset) + reqs[2].Reqtype = PT_READ_GPRH + reqs[2].Reqdata = uint32(gprHighOffset) + + // Execute block request + rvBlk, rcBlk, rnBlk := Bpx4ptr(int32(PT_BLOCKREQ), int32(pid), + unsafe.Pointer(&buf[0]), unsafe.Pointer(uintptr(totalSize)), nil) + if rvBlk == -1 { + return errnoErr2(Errno(rcBlk), uintptr(rnBlk)) + } + + // Extract GPRs (combine low and high 32 bits) + for i := 0; i < 16; i++ { + low := uint64(gprBlock.Gpr[i]) + high := uint64(gprHighBlock.Gpr[i]) << 32 + regsout.Gprs[i] = high | low + } + + // Extract PSW from GPR block structure + // z/OS ptrace ALWAYS returns 8-byte ESA/390 format PSW at offset 144. + // The 16-byte PSWG field at offset 152 is NEVER populated (always zero). + // We must convert ESA/390 format to z/Architecture format in software (like DBX does). + // + // ESA/390 PSW format (8 bytes): + // Word 1 (bytes 0-3): Mask with bit 12 = 1 (ECMODE31BIT) + // Word 2 (bytes 4-7): Address with bit 0 = AMODE bit (1=31-bit, 0=64-bit) + // + // z/Architecture PSW format (16 bytes): + // Mask (bytes 0-7): Extended mask with bit 12 = 0, bits 31-32 = EA+BA (AMODE) + // Addr (bytes 8-15): Full 64-bit instruction address + + // Read ESA/390 PSW as two 32-bit words + pswWord1 := uint32(gprBlock.Psw[0])<<24 | uint32(gprBlock.Psw[1])<<16 | + uint32(gprBlock.Psw[2])<<8 | uint32(gprBlock.Psw[3]) + pswWord2 := uint32(gprBlock.Psw[4])<<24 | uint32(gprBlock.Psw[5])<<16 | + uint32(gprBlock.Psw[6])<<8 | uint32(gprBlock.Psw[7]) + + // Convert ESA/390 to z/Architecture format (matching DBX psw_ESA390_to_zArchitecture) + const ECMODE31BIT = uint64(0x0000000000080000) + const AMODE31BIT = uint64(0x0000000080000000) + const ADDR_MASK_31 = uint64(0x000000007FFFFFFF) + + // Extract AMODE bit from address word (bit 0 of word 2) + amode31 := uint64(pswWord2) & AMODE31BIT + + // Mask off AMODE bit from address + addr := uint64(pswWord2) & ADDR_MASK_31 + + // Convert mask: clear ECMODE31BIT, shift left 32 bits, add AMODE bit + mask := uint64(pswWord1) & ^ECMODE31BIT + mask = (mask << 32) | amode31 + + regsout.Psw.Mask = mask + regsout.Psw.Addr = addr + + // Note: Access registers (Acrs), floating point registers (Fp_regs), + // PER info (Per_info), and other fields would require additional + // PT_READ_* calls. For now, we focus on GPRs and PSW which are + // the most commonly used registers for debugging. + + return nil +} + +// ptraceWritePSW writes only the PSW address register. +// This is a lower-level function used internally for single-stepping. +// Based on ztrace's write_psw function. +func ptraceWritePSW(pid int, pswAddr uint32) error { + const PTRACE_REG_PSWA = 41 + rv, rc, rn := Bpx4ptr(int32(PT_WRITE_GPR), int32(pid), + unsafe.Pointer(uintptr(PTRACE_REG_PSWA)), + unsafe.Pointer(uintptr(pswAddr)), + nil) + if rv == -1 { + return errnoErr2(Errno(rc), uintptr(rn)) + } + return nil +} + +// PtraceSetRegs sets the general purpose registers in the traced process. +// Uses PT_BLOCKREQ to write GPRs and PSW in a single call, matching dbx implementation. +// DIFFERENCE FROM LINUX: Linux uses PTRACE_SETREGSET with iovec, z/OS uses PT_BLOCKREQ. +// NOTE: The process must be in a stopped state for register writes to succeed. +func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) { + // Use PT_REGHSET to enable writing high GPRs for AMODE 64 programs + rv, rc, rn := Bpx4ptr(int32(PT_REGHSET), int32(pid), nil, nil, nil) + _ = rv + _ = rc + _ = rn + + // Use PT_BLOCKREQ to write GPRs and PSW in one call + const ( + numRequests = 2 + reqSize = int(unsafe.Sizeof(PtraceBlkReqReq{})) + gprSize = int(unsafe.Sizeof(PtraceBlkGpr{})) + totalSize = int(unsafe.Sizeof(PtraceBlkReq{})) + numRequests*reqSize + gprSize*2 + ) + + // Allocate buffer for block request + buf := make([]byte, totalSize) + + // Setup block request header + blkReq := (*PtraceBlkReq)(unsafe.Pointer(&buf[0])) + blkReq.Numreq = numRequests + + // Setup request array + reqOffset := int(unsafe.Sizeof(PtraceBlkReq{})) + reqs := (*[2]PtraceBlkReqReq)(unsafe.Pointer(&buf[reqOffset])) + + // Setup GPR block (lower 32 bits) + gprOffset := reqOffset + numRequests*reqSize + gprBlock := (*PtraceBlkGpr)(unsafe.Pointer(&buf[gprOffset])) + + // Setup high GPR block (upper 32 bits) + gprHighOffset := gprOffset + gprSize + gprHighBlock := (*PtraceBlkGpr)(unsafe.Pointer(&buf[gprHighOffset])) + + // Mark all GPRs as modified (set all 16 bits) + gprBlock.Writebitflags = 0xFFFF + gprHighBlock.Writebitflags = 0xFFFF + + // Split 64-bit GPRs into low and high 32 bits + for i := 0; i < 16; i++ { + gprBlock.Gpr[i] = uint32(regs.Gprs[i] & 0xFFFFFFFF) + gprHighBlock.Gpr[i] = uint32(regs.Gprs[i] >> 32) + } + + // Pack PSW for 31-bit targets (current z/OS) + // Upper 32 bits = mask, lower 32 bits = address + gprBlock.Wpsw = 1 // Mark PSW as modified + // Write PSW in old format (8 bytes at offset 144) + // Word 1 (mask) at bytes 0-3, Word 2 (addr) at bytes 4-7 + pswMask := uint32(regs.Psw.Mask) + pswAddr := uint32(regs.Psw.Addr) + gprBlock.Psw[0] = byte(pswMask >> 24) + gprBlock.Psw[1] = byte(pswMask >> 16) + gprBlock.Psw[2] = byte(pswMask >> 8) + gprBlock.Psw[3] = byte(pswMask) + gprBlock.Psw[4] = byte(pswAddr >> 24) + gprBlock.Psw[5] = byte(pswAddr >> 16) + gprBlock.Psw[6] = byte(pswAddr >> 8) + gprBlock.Psw[7] = byte(pswAddr) + + // Clear extended PSWG (not used for 31-bit targets) + for i := 0; i < 16; i++ { + gprBlock.Pswg[i] = 0 + } + + // Configure requests + // reqdata contains OFFSET from buffer start, not absolute address + reqs[0].Reqtype = PT_WRITE_GPR + reqs[0].Reqdata = uint32(gprOffset) + reqs[1].Reqtype = PT_WRITE_GPRH + reqs[1].Reqdata = uint32(gprHighOffset) + + // Execute block request + rvBlk, rcBlk, rnBlk := Bpx4ptr(int32(PT_BLOCKREQ), int32(pid), + unsafe.Pointer(&buf[0]), unsafe.Pointer(uintptr(totalSize)), nil) + if rvBlk == -1 { + return errnoErr2(Errno(rcBlk), uintptr(rnBlk)) + } + + return nil +} + +// PtraceSetOptions sets ptrace options. +// DIFFERENCE FROM LINUX: z/OS doesn't have PTRACE_SETOPTIONS equivalent. +// Returns ENOSYS to indicate this is not supported on z/OS. +func PtraceSetOptions(pid int, options int) (err error) { + return ENOSYS +} + +// PtraceGetEventMsg retrieves a message about the ptrace event. +// DIFFERENCE FROM LINUX: z/OS doesn't have PTRACE_GETEVENTMSG equivalent. +// Returns ENOSYS to indicate this is not supported on z/OS. +func PtraceGetEventMsg(pid int) (msg uint, err error) { + return 0, ENOSYS +} + +// PtraceSyscall continues execution and stops at the next syscall entry/exit. +// DIFFERENCE FROM LINUX: z/OS doesn't have PTRACE_SYSCALL equivalent. +// This function falls back to PT_CONTINUE and will NOT stop at syscalls. +// +// To trace syscalls on z/OS, applications must: +// 1. Set breakpoints at BPX syscall entry points (requires knowledge of syscall vector) +// 2. Detect BASR instructions that call into the BPX syscall vector +// 3. Use PT_LDINFO to identify loaded modules and their entry points +func PtraceSyscall(pid int, signal int) (err error) { + // z/OS doesn't have a direct PTRACE_SYSCALL equivalent + // Use PT_CONTINUE as a fallback (won't stop at syscalls) + return ptrace(PT_CONTINUE, pid, 0, uintptr(signal)) +} + +// Note: PtraceSingleStep is implemented in ptrace_zos_singlestep.go +// with full two-breakpoint emulation for branch instructions. + +// PtraceInterrupt interrupts the traced process. +// DIFFERENCE FROM LINUX: z/OS doesn't have PTRACE_INTERRUPT equivalent. +// Returns ENOSYS to indicate this is not supported on z/OS. +func PtraceInterrupt(pid int) (err error) { + return ENOSYS +} + +// PtraceSeize attaches to a process without stopping it. +// DIFFERENCE FROM LINUX: z/OS doesn't have PTRACE_SEIZE equivalent. +// Uses PT_ATTACH as a fallback, which will stop the process. +func PtraceSeize(pid int) (err error) { + // z/OS doesn't have PTRACE_SEIZE, use PT_ATTACH + // Note: This WILL stop the process, unlike Linux PTRACE_SEIZE + return ptrace(PT_ATTACH, pid, 0, 0) +} diff --git a/vendor/golang.org/x/sys/unix/ptrace_zos_singlestep.go b/vendor/golang.org/x/sys/unix/ptrace_zos_singlestep.go new file mode 100644 index 0000000000..7d7e2c8d30 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ptrace_zos_singlestep.go @@ -0,0 +1,425 @@ +// Copyright 2024 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. + +//go:build zos + +package unix + +import ( + "sync" +) + +// Single-stepping emulation for z/OS +// +// z/OS does not have native single-step support like Linux's PTRACE_SINGLESTEP. +// Instead, single-stepping must be emulated using temporary breakpoints. +// +// This file provides a complete implementation of single-step emulation using +// temporary breakpoints at both the sequential next instruction and branch target. + +const ( + // NO_BRANCH_DEST indicates the instruction is not a branch or cannot branch + NO_BRANCH_DEST = 0xFFFFFFFF + + // SVC_144 is the breakpoint instruction (SVC 144 = 0x0A90) + SVC_144 = 0x0A90 + + // Maximum number of temporary breakpoints (one for next PC, one for branch dest) + MAX_TEMP_BREAKPOINTS = 2 + + // S/390 branch instruction opcodes + // RR format (Register-Register) + opBCR = 0x07 // Branch on Condition Register + opBALR = 0x05 // Branch and Link Register + opBASR = 0x0D // Branch and Save Register + opBASSM = 0x0C // Branch and Save and Set Mode + opBSM = 0x0B // Branch and Set Mode + opBCTR = 0x06 // Branch on Count Register + + // RX format (Register-Index-Storage) + opBC = 0x47 // Branch on Condition + opBAL = 0x45 // Branch and Link + opBCT = 0x46 // Branch on Count + opBAS = 0x4D // Branch and Save + + // RS format (Register-Storage) + opBXH = 0x86 // Branch on Index High + opBXLE = 0x87 // Branch on Index Low or Equal + + // Extended branch opcodes + opBA7 = 0xA7 // A7x series (BRC, BRAS, BRCT, BRCTG) + opBC0 = 0xC0 // C0x series (BRASL, BRCL) + opBEC = 0xEC // ECxx series (RIEc format: compare-and-branch) +) + +// tempBreakpoint represents a temporary breakpoint for single-stepping +type tempBreakpoint struct { + address uint64 + originalInsn [8]byte // Save up to 8 bytes (full instruction) + active bool +} + +// singleStepState manages temporary breakpoints for a process +type singleStepState struct { + mu sync.Mutex + breakpoints [MAX_TEMP_BREAKPOINTS]tempBreakpoint +} + +var ( + // Global map of process states (pid -> state) + processStates = make(map[int]*singleStepState) + processStatesMu sync.Mutex +) + +// getProcessState returns or creates the single-step state for a process +func getProcessState(pid int) *singleStepState { + processStatesMu.Lock() + defer processStatesMu.Unlock() + + state, exists := processStates[pid] + if !exists { + state = &singleStepState{} + processStates[pid] = state + } + return state +} + +// cleanupProcessState removes the state for a process (call on detach) +func cleanupProcessState(pid int) { + processStatesMu.Lock() + defer processStatesMu.Unlock() + delete(processStates, pid) +} + +// GetInstructionLength returns the length of an S/390 instruction in bytes. +func GetInstructionLength(firstByte byte) int { + switch (firstByte >> 6) & 0x03 { + case 0x00: + return 2 + case 0x01, 0x02: + return 4 + case 0x03: + return 6 + default: + return 2 + } +} + +// GetNextInstructionAddr returns the address of the next sequential instruction. +func GetNextInstructionAddr(pc uint64, instruction []byte) uint64 { + if len(instruction) < 1 { + return pc + 2 + } + insnLen := GetInstructionLength(instruction[0]) + return pc + uint64(insnLen) +} + +// CalculateBranchDest calculates the destination address for branch instructions. +func CalculateBranchDest(pid int, pc uint64, instruction []byte) uint64 { + if len(instruction) < 6 { + return NO_BRANCH_DEST + } + + inst0_15 := uint16(instruction[0])<<8 | uint16(instruction[1]) + inst16_31 := uint16(instruction[2])<<8 | uint16(instruction[3]) + inst32_47 := uint16(instruction[4])<<8 | uint16(instruction[5]) + opcode := instruction[0] + + var dest uint64 = NO_BRANCH_DEST + + // RR format branches + if opcode == opBCR || opcode == opBALR || opcode == opBASR || + opcode == opBASSM || opcode == opBSM || opcode == opBCTR { + + r2 := int(inst0_15 & 0x0F) + + if opcode == opBCR { + mask := int((inst0_15 >> 4) & 0x0F) + if mask == 0 || r2 == 0 { + return NO_BRANCH_DEST + } + } else { + if r2 == 0 { + return NO_BRANCH_DEST + } + } + + var regs PtraceRegs + if err := PtraceGetRegs(pid, ®s); err == nil { + if r2 >= 0 && r2 < 16 { + regVal := regs.Gprs[r2] + dest = regVal + } + } + } else if opcode == opBC || opcode == opBAL || opcode == opBCT || opcode == opBAS { + // RX format branches + if opcode == opBC { + mask := int((inst0_15 >> 4) & 0x0F) + if mask == 0 { + return NO_BRANCH_DEST + } + } + + index := int(inst0_15 & 0x0F) + base := int((inst16_31 >> 12) & 0x0F) + displacement := uint32(inst16_31 & 0x0FFF) + + var baseVal, indexVal uint64 + var regs PtraceRegs + if err := PtraceGetRegs(pid, ®s); err == nil { + if base != 0 && base < 16 { + baseVal = regs.Gprs[base] + } + if index != 0 && index < 16 { + indexVal = regs.Gprs[index] + } + } + + if base == 0 && index == 0 { + dest = pc + uint64(displacement) + } else { + dest = baseVal + indexVal + uint64(displacement) + } + } else if opcode == opBXH || opcode == opBXLE { + // RS format branches + base := int((inst16_31 >> 12) & 0x0F) + displacement := uint32(inst16_31 & 0x0FFF) + + var baseVal uint64 + var regs PtraceRegs + if err := PtraceGetRegs(pid, ®s); err == nil { + if base != 0 && base < 16 { + baseVal = regs.Gprs[base] + } + } + + dest = baseVal + uint64(displacement) + } else if opcode == opBA7 { + // RI format branches + subOp := int(inst0_15 & 0x0F) + + if subOp < 4 || subOp > 7 { + return NO_BRANCH_DEST + } + + if subOp == 0x04 { + mask := int((inst0_15 >> 4) & 0x0F) + if mask == 0 { + return NO_BRANCH_DEST + } + } + + relDispl := int16(inst16_31) + dest = uint64(int64(pc) + int64(relDispl)*2) + } else if opcode == opBC0 { + // RIL format branches + subOp := int(inst0_15 & 0x0F) + + if subOp == 0x04 || subOp == 0x05 { + if subOp == 0x04 { + mask := int((inst0_15 >> 4) & 0x0F) + if mask == 0 { + return NO_BRANCH_DEST + } + } + + inst16_47 := (uint32(inst16_31) << 16) | uint32(inst32_47) + relDispl4 := int32(inst16_47) + dest = uint64(int64(pc) + int64(relDispl4)*2) + } + } else if opcode == opBEC { + // RIEc format compare-and-branch + subOp := instruction[4] + + isCompareBranch := (subOp >= 0x64 && subOp <= 0x67) || + (subOp >= 0x76 && subOp <= 0x77) || + (subOp >= 0x7C && subOp <= 0x7F) + + if isCompareBranch { + ri4 := int16(inst16_31) + dest = uint64(int64(pc) + int64(ri4)*2) + } + } + + if dest < 0x2000 { + return NO_BRANCH_DEST + } + + return dest +} + +// setTempBreakpoint sets a temporary breakpoint at the specified address +func (s *singleStepState) setTempBreakpoint(pid int, addr uint64) error { + s.mu.Lock() + defer s.mu.Unlock() + + // Find free slot + slot := -1 + for i := 0; i < MAX_TEMP_BREAKPOINTS; i++ { + if !s.breakpoints[i].active { + slot = i + break + } + } + + if slot == -1 { + return ENOMEM // All slots in use + } + + // Read original instruction (up to 8 bytes for safety) + _, err := PtracePeekText(pid, uintptr(addr), s.breakpoints[slot].originalInsn[:]) + if err != nil { + return err + } + + // Write SVC 144 (0x0A90) as breakpoint + svc144 := []byte{0x0A, 0x90} + _, err = PtracePokeText(pid, uintptr(addr), svc144) + if err != nil { + return err + } + + s.breakpoints[slot].address = addr + s.breakpoints[slot].active = true + + return nil +} + +// removeTempBreakpoints removes all active temporary breakpoints +func (s *singleStepState) removeTempBreakpoints(pid int) error { + s.mu.Lock() + defer s.mu.Unlock() + + var lastErr error + for i := 0; i < MAX_TEMP_BREAKPOINTS; i++ { + if !s.breakpoints[i].active { + continue + } + + // Restore original instruction (first 2 bytes are enough for SVC 144) + _, err := PtracePokeText(pid, uintptr(s.breakpoints[i].address), s.breakpoints[i].originalInsn[:2]) + if err != nil { + lastErr = err + } + + s.breakpoints[i].active = false + } + + return lastErr +} + +// isTempBreakpoint checks if an address is a temporary breakpoint +func (s *singleStepState) isTempBreakpoint(addr uint64) bool { + s.mu.Lock() + defer s.mu.Unlock() + + for i := 0; i < MAX_TEMP_BREAKPOINTS; i++ { + if s.breakpoints[i].active && s.breakpoints[i].address == addr { + return true + } + } + return false +} + +// PtraceSingleStep executes a single instruction using temporary breakpoints. +// +// This function: +// 1. Reads the current instruction at PSW +// 2. Calculates the next instruction address (sequential) +// 3. If branch instruction, calculates branch destination +// 4. Sets temporary breakpoints at both addresses +// 5. Continues execution until breakpoint hit +// 6. Restores original instructions and adjusts PSW +// +// Returns nil on success, error on failure. +func PtraceSingleStep(pid int) error { + state := getProcessState(pid) + + // 1. Get current PSW + var regs PtraceRegs + if err := PtraceGetRegs(pid, ®s); err != nil { + return err + } + pc := regs.Psw.Addr + + // 2. Read instruction at PC + insn := make([]byte, 8) + if _, err := PtracePeekText(pid, uintptr(pc), insn); err != nil { + return err + } + + // 3. Calculate next instruction addresses + nextPC := GetNextInstructionAddr(pc, insn) + branchDest := CalculateBranchDest(pid, pc, insn) + + // 4. Set temporary breakpoints + if err := state.setTempBreakpoint(pid, nextPC); err != nil { + return err + } + + // If branch instruction, set breakpoint at branch destination too + if branchDest != NO_BRANCH_DEST && branchDest != nextPC { + if err := state.setTempBreakpoint(pid, branchDest); err != nil { + state.removeTempBreakpoints(pid) // Cleanup first breakpoint + return err + } + } + + // 5. Continue execution + if err := PtraceCont(pid, 0); err != nil { + state.removeTempBreakpoints(pid) + return err + } + + // 6. Wait for breakpoint hit (retry on EINTR) + var status WaitStatus + for { + _, err := Wait4(pid, &status, 0, nil) + if err == EINTR { + continue // Retry on interrupted system call + } + if err != nil { + state.removeTempBreakpoints(pid) + return err + } + break + } + + // Check if process stopped (should be at breakpoint) + if !status.Stopped() { + state.removeTempBreakpoints(pid) + return ECHILD // Process exited or error + } + + // 7. Get current PSW (should be at breakpoint + 2) + if err := PtraceGetRegs(pid, ®s); err != nil { + state.removeTempBreakpoints(pid) + return err + } + + // 8. Remove temporary breakpoints + if err := state.removeTempBreakpoints(pid); err != nil { + return err + } + + // 9. Back up PSW by 2 bytes (to point at original instruction, not SVC 144) + // Use direct PSW write like ztrace does, not full register set + hitAddr := regs.Psw.Addr + if state.isTempBreakpoint(hitAddr - 2) { + if err := ptraceWritePSW(pid, uint32(hitAddr-2)); err != nil { + return err + } + } + + return nil +} + +// PtraceDetachWithCleanup detaches from a process and cleans up single-step state. +// Use this instead of PtraceDetach when using PtraceSingleStep. +func PtraceDetachWithCleanup(pid int) error { + state := getProcessState(pid) + state.removeTempBreakpoints(pid) + cleanupProcessState(pid) + return PtraceDetach(pid) +} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 38590ca81d..cb9d0a181c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -369,6 +369,7 @@ func Flistxattr(fd int, dest []byte) (sz int, err error) { */ //sys fcntl(fd int, cmd int, arg int) (val int, err error) +//sys fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) = SYS_FCNTL //sys kill(pid int, signum int, posix int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go index 2b57e0f73b..495188996d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -369,6 +369,15 @@ func Dup3(oldfd, newfd, flags int) error { //sys ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) //sys ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error) //sys ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) +//sys extattrGetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrSetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrListFd(fd int, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrGetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrSetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrListFile(file string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrGetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrSetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrListLink(link string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_POSIX_FADVISE //sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error) //sys Fchdir(fd int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 6926057e9e..a31e2c71ad 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -1991,7 +1991,24 @@ func FsconfigReconfigure(fd int) (err error) { return fsconfig(fd, FSCONFIG_CMD_RECONFIGURE, nil, nil, 0) } -//sys Getdents(fd int, buf []byte) (n int, err error) = SYS_GETDENTS64 +//sys getdents(fd int, buf []byte) (n int, err error) = SYS_GETDENTS64 + +// Getdents reads directory entries from fd into buf. +func Getdents(fd int, buf []byte) (n int, err error) { + // getdents64 stores d_ino with a 64-bit write, which faults on + // strict-alignment targets unless buf is 8-aligned. + if len(buf) > 0 { + if off := int(-uintptr(unsafe.Pointer(&buf[0])) & 7); off > 0 && off < len(buf) { + n, err = getdents(fd, buf[off:]) + if n > 0 { + copy(buf, buf[off:off+n]) + } + return n, err + } + } + return getdents(fd, buf) +} + //sysnb Getpgid(pid int) (pgid int, err error) func Getpgrp() (pid int) { @@ -2033,6 +2050,7 @@ func Getrandom(buf []byte, flags int) (n int, err error) { //sysnb Kill(pid int, sig syscall.Signal) (err error) //sys Klogctl(typ int, buf []byte) (n int, err error) = SYS_SYSLOG //sys Lgetxattr(path string, attr string, dest []byte) (sz int, err error) +//sys Listns(req *NsIdReq, nsIds []uint64, flags uint) (n int, err error) //sys Listxattr(path string, dest []byte) (sz int, err error) //sys Llistxattr(path string, dest []byte) (sz int, err error) //sys Lremovexattr(path string, attr string) (err error) @@ -2046,6 +2064,7 @@ func Getrandom(buf []byte, flags int) (n int, err error) { //sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) //sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT //sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) +//sys PrctlArg5Ptr(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 unsafe.Pointer) (err error) = SYS_PRCTL //sys pselect6(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *sigset_argpack) (n int, err error) //sys read(fd int, p []byte) (n int, err error) //sys Removexattr(path string, attr string) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go index 4964119af8..cd50715c9d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go @@ -8,7 +8,7 @@ package unix //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) -//sys Fstat(fd int, stat *Stat_t) (err error) +//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 //sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 //sys Fstatfs(fd int, buf *Statfs_t) (err error) //sys Ftruncate(fd int, length int64) (err error) @@ -19,7 +19,7 @@ package unix //sysnb Getuid() (uid int) //sys Lchown(path string, uid int, gid int) (err error) //sys Listen(s int, n int) (err error) -//sys Lstat(path string, stat *Stat_t) (err error) +//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 //sys Pause() (err error) //sys pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 @@ -31,7 +31,7 @@ package unix //sys setfsuid(uid int) (prev int, err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) -//sys Stat(path string, stat *Stat_t) (err error) +//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 //sys Statfs(path string, buf *Statfs_t) (err error) //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) //sys Truncate(path string, length int64) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go index 34a4676973..c8badc54c6 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -293,6 +293,15 @@ func Getvfsstat(buf []Statvfs_t, flags int) (n int, err error) { //sys ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) //sys ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error) //sys ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) +//sys extattrGetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrSetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrListFd(fd int, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrGetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrSetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrListFile(file string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrGetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrSetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) +//sys extattrListLink(link string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) //sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_POSIX_FADVISE //sys Fchdir(fd int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go index 05c95bccfa..60c0d16cff 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build (darwin || dragonfly || freebsd || (linux && !ppc64 && !ppc64le) || netbsd || openbsd || solaris) && gc +//go:build (darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && gc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go deleted file mode 100644 index 23f39b7af7..0000000000 --- a/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 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. - -//go:build linux && (ppc64le || ppc64) && gc - -package unix - -import "syscall" - -func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { - return syscall.Syscall(trap, a1, a2, a3) -} -func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { - return syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6) -} -func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { - return syscall.RawSyscall(trap, a1, a2, a3) -} -func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { - return syscall.RawSyscall6(trap, a1, a2, a3, a4, a5, a6) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go index 7bf5c04bb0..edabb6892a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go @@ -27,14 +27,10 @@ import ( "unsafe" ) -//go:noescape -func initZosLibVec() - //go:noescape func GetZosLibVec() uintptr func init() { - initZosLibVec() r0, _, _ := CallLeFuncWithPtrReturn(GetZosLibVec()+SYS_____GETENV_A<<4, uintptr(unsafe.Pointer(&([]byte("__ZOS_XSYSTRACE\x00"))[0]))) if r0 != 0 { n, _, _ := CallLeFuncWithPtrReturn(GetZosLibVec()+SYS___ATOI_A<<4, r0) diff --git a/vendor/golang.org/x/sys/unix/xattr_bsd.go b/vendor/golang.org/x/sys/unix/xattr_bsd.go index e168793961..d3d12c27c1 100644 --- a/vendor/golang.org/x/sys/unix/xattr_bsd.go +++ b/vendor/golang.org/x/sys/unix/xattr_bsd.go @@ -56,7 +56,7 @@ func Getxattr(file string, attr string, dest []byte) (sz int, err error) { return -1, err } - return ExtattrGetFile(file, nsid, a, uintptr(d), destsize) + return extattrGetFile(file, nsid, a, d, destsize) } func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { @@ -68,7 +68,7 @@ func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { return -1, err } - return ExtattrGetFd(fd, nsid, a, uintptr(d), destsize) + return extattrGetFd(fd, nsid, a, d, destsize) } func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) { @@ -80,7 +80,7 @@ func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) { return -1, err } - return ExtattrGetLink(link, nsid, a, uintptr(d), destsize) + return extattrGetLink(link, nsid, a, d, destsize) } // flags are unused on FreeBSD @@ -97,7 +97,7 @@ func Fsetxattr(fd int, attr string, data []byte, flags int) (err error) { return } - _, err = ExtattrSetFd(fd, nsid, a, uintptr(d), datasiz) + _, err = extattrSetFd(fd, nsid, a, d, datasiz) return } @@ -113,7 +113,7 @@ func Setxattr(file string, attr string, data []byte, flags int) (err error) { return } - _, err = ExtattrSetFile(file, nsid, a, uintptr(d), datasiz) + _, err = extattrSetFile(file, nsid, a, d, datasiz) return } @@ -129,7 +129,7 @@ func Lsetxattr(link string, attr string, data []byte, flags int) (err error) { return } - _, err = ExtattrSetLink(link, nsid, a, uintptr(d), datasiz) + _, err = extattrSetLink(link, nsid, a, d, datasiz) return } @@ -199,9 +199,9 @@ func ListxattrNS(file string, nsid int, dest []byte) (sz int, err error) { d := initxattrdest(dest, 0) destsiz := len(dest) - s, e := ExtattrListFile(file, nsid, uintptr(d), destsiz) + s, e := extattrListFile(file, nsid, d, destsiz) if e != nil { - return 0, err + return 0, e } return s, nil @@ -235,9 +235,9 @@ func FlistxattrNS(fd int, nsid int, dest []byte) (sz int, err error) { d := initxattrdest(dest, 0) destsiz := len(dest) - s, e := ExtattrListFd(fd, nsid, uintptr(d), destsiz) + s, e := extattrListFd(fd, nsid, d, destsiz) if e != nil { - return 0, err + return 0, e } return s, nil @@ -271,9 +271,9 @@ func LlistxattrNS(link string, nsid int, dest []byte) (sz int, err error) { d := initxattrdest(dest, 0) destsiz := len(dest) - s, e := ExtattrListLink(link, nsid, uintptr(d), destsiz) + s, e := extattrListLink(link, nsid, d, destsiz) if e != nil { - return 0, err + return 0, e } return s, nil diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index d73c4652e6..01a3953320 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -1128,6 +1128,7 @@ const ( O_DSYNC = 0x400000 O_EVTONLY = 0x8000 O_EXCL = 0x800 + O_EXEC = 0x40000000 O_EXLOCK = 0x20 O_FSYNC = 0x80 O_NDELAY = 0x4 @@ -1138,6 +1139,7 @@ const ( O_POPUP = 0x80000000 O_RDONLY = 0x0 O_RDWR = 0x2 + O_SEARCH = 0x40100000 O_SHLOCK = 0x10 O_SYMLINK = 0x200000 O_SYNC = 0x80 @@ -1147,6 +1149,10 @@ const ( PARMRK = 0x8 PARODD = 0x2000 PENDIN = 0x20000000 + PRIO_DARWIN_BG = 0x1000 + PRIO_DARWIN_NONUI = 0x1001 + PRIO_DARWIN_PROCESS = 0x4 + PRIO_DARWIN_THREAD = 0x3 PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index 4a55a40058..d80b95f6bf 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -1128,6 +1128,7 @@ const ( O_DSYNC = 0x400000 O_EVTONLY = 0x8000 O_EXCL = 0x800 + O_EXEC = 0x40000000 O_EXLOCK = 0x20 O_FSYNC = 0x80 O_NDELAY = 0x4 @@ -1138,6 +1139,7 @@ const ( O_POPUP = 0x80000000 O_RDONLY = 0x0 O_RDWR = 0x2 + O_SEARCH = 0x40100000 O_SHLOCK = 0x10 O_SYMLINK = 0x200000 O_SYNC = 0x80 @@ -1147,6 +1149,10 @@ const ( PARMRK = 0x8 PARODD = 0x2000 PENDIN = 0x20000000 + PRIO_DARWIN_BG = 0x1000 + PRIO_DARWIN_NONUI = 0x1001 + PRIO_DARWIN_PROCESS = 0x4 + PRIO_DARWIN_THREAD = 0x3 PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index 45feb12453..aa68cb8d00 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -752,10 +752,12 @@ const ( CLONE_ARGS_SIZE_VER0 = 0x40 CLONE_ARGS_SIZE_VER1 = 0x50 CLONE_ARGS_SIZE_VER2 = 0x58 + CLONE_AUTOREAP = 0x400000000 CLONE_CHILD_CLEARTID = 0x200000 CLONE_CHILD_SETTID = 0x1000000 CLONE_CLEAR_SIGHAND = 0x100000000 CLONE_DETACHED = 0x400000 + CLONE_EMPTY_MNTNS = 0x2000000000 CLONE_FILES = 0x400 CLONE_FS = 0x200 CLONE_INTO_CGROUP = 0x200000000 @@ -768,9 +770,11 @@ const ( CLONE_NEWTIME = 0x80 CLONE_NEWUSER = 0x10000000 CLONE_NEWUTS = 0x4000000 + CLONE_NNP = 0x800000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 CLONE_PIDFD = 0x1000 + CLONE_PIDFD_AUTOKILL = 0x1000000000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -803,12 +807,15 @@ const ( DEVLINK_GENL_MCGRP_CONFIG_NAME = "config" DEVLINK_GENL_NAME = "devlink" DEVLINK_GENL_VERSION = 0x1 + DEVLINK_INDEX_BUS_NAME = "devlink_index" DEVLINK_PORT_FN_CAP_IPSEC_CRYPTO = 0x4 DEVLINK_PORT_FN_CAP_IPSEC_PACKET = 0x8 DEVLINK_PORT_FN_CAP_MIGRATABLE = 0x2 DEVLINK_PORT_FN_CAP_ROCE = 0x1 DEVLINK_RATE_TCS_MAX = 0x8 DEVLINK_RATE_TC_INDEX_MAX = 0x7 + DEVLINK_RESOURCE_SCOPE_DEV = 0x1 + DEVLINK_RESOURCE_SCOPE_PORT = 0x2 DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX = 0x14 DEVLINK_SUPPORTED_FLASH_OVERWRITE_SECTIONS = 0x3 DEVMEM_MAGIC = 0x454d444d @@ -1127,6 +1134,7 @@ const ( ETHTOOL_SWOL = 0x6 ETHTOOL_TEST = 0x1a ETH_P_1588 = 0x88f7 + ETH_P_8021AC = 0x8870 ETH_P_8021AD = 0x88a8 ETH_P_8021AH = 0x88e7 ETH_P_8021Q = 0x8100 @@ -1170,6 +1178,7 @@ const ( ETH_P_ETHERCAT = 0x88a4 ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 + ETH_P_GRE_OSI = 0xfe ETH_P_HDLC = 0x19 ETH_P_HSR = 0x892f ETH_P_IBOE = 0x8915 @@ -1198,6 +1207,7 @@ const ( ETH_P_MXLGSW = 0x88c3 ETH_P_NCSI = 0x88f8 ETH_P_NSH = 0x894f + ETH_P_NXP_NETC = 0xfd3a ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -1359,6 +1369,7 @@ const ( FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 + FD_NSFS_ROOT = -0x2713 FD_PIDFS_ROOT = -0x2712 FD_SETSIZE = 0x400 FF0 = 0x0 @@ -1427,6 +1438,8 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x7 + FS_SHUTDOWN_FLAGS_LOGFLUSH = 0x1 + FS_SHUTDOWN_FLAGS_NOLOGFLUSH = 0x2 FS_VERITY_FL = 0x100000 FS_VERITY_HASH_ALG_SHA256 = 0x1 FS_VERITY_HASH_ALG_SHA512 = 0x2 @@ -1441,6 +1454,7 @@ const ( F_DUPFD_CLOEXEC = 0x406 F_DUPFD_QUERY = 0x403 F_EXLCK = 0x4 + F_GETDELEG = 0x40f F_GETFD = 0x1 F_GETFL = 0x3 F_GETLEASE = 0x401 @@ -1462,6 +1476,7 @@ const ( F_SEAL_SEAL = 0x1 F_SEAL_SHRINK = 0x2 F_SEAL_WRITE = 0x8 + F_SETDELEG = 0x410 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -1632,6 +1647,7 @@ const ( IN_UNMOUNT = 0x2000 IOCTL_MEI_CONNECT_CLIENT = 0xc0104801 IOCTL_MEI_CONNECT_CLIENT_VTAG = 0xc0144804 + IPPROTO_AGGFRAG = 0x90 IPPROTO_AH = 0x33 IPPROTO_BEETPH = 0x5e IPPROTO_COMP = 0x6c @@ -1913,10 +1929,14 @@ const ( LANDLOCK_ACCESS_FS_REFER = 0x2000 LANDLOCK_ACCESS_FS_REMOVE_DIR = 0x10 LANDLOCK_ACCESS_FS_REMOVE_FILE = 0x20 + LANDLOCK_ACCESS_FS_RESOLVE_UNIX = 0x10000 LANDLOCK_ACCESS_FS_TRUNCATE = 0x4000 LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2 LANDLOCK_ACCESS_NET_BIND_TCP = 0x1 + LANDLOCK_ACCESS_NET_BIND_UDP = 0x4 + LANDLOCK_ACCESS_NET_CONNECT_SEND_UDP = 0x8 LANDLOCK_ACCESS_NET_CONNECT_TCP = 0x2 + LANDLOCK_ADD_RULE_QUIET = 0x1 LANDLOCK_CREATE_RULESET_ERRATA = 0x2 LANDLOCK_CREATE_RULESET_VERSION = 0x1 LANDLOCK_RESTRICT_SELF_LOG_NEW_EXEC_ON = 0x2 @@ -3408,6 +3428,7 @@ const ( SCHED_FLAG_UTIL_CLAMP = 0x60 SCHED_FLAG_UTIL_CLAMP_MAX = 0x40 SCHED_FLAG_UTIL_CLAMP_MIN = 0x20 + SCHED_GETATTR_FLAG_DL_DYNAMIC = 0x1 SCHED_IDLE = 0x5 SCHED_NORMAL = 0x0 SCHED_RESET_ON_FORK = 0x40000000 @@ -3790,6 +3811,14 @@ const ( TCPOPT_TIMESTAMP = 0x8 TCPOPT_TSTAMP_HDR = 0x101080a TCPOPT_WINDOW = 0x3 + TCP_ACCECN_ACE_FAIL_RECV = 0x2 + TCP_ACCECN_ACE_FAIL_SEND = 0x1 + TCP_ACCECN_OPT_COUNTER_SEEN = 0x2 + TCP_ACCECN_OPT_EMPTY_SEEN = 0x1 + TCP_ACCECN_OPT_FAIL_RECV = 0x8 + TCP_ACCECN_OPT_FAIL_SEEN = 0x3 + TCP_ACCECN_OPT_FAIL_SEND = 0x4 + TCP_ACCECN_OPT_NOT_SEEN = 0x0 TCP_AO_KEYF_EXCLUDE_OPT = 0x2 TCP_AO_KEYF_IFINDEX = 0x1 TCP_AO_MAXKEYLEN = 0x50 @@ -3804,6 +3833,7 @@ const ( TCP_COOKIE_TRANSACTIONS = 0xf TCP_CORK = 0x3 TCP_DEFER_ACCEPT = 0x9 + TCP_DELACK_MAX_US = 0x2e TCP_FASTOPEN = 0x17 TCP_FASTOPEN_CONNECT = 0x1e TCP_FASTOPEN_KEY = 0x21 @@ -3836,6 +3866,8 @@ const ( TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d + TCP_RTO_MAX_MS = 0x2c + TCP_RTO_MIN_US = 0x2d TCP_SAVED_SYN = 0x1c TCP_SAVE_SYN = 0x1b TCP_SYNCNT = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 6f74d4a0cf..5aaf4bc7a2 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -600,6 +600,7 @@ const ( EDQUOT = syscall.Errno(0x7a) EFSBADCRC = syscall.Errno(0x4a) EFSCORRUPTED = syscall.Errno(0x75) + EFTYPE = syscall.Errno(0x86) EHOSTDOWN = syscall.Errno(0x70) EHOSTUNREACH = syscall.Errno(0x71) EHWPOISON = syscall.Errno(0x85) @@ -840,6 +841,7 @@ var errorList = [...]struct { {131, "ENOTRECOVERABLE", "state not recoverable"}, {132, "ERFKILL", "operation not possible due to RF-kill"}, {133, "EHWPOISON", "memory page has hardware error"}, + {134, "EFTYPE", "unknown error 134"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 36c1f0b68c..b8e6287a1c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -600,6 +600,7 @@ const ( EDQUOT = syscall.Errno(0x7a) EFSBADCRC = syscall.Errno(0x4a) EFSCORRUPTED = syscall.Errno(0x75) + EFTYPE = syscall.Errno(0x86) EHOSTDOWN = syscall.Errno(0x70) EHOSTUNREACH = syscall.Errno(0x71) EHWPOISON = syscall.Errno(0x85) @@ -840,6 +841,7 @@ var errorList = [...]struct { {131, "ENOTRECOVERABLE", "state not recoverable"}, {132, "ERFKILL", "operation not possible due to RF-kill"}, {133, "EHWPOISON", "memory page has hardware error"}, + {134, "EFTYPE", "unknown error 134"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index c5512dbea6..464f821890 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -605,6 +605,7 @@ const ( EDQUOT = syscall.Errno(0x7a) EFSBADCRC = syscall.Errno(0x4a) EFSCORRUPTED = syscall.Errno(0x75) + EFTYPE = syscall.Errno(0x86) EHOSTDOWN = syscall.Errno(0x70) EHOSTUNREACH = syscall.Errno(0x71) EHWPOISON = syscall.Errno(0x85) @@ -845,6 +846,7 @@ var errorList = [...]struct { {131, "ENOTRECOVERABLE", "state not recoverable"}, {132, "ERFKILL", "operation not possible due to RF-kill"}, {133, "EHWPOISON", "memory page has hardware error"}, + {134, "EFTYPE", "unknown error 134"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 4dabfae071..735265b626 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -602,6 +602,7 @@ const ( EDQUOT = syscall.Errno(0x7a) EFSBADCRC = syscall.Errno(0x4a) EFSCORRUPTED = syscall.Errno(0x75) + EFTYPE = syscall.Errno(0x86) EHOSTDOWN = syscall.Errno(0x70) EHOSTUNREACH = syscall.Errno(0x71) EHWPOISON = syscall.Errno(0x85) @@ -842,6 +843,7 @@ var errorList = [...]struct { {131, "ENOTRECOVERABLE", "state not recoverable"}, {132, "ERFKILL", "operation not possible due to RF-kill"}, {133, "EHWPOISON", "memory page has hardware error"}, + {134, "EFTYPE", "unknown error 134"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go index ea97930f1f..1970ce826a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go @@ -592,6 +592,7 @@ const ( EDQUOT = syscall.Errno(0x7a) EFSBADCRC = syscall.Errno(0x4a) EFSCORRUPTED = syscall.Errno(0x75) + EFTYPE = syscall.Errno(0x86) EHOSTDOWN = syscall.Errno(0x70) EHOSTUNREACH = syscall.Errno(0x71) EHWPOISON = syscall.Errno(0x85) @@ -832,6 +833,7 @@ var errorList = [...]struct { {131, "ENOTRECOVERABLE", "state not recoverable"}, {132, "ERFKILL", "operation not possible due to RF-kill"}, {133, "EHWPOISON", "memory page has hardware error"}, + {134, "EFTYPE", "unknown error 134"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 0826a929e0..56de9aeb29 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -601,6 +601,7 @@ const ( EDQUOT = syscall.Errno(0x46d) EFSBADCRC = syscall.Errno(0x4d) EFSCORRUPTED = syscall.Errno(0x87) + EFTYPE = syscall.Errno(0xa9) EHOSTDOWN = syscall.Errno(0x93) EHOSTUNREACH = syscall.Errno(0x94) EHWPOISON = syscall.Errno(0xa8) @@ -845,6 +846,7 @@ var errorList = [...]struct { {166, "ENOTRECOVERABLE", "state not recoverable"}, {167, "ERFKILL", "operation not possible due to RF-kill"}, {168, "EHWPOISON", "memory page has hardware error"}, + {169, "EFTYPE", "unknown error 169"}, {1133, "EDQUOT", "disk quota exceeded"}, } diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 139deedd95..26ca1caca3 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -601,6 +601,7 @@ const ( EDQUOT = syscall.Errno(0x46d) EFSBADCRC = syscall.Errno(0x4d) EFSCORRUPTED = syscall.Errno(0x87) + EFTYPE = syscall.Errno(0xa9) EHOSTDOWN = syscall.Errno(0x93) EHOSTUNREACH = syscall.Errno(0x94) EHWPOISON = syscall.Errno(0xa8) @@ -845,6 +846,7 @@ var errorList = [...]struct { {166, "ENOTRECOVERABLE", "state not recoverable"}, {167, "ERFKILL", "operation not possible due to RF-kill"}, {168, "EHWPOISON", "memory page has hardware error"}, + {169, "EFTYPE", "unknown error 169"}, {1133, "EDQUOT", "disk quota exceeded"}, } diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index b8018af335..b19df2348c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -601,6 +601,7 @@ const ( EDQUOT = syscall.Errno(0x46d) EFSBADCRC = syscall.Errno(0x4d) EFSCORRUPTED = syscall.Errno(0x87) + EFTYPE = syscall.Errno(0xa9) EHOSTDOWN = syscall.Errno(0x93) EHOSTUNREACH = syscall.Errno(0x94) EHWPOISON = syscall.Errno(0xa8) @@ -845,6 +846,7 @@ var errorList = [...]struct { {166, "ENOTRECOVERABLE", "state not recoverable"}, {167, "ERFKILL", "operation not possible due to RF-kill"}, {168, "EHWPOISON", "memory page has hardware error"}, + {169, "EFTYPE", "unknown error 169"}, {1133, "EDQUOT", "disk quota exceeded"}, } diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index deb5c2e6a9..9ba3c95099 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -601,6 +601,7 @@ const ( EDQUOT = syscall.Errno(0x46d) EFSBADCRC = syscall.Errno(0x4d) EFSCORRUPTED = syscall.Errno(0x87) + EFTYPE = syscall.Errno(0xa9) EHOSTDOWN = syscall.Errno(0x93) EHOSTUNREACH = syscall.Errno(0x94) EHWPOISON = syscall.Errno(0xa8) @@ -845,6 +846,7 @@ var errorList = [...]struct { {166, "ENOTRECOVERABLE", "state not recoverable"}, {167, "ERFKILL", "operation not possible due to RF-kill"}, {168, "EHWPOISON", "memory page has hardware error"}, + {169, "EFTYPE", "unknown error 169"}, {1133, "EDQUOT", "disk quota exceeded"}, } diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index 0603bf3a1a..62da59f96a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -657,6 +657,7 @@ const ( EDQUOT = syscall.Errno(0x7a) EFSBADCRC = syscall.Errno(0x4a) EFSCORRUPTED = syscall.Errno(0x75) + EFTYPE = syscall.Errno(0x86) EHOSTDOWN = syscall.Errno(0x70) EHOSTUNREACH = syscall.Errno(0x71) EHWPOISON = syscall.Errno(0x85) @@ -898,6 +899,7 @@ var errorList = [...]struct { {131, "ENOTRECOVERABLE", "state not recoverable"}, {132, "ERFKILL", "operation not possible due to RF-kill"}, {133, "EHWPOISON", "memory page has hardware error"}, + {134, "EFTYPE", "unknown error 134"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 5fa8a5d367..d18d4daed4 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -661,6 +661,7 @@ const ( EDQUOT = syscall.Errno(0x7a) EFSBADCRC = syscall.Errno(0x4a) EFSCORRUPTED = syscall.Errno(0x75) + EFTYPE = syscall.Errno(0x86) EHOSTDOWN = syscall.Errno(0x70) EHOSTUNREACH = syscall.Errno(0x71) EHWPOISON = syscall.Errno(0x85) @@ -902,6 +903,7 @@ var errorList = [...]struct { {131, "ENOTRECOVERABLE", "state not recoverable"}, {132, "ERFKILL", "operation not possible due to RF-kill"}, {133, "EHWPOISON", "memory page has hardware error"}, + {134, "EFTYPE", "unknown error 134"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 2733e99934..ba7767db53 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -661,6 +661,7 @@ const ( EDQUOT = syscall.Errno(0x7a) EFSBADCRC = syscall.Errno(0x4a) EFSCORRUPTED = syscall.Errno(0x75) + EFTYPE = syscall.Errno(0x86) EHOSTDOWN = syscall.Errno(0x70) EHOSTUNREACH = syscall.Errno(0x71) EHWPOISON = syscall.Errno(0x85) @@ -902,6 +903,7 @@ var errorList = [...]struct { {131, "ENOTRECOVERABLE", "state not recoverable"}, {132, "ERFKILL", "operation not possible due to RF-kill"}, {133, "EHWPOISON", "memory page has hardware error"}, + {134, "EFTYPE", "unknown error 134"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 1470172fd9..76cb221111 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -602,6 +602,7 @@ const ( EDQUOT = syscall.Errno(0x7a) EFSBADCRC = syscall.Errno(0x4a) EFSCORRUPTED = syscall.Errno(0x75) + EFTYPE = syscall.Errno(0x86) EHOSTDOWN = syscall.Errno(0x70) EHOSTUNREACH = syscall.Errno(0x71) EHWPOISON = syscall.Errno(0x85) @@ -842,6 +843,7 @@ var errorList = [...]struct { {131, "ENOTRECOVERABLE", "state not recoverable"}, {132, "ERFKILL", "operation not possible due to RF-kill"}, {133, "EHWPOISON", "memory page has hardware error"}, + {134, "EFTYPE", "unknown error 134"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 1871579c5c..ffd12a97fc 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -661,6 +661,7 @@ const ( EDQUOT = syscall.Errno(0x7a) EFSBADCRC = syscall.Errno(0x4a) EFSCORRUPTED = syscall.Errno(0x75) + EFTYPE = syscall.Errno(0x86) EHOSTDOWN = syscall.Errno(0x70) EHOSTUNREACH = syscall.Errno(0x71) EHWPOISON = syscall.Errno(0x85) @@ -901,6 +902,7 @@ var errorList = [...]struct { {131, "ENOTRECOVERABLE", "state not recoverable"}, {132, "ERFKILL", "operation not possible due to RF-kill"}, {133, "EHWPOISON", "memory page has hardware error"}, + {134, "EFTYPE", "unknown error 134"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index 10881cf6d3..f372aed328 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -704,6 +704,7 @@ const ( EDQUOT = syscall.Errno(0x45) EFSBADCRC = syscall.Errno(0x4c) EFSCORRUPTED = syscall.Errno(0x75) + EFTYPE = syscall.Errno(0x88) EHOSTDOWN = syscall.Errno(0x40) EHOSTUNREACH = syscall.Errno(0x41) EHWPOISON = syscall.Errno(0x87) @@ -950,6 +951,7 @@ var errorList = [...]struct { {133, "ENOTRECOVERABLE", "state not recoverable"}, {134, "ERFKILL", "operation not possible due to RF-kill"}, {135, "EHWPOISON", "memory page has hardware error"}, + {136, "EFTYPE", "unknown error 136"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index 813c05b664..7db9bf5f29 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -702,6 +702,17 @@ var libc_fcntl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func kill(pid int, signum int, posix int) (err error) { _, _, e1 := syscall_syscall(libc_kill_trampoline_addr, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index e6f58f3c6f..2a658059df 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -702,6 +702,17 @@ var libc_fcntl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func kill(pid int, signum int, posix int) (err error) { _, _, e1 := syscall_syscall(libc_kill_trampoline_addr, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go index c0096391af..10b57ffb9c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go @@ -825,6 +825,165 @@ func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func extattrGetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFd(fd int, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFile(file string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListLink(link string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fadvise(fd int, offset int64, length int64, advice int) (err error) { _, _, e1 := Syscall6(SYS_POSIX_FADVISE, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(length), uintptr(length>>32), uintptr(advice)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go index 7664df7496..6a6fc3cc4b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go @@ -825,6 +825,165 @@ func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func extattrGetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFd(fd int, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFile(file string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListLink(link string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fadvise(fd int, offset int64, length int64, advice int) (err error) { _, _, e1 := Syscall6(SYS_POSIX_FADVISE, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go index ae099182c9..4a15b4abf0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go @@ -825,6 +825,165 @@ func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func extattrGetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFd(fd int, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFile(file string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListLink(link string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fadvise(fd int, offset int64, length int64, advice int) (err error) { _, _, e1 := Syscall9(SYS_POSIX_FADVISE, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(length), uintptr(length>>32), uintptr(advice), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go index 11fd5d45bb..f15331fb4c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go @@ -825,6 +825,165 @@ func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func extattrGetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFd(fd int, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFile(file string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListLink(link string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fadvise(fd int, offset int64, length int64, advice int) (err error) { _, _, e1 := Syscall6(SYS_POSIX_FADVISE, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go index c3d2d65307..faa562642e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go @@ -825,6 +825,165 @@ func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func extattrGetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFd(fd int, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFile(file string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListLink(link string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fadvise(fd int, offset int64, length int64, advice int) (err error) { _, _, e1 := Syscall6(SYS_POSIX_FADVISE, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 5788c2a58d..4c63b976be 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -943,7 +943,7 @@ func fsconfig(fd int, cmd uint, key *byte, value *byte, aux int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getdents(fd int, buf []byte) (n int, err error) { +func getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) @@ -1167,6 +1167,23 @@ func Lgetxattr(path string, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Listns(req *NsIdReq, nsIds []uint64, flags uint) (n int, err error) { + var _p0 unsafe.Pointer + if len(nsIds) > 0 { + _p0 = unsafe.Pointer(&nsIds[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_LISTNS, uintptr(unsafe.Pointer(req)), uintptr(_p0), uintptr(len(nsIds)), uintptr(flags), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Listxattr(path string, dest []byte) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1390,6 +1407,16 @@ func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func PrctlArg5Ptr(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 unsafe.Pointer) (err error) { + _, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func pselect6(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *sigset_argpack) (n int, err error) { r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) n = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go index 527637623d..b7aca54590 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go @@ -66,7 +66,7 @@ func Fchown(fd int, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } @@ -183,7 +183,7 @@ func Lstat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } @@ -338,7 +338,7 @@ func Stat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go index e91ebc14a1..1e136d12b6 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go @@ -802,6 +802,165 @@ func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func extattrGetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFd(fd int, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFile(file string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListLink(link string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go index be28babbcd..440db6ec58 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go @@ -802,6 +802,165 @@ func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func extattrGetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFd(fd int, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFile(file string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListLink(link string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go index fb587e8261..db963000e9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go @@ -802,6 +802,165 @@ func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func extattrGetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFd(fd int, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFile(file string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListLink(link string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go index d576438bb0..c4bea6c89f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go @@ -802,6 +802,165 @@ func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func extattrGetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFd(fd int, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFd(fd int, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetFile(file string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListFile(file string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrGetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrSetLink(link string, attrnamespace int, attrname string, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func extattrListLink(link string, attrnamespace int, data unsafe.Pointer, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go index 5e8c263ca9..f09f844788 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go @@ -2848,5 +2848,18 @@ const ( SYS_____CHATTRAT64_A = 0xE39 // 3641 SYS_MADVISE = 0xE3A // 3642 SYS___AUTHENTICATE = 0xE3B // 3643 + SYS_GETPWENT_R = 0xE3C // 3644 + SYS___GETPWENT_R_A = 0xE3D // 3645 + SYS_STRNLEN = 0xE3E // 3646 + SYS_STPCPY = 0xE3F // 3647 + SYS_STPNCPY = 0xE40 // 3648 + SYS_STRSIGNAL = 0xE41 // 3649 + SYS_WCPCPY = 0xE42 // 3650 + SYS_WCPNCPY = 0xE43 // 3651 + SYS_WCSNLEN = 0xE44 // 3652 + SYS___STRSIGNAL_A = 0xE45 // 3653 + SYS_FDOPENDIR = 0xE46 // 3654 + SYS_FDCLOSEDIR = 0xE47 // 3655 + SYS_SYSCALL = 0xE48 // 3656 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 538a18f27c..2b3c00b9d8 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -933,6 +933,29 @@ type OpenHow struct { const SizeofOpenHow = 0x18 +type NsIdReq struct { + Size uint32 + Spare uint32 + Ns_id uint64 + Ns_type uint32 + Spare2 uint32 + User_ns_id uint64 +} + +const ( + NS_ID_REQ_SIZE_VER0 = 0x20 + LISTNS_CURRENT_USER = 0xffffffffffffffff + + TIME_NS = 0x80 + MNT_NS = 0x20000 + CGROUP_NS = 0x2000000 + UTS_NS = 0x4000000 + IPC_NS = 0x8000000 + USER_NS = 0x10000000 + PID_NS = 0x20000000 + NET_NS = 0x40000000 +) + const ( RESOLVE_BENEATH = 0x8 RESOLVE_IN_ROOT = 0x10 @@ -3579,7 +3602,7 @@ const ( DEVLINK_ATTR_LINECARD_SUPPORTED_TYPES = 0xae DEVLINK_ATTR_NESTED_DEVLINK = 0xaf DEVLINK_ATTR_SELFTESTS = 0xb0 - DEVLINK_ATTR_MAX = 0xb7 + DEVLINK_ATTR_MAX = 0xb9 DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE = 0x0 DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX = 0x1 DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT = 0x0 @@ -4101,7 +4124,7 @@ const ( ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL = 0x17 ETHTOOL_A_COALESCE_USE_CQE_MODE_TX = 0x18 ETHTOOL_A_COALESCE_USE_CQE_MODE_RX = 0x19 - ETHTOOL_A_COALESCE_MAX = 0x1e + ETHTOOL_A_COALESCE_MAX = 0x20 ETHTOOL_A_PAUSE_UNSPEC = 0x0 ETHTOOL_A_PAUSE_HEADER = 0x1 ETHTOOL_A_PAUSE_AUTONEG = 0x2 @@ -4113,7 +4136,7 @@ const ( ETHTOOL_A_PAUSE_STAT_PAD = 0x1 ETHTOOL_A_PAUSE_STAT_TX_FRAMES = 0x2 ETHTOOL_A_PAUSE_STAT_RX_FRAMES = 0x3 - ETHTOOL_A_PAUSE_STAT_MAX = 0x3 + ETHTOOL_A_PAUSE_STAT_MAX = 0x4 ETHTOOL_A_EEE_UNSPEC = 0x0 ETHTOOL_A_EEE_HEADER = 0x1 ETHTOOL_A_EEE_MODES_OURS = 0x2 @@ -4537,9 +4560,12 @@ const ( ) type LandlockRulesetAttr struct { - Access_fs uint64 - Access_net uint64 - Scoped uint64 + Handled_access_fs uint64 + Handled_access_net uint64 + Scoped uint64 + Quiet_access_fs uint64 + Quiet_access_net uint64 + Quiet_scoped uint64 } type LandlockPathBeneathAttr struct { @@ -4569,28 +4595,31 @@ const ( PIDFD_COREDUMP_USER = 0x4 PIDFD_COREDUMP_ROOT = 0x8 PIDFD_INFO_SIZE_VER0 = 0x40 - PIDFD_GET_INFO = 0xc048ff0b + PIDFD_GET_INFO = 0xc058ff0b ) -const SizeofPidfdInfo = 0x48 +const SizeofPidfdInfo = 0x58 type PidfdInfo struct { - Mask uint64 - Cgroupid uint64 - Pid uint32 - Tgid uint32 - Ppid uint32 - Ruid uint32 - Rgid uint32 - Euid uint32 - Egid uint32 - Suid uint32 - Sgid uint32 - Fsuid uint32 - Fsgid uint32 - Exit_code int32 - Coredump_mask uint32 - _ uint32 + Mask uint64 + Cgroupid uint64 + Pid uint32 + Tgid uint32 + Ppid uint32 + Ruid uint32 + Rgid uint32 + Euid uint32 + Egid uint32 + Suid uint32 + Sgid uint32 + Fsuid uint32 + Fsgid uint32 + Exit_code int32 + Coredump_mask uint32 + Coredump_signal uint32 + Coredump_code uint32 + Coredump_pad uint32 + Supported_mask uint64 } const ( @@ -4932,7 +4961,7 @@ const ( NL80211_ATTR_MAC_HINT = 0xc8 NL80211_ATTR_MAC_MASK = 0xd7 NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca - NL80211_ATTR_MAX = 0x15c + NL80211_ATTR_MAX = 0x16e NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4 NL80211_ATTR_MAX_CSA_COUNTERS = 0xce NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS = 0x143 @@ -5147,12 +5176,12 @@ const ( NL80211_ATTR_WOWLAN_TRIGGERS = 0x75 NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED = 0x76 NL80211_ATTR_WPA_VERSIONS = 0x4b - NL80211_AUTHTYPE_AUTOMATIC = 0x9 + NL80211_AUTHTYPE_AUTOMATIC = 0xa NL80211_AUTHTYPE_FILS_PK = 0x7 NL80211_AUTHTYPE_FILS_SK = 0x5 NL80211_AUTHTYPE_FILS_SK_PFS = 0x6 NL80211_AUTHTYPE_FT = 0x2 - NL80211_AUTHTYPE_MAX = 0x8 + NL80211_AUTHTYPE_MAX = 0x9 NL80211_AUTHTYPE_NETWORK_EAP = 0x3 NL80211_AUTHTYPE_OPEN_SYSTEM = 0x0 NL80211_AUTHTYPE_SAE = 0x4 @@ -5320,7 +5349,7 @@ const ( NL80211_CMD_LEAVE_MESH = 0x45 NL80211_CMD_LEAVE_OCB = 0x6d NL80211_CMD_LINKS_REMOVED = 0x9a - NL80211_CMD_MAX = 0x9f + NL80211_CMD_MAX = 0xa7 NL80211_CMD_MICHAEL_MIC_FAILURE = 0x29 NL80211_CMD_MODIFY_LINK_STA = 0x97 NL80211_CMD_NAN_MATCH = 0x78 @@ -5566,7 +5595,7 @@ const ( NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf - NL80211_FREQUENCY_ATTR_MAX = 0x27 + NL80211_FREQUENCY_ATTR_MAX = 0x29 NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6 NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11 NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc @@ -5639,7 +5668,7 @@ const ( NL80211_IFTYPE_AKM_ATTR_SUITES = 0x2 NL80211_IFTYPE_AP = 0x3 NL80211_IFTYPE_AP_VLAN = 0x4 - NL80211_IFTYPE_MAX = 0xc + NL80211_IFTYPE_MAX = 0xe NL80211_IFTYPE_MESH_POINT = 0x7 NL80211_IFTYPE_MONITOR = 0x6 NL80211_IFTYPE_NAN = 0xc @@ -5664,7 +5693,7 @@ const ( NL80211_KEY_DEFAULT_TYPES = 0x8 NL80211_KEY_DEFAULT_TYPE_UNICAST = 0x1 NL80211_KEY_IDX = 0x2 - NL80211_KEY_MAX = 0xa + NL80211_KEY_MAX = 0xb NL80211_KEY_MODE = 0x9 NL80211_KEY_NO_TX = 0x1 NL80211_KEY_RX_TX = 0x0 @@ -5822,7 +5851,7 @@ const ( NL80211_PMKSA_CANDIDATE_BSSID = 0x2 NL80211_PMKSA_CANDIDATE_INDEX = 0x1 NL80211_PMKSA_CANDIDATE_PREAUTH = 0x3 - NL80211_PMSR_ATTR_MAX = 0x5 + NL80211_PMSR_ATTR_MAX = 0x7 NL80211_PMSR_ATTR_MAX_PEERS = 0x1 NL80211_PMSR_ATTR_PEERS = 0x5 NL80211_PMSR_ATTR_RANDOMIZE_MAC_ADDR = 0x3 @@ -5831,7 +5860,7 @@ const ( NL80211_PMSR_FTM_CAPA_ATTR_ASAP = 0x1 NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS = 0x6 NL80211_PMSR_FTM_CAPA_ATTR_MAX_BURSTS_EXPONENT = 0x7 - NL80211_PMSR_FTM_CAPA_ATTR_MAX = 0x12 + NL80211_PMSR_FTM_CAPA_ATTR_MAX = 0x1f NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST = 0x8 NL80211_PMSR_FTM_CAPA_ATTR_NON_ASAP = 0x2 NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED = 0xa @@ -5853,7 +5882,7 @@ const ( NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD = 0x4 NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST = 0x6 NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK = 0xc - NL80211_PMSR_FTM_REQ_ATTR_MAX = 0xe + NL80211_PMSR_FTM_REQ_ATTR_MAX = 0x17 NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED = 0xb NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP = 0x3 NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES = 0x7 @@ -5871,7 +5900,7 @@ const ( NL80211_PMSR_FTM_RESP_ATTR_FAIL_REASON = 0x1 NL80211_PMSR_FTM_RESP_ATTR_FTMS_PER_BURST = 0x8 NL80211_PMSR_FTM_RESP_ATTR_LCI = 0x13 - NL80211_PMSR_FTM_RESP_ATTR_MAX = 0x16 + NL80211_PMSR_FTM_RESP_ATTR_MAX = 0x21 NL80211_PMSR_FTM_RESP_ATTR_NUM_BURSTS_EXP = 0x6 NL80211_PMSR_FTM_RESP_ATTR_NUM_FTMR_ATTEMPTS = 0x3 NL80211_PMSR_FTM_RESP_ATTR_NUM_FTMR_SUCCESSES = 0x4 @@ -5885,7 +5914,7 @@ const ( NL80211_PMSR_FTM_RESP_ATTR_TX_RATE = 0xb NL80211_PMSR_PEER_ATTR_ADDR = 0x1 NL80211_PMSR_PEER_ATTR_CHAN = 0x2 - NL80211_PMSR_PEER_ATTR_MAX = 0x4 + NL80211_PMSR_PEER_ATTR_MAX = 0x5 NL80211_PMSR_PEER_ATTR_REQ = 0x3 NL80211_PMSR_PEER_ATTR_RESP = 0x4 NL80211_PMSR_REQ_ATTR_DATA = 0x1 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 38658a345b..c7ec66dc94 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -163,6 +163,11 @@ type Msghdr struct { Flags int32 } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 +} + type Cmsghdr struct { Len uint32 Level int32 @@ -178,6 +183,7 @@ const ( SizeofSockaddrNFCLLCP = 0x58 SizeofIovec = 0x8 SizeofMsghdr = 0x1c + SizeofMmsghdr = 0x20 SizeofCmsghdr = 0xc ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index 267ffe05f3..abe072e897 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -166,6 +166,12 @@ type Msghdr struct { _ [4]byte } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 + _ [4]byte +} + type Cmsghdr struct { Len uint64 Level int32 @@ -181,6 +187,7 @@ const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 SizeofMsghdr = 0x38 + SizeofMmsghdr = 0x40 SizeofCmsghdr = 0x10 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index ec459d5f3f..4ba7cea03e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -169,6 +169,11 @@ type Msghdr struct { Flags int32 } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 +} + type Cmsghdr struct { Len uint32 Level int32 @@ -184,6 +189,7 @@ const ( SizeofSockaddrNFCLLCP = 0x58 SizeofIovec = 0x8 SizeofMsghdr = 0x1c + SizeofMmsghdr = 0x20 SizeofCmsghdr = 0xc ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index fa45ab7d2c..3f55ca4afc 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -167,6 +167,12 @@ type Msghdr struct { _ [4]byte } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 + _ [4]byte +} + type Cmsghdr struct { Len uint64 Level int32 @@ -182,6 +188,7 @@ const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 SizeofMsghdr = 0x38 + SizeofMmsghdr = 0x40 SizeofCmsghdr = 0x10 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go index 3da72ccdf8..445b2a2e97 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go @@ -167,6 +167,12 @@ type Msghdr struct { _ [4]byte } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 + _ [4]byte +} + type Cmsghdr struct { Len uint64 Level int32 @@ -182,6 +188,7 @@ const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 SizeofMsghdr = 0x38 + SizeofMmsghdr = 0x40 SizeofCmsghdr = 0x10 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 78f8c6d555..6a52e254fc 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -168,6 +168,11 @@ type Msghdr struct { Flags int32 } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 +} + type Cmsghdr struct { Len uint32 Level int32 @@ -183,6 +188,7 @@ const ( SizeofSockaddrNFCLLCP = 0x58 SizeofIovec = 0x8 SizeofMsghdr = 0x1c + SizeofMmsghdr = 0x20 SizeofCmsghdr = 0xc ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index bbd4c6c2b9..fafd89de21 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -167,6 +167,12 @@ type Msghdr struct { _ [4]byte } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 + _ [4]byte +} + type Cmsghdr struct { Len uint64 Level int32 @@ -182,6 +188,7 @@ const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 SizeofMsghdr = 0x38 + SizeofMmsghdr = 0x40 SizeofCmsghdr = 0x10 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 644d31d6ae..5fb6f4cf8c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -167,6 +167,12 @@ type Msghdr struct { _ [4]byte } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 + _ [4]byte +} + type Cmsghdr struct { Len uint64 Level int32 @@ -182,6 +188,7 @@ const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 SizeofMsghdr = 0x38 + SizeofMmsghdr = 0x40 SizeofCmsghdr = 0x10 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index a976f62676..a50187bcec 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -168,6 +168,11 @@ type Msghdr struct { Flags int32 } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 +} + type Cmsghdr struct { Len uint32 Level int32 @@ -183,6 +188,7 @@ const ( SizeofSockaddrNFCLLCP = 0x58 SizeofIovec = 0x8 SizeofMsghdr = 0x1c + SizeofMmsghdr = 0x20 SizeofCmsghdr = 0xc ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go index 46324695f6..777b0228fe 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -169,6 +169,11 @@ type Msghdr struct { Flags int32 } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 +} + type Cmsghdr struct { Len uint32 Level int32 @@ -184,6 +189,7 @@ const ( SizeofSockaddrNFCLLCP = 0x58 SizeofIovec = 0x8 SizeofMsghdr = 0x1c + SizeofMmsghdr = 0x20 SizeofCmsghdr = 0xc ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index cbc303974f..48a6a5ac38 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -168,6 +168,12 @@ type Msghdr struct { _ [4]byte } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 + _ [4]byte +} + type Cmsghdr struct { Len uint64 Level int32 @@ -183,6 +189,7 @@ const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 SizeofMsghdr = 0x38 + SizeofMmsghdr = 0x40 SizeofCmsghdr = 0x10 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index b47f7b4984..1972c0125e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -168,6 +168,12 @@ type Msghdr struct { _ [4]byte } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 + _ [4]byte +} + type Cmsghdr struct { Len uint64 Level int32 @@ -183,6 +189,7 @@ const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 SizeofMsghdr = 0x38 + SizeofMmsghdr = 0x40 SizeofCmsghdr = 0x10 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index cb16add54c..87572ee086 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -167,6 +167,12 @@ type Msghdr struct { _ [4]byte } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 + _ [4]byte +} + type Cmsghdr struct { Len uint64 Level int32 @@ -182,6 +188,7 @@ const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 SizeofMsghdr = 0x38 + SizeofMmsghdr = 0x40 SizeofCmsghdr = 0x10 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index a57ab8fadd..f6a33e6803 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -166,6 +166,12 @@ type Msghdr struct { _ [4]byte } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 + _ [4]byte +} + type Cmsghdr struct { Len uint64 Level int32 @@ -181,6 +187,7 @@ const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 SizeofMsghdr = 0x38 + SizeofMmsghdr = 0x40 SizeofCmsghdr = 0x10 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index bf99635d8a..8b72614580 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -84,22 +84,20 @@ type Rusage struct { type Stat_t struct { Dev uint64 - _ uint16 Ino uint64 + Nlink uint64 Mode uint32 - Nlink uint32 Uid uint32 Gid uint32 + _ uint32 Rdev uint64 - _ uint16 Size int64 Blksize int64 Blocks int64 Atim Timespec Mtim Timespec Ctim Timespec - _ uint64 - _ uint64 + _ [3]int64 } type Dirent struct { @@ -170,6 +168,12 @@ type Msghdr struct { _ [4]byte } +type Mmsghdr struct { + Hdr Msghdr + Len uint32 + _ [4]byte +} + type Cmsghdr struct { Len uint64 Level int32 @@ -185,6 +189,7 @@ const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 SizeofMsghdr = 0x38 + SizeofMmsghdr = 0x40 SizeofCmsghdr = 0x10 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go index 2e5d5a4435..80d4c9535c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go @@ -209,6 +209,84 @@ type TCPInfo struct { Total_retrans uint32 } +// Ptrace structures for z/OS + +type PtraceRegs struct { + Psw PtracePsw + Gprs [16]uint64 + Acrs [16]uint32 + Orig_gpr2 uint64 + Fp_regs PtraceFpregs + Per_info PtracePer + Ieee_instruction_pointer uint64 +} + +type PtracePsw struct { + Mask uint64 + Addr uint64 +} + +type PtraceFpregs struct { + Fpc uint32 + Fprs [16]float64 +} + +type PtracePer struct { + Control_regs [3]uint64 + _ [8]byte + Starting_addr uint64 + Ending_addr uint64 + Perc_atmid uint16 + Address uint64 + Access_id uint8 + _ [7]byte +} + +// PT_BLOCKREQ structures for block ptrace requests +// Layout matches BPXYPTRC HLASM macro (PtBR_GPR + PtBR_GPR_EXT): +// +// Offset 0-1: Writebitflags (PtBR_GPR_CntlGPR, 2 bytes) +// Offset 2-3: Wpsw (PtBR_GPR_CntlMisc, 2 bytes with WPSW bit flag) +// Offset 4-15: Reserved (12 bytes) +// Offset 16-79: Gpr (64 bytes, 16 GPRs) +// Offset 80-143: Ctl (64 bytes, 16 CRs) +// Offset 144-151: Psw old format (8 bytes, PtBR_GPR_PSW) +// Offset 152-167: Pswg extended (16 bytes, PtBR_GPR_PSWG for 64-bit) +// Total: 168 bytes (base 152 + extended 16) +type PtraceBlkGpr struct { + Writebitflags uint16 // 2 bytes at offset 0 (PtBR_GPR_CntlGPR) + Wpsw uint16 // 2 bytes at offset 2 (PtBR_GPR_CntlMisc with WPSW flag) + _ [12]byte // 12 bytes reserved (offset 4-15) + Gpr [16]uint32 // 64 bytes at offset 16 (GPRs) + Ctl [16]uint32 // 64 bytes at offset 80 (CRs) + Psw [8]byte // 8 bytes at offset 144 (old PSW format) + Pswg [16]byte // 16 bytes at offset 152 (extended PSWG) + // Total: 2+2+12+64+64+8+16 = 168 bytes +} + +type PtraceBlkReqReq struct { + Reqtype int32 + Reqstat int32 + Reqdata uint32 + _ [4]byte +} + +type PtraceBlkReq struct { + Numreq int32 + _ [12]byte +} + +// PT_READ_U structures for reading user area (control info) +type PtraceBlkUarOcw struct { + Ofs uint32 // Control information offset + Ctl uint32 // Control information +} + +type PtraceBlkUar struct { + Num uint32 // Number of entries + _ [4]byte +} + type _Gid_t uint32 type rusage_zos struct { diff --git a/vendor/golang.org/x/sys/windows/types_windows_arm.go b/vendor/golang.org/x/sys/windows/types_windows_arm.go deleted file mode 100644 index 321872c3e0..0000000000 --- a/vendor/golang.org/x/sys/windows/types_windows_arm.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 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. - -package windows - -type WSAData struct { - Version uint16 - HighVersion uint16 - Description [WSADESCRIPTION_LEN + 1]byte - SystemStatus [WSASYS_STATUS_LEN + 1]byte - MaxSockets uint16 - MaxUdpDg uint16 - VendorInfo *byte -} - -type Servent struct { - Name *byte - Aliases **byte - Port uint16 - Proto *byte -} - -type JOBOBJECT_BASIC_LIMIT_INFORMATION struct { - PerProcessUserTimeLimit int64 - PerJobUserTimeLimit int64 - LimitFlags uint32 - MinimumWorkingSetSize uintptr - MaximumWorkingSetSize uintptr - ActiveProcessLimit uint32 - Affinity uintptr - PriorityClass uint32 - SchedulingClass uint32 - _ uint32 // pad to 8 byte boundary -} diff --git a/vendor/golang.org/x/text/secure/bidirule/bidirule.go b/vendor/golang.org/x/text/secure/bidirule/bidirule.go index 5386327308..399cb89697 100644 --- a/vendor/golang.org/x/text/secure/bidirule/bidirule.go +++ b/vendor/golang.org/x/text/secure/bidirule/bidirule.go @@ -10,6 +10,7 @@ package bidirule import ( "errors" + "sync" "unicode/utf8" "golang.org/x/text/transform" @@ -246,8 +247,9 @@ func (t *Transformer) Span(src []byte, atEOF bool) (n int, err error) { // Precomputing the ASCII values decreases running time for the ASCII fast path // by about 30%. var asciiTable [128]bidi.Properties +var asciiTableOnce sync.Once -func init() { +func initASCIITable() { for i := range asciiTable { p, _ := bidi.LookupRune(rune(i)) asciiTable[i] = p @@ -255,6 +257,8 @@ func init() { } func (t *Transformer) advance(s []byte) (n int, ok bool) { + asciiTableOnce.Do(initASCIITable) + var e bidi.Properties var sz int for n < len(s) { @@ -297,6 +301,8 @@ func (t *Transformer) advance(s []byte) (n int, ok bool) { } func (t *Transformer) advanceString(s string) (n int, ok bool) { + asciiTableOnce.Do(initASCIITable) + var e bidi.Properties var sz int for n < len(s) { diff --git a/vendor/golang.org/x/text/unicode/bidi/core.go b/vendor/golang.org/x/text/unicode/bidi/core.go index e28ac8c8aa..fe5a46ffe1 100644 --- a/vendor/golang.org/x/text/unicode/bidi/core.go +++ b/vendor/golang.org/x/text/unicode/bidi/core.go @@ -208,27 +208,23 @@ func (p *paragraph) determineMatchingIsolates() { p.matchingIsolateInitiator[i] = -1 } + var open []int for i := range p.matchingPDI { p.matchingPDI[i] = -1 - if t := p.resultTypes[i]; t.in(LRI, RLI, FSI) { - depthCounter := 1 - for j := i + 1; j < p.Len(); j++ { - if u := p.resultTypes[j]; u.in(LRI, RLI, FSI) { - depthCounter++ - } else if u == PDI { - if depthCounter--; depthCounter == 0 { - p.matchingPDI[i] = j - p.matchingIsolateInitiator[j] = i - break - } - } - } - if p.matchingPDI[i] == -1 { - p.matchingPDI[i] = p.Len() - } + switch t := p.resultTypes[i]; { + case t.in(LRI, RLI, FSI): + open = append(open, i) + case t == PDI && len(open) > 0: + j := open[len(open)-1] + open = open[:len(open)-1] + p.matchingPDI[j] = i + p.matchingIsolateInitiator[i] = j } } + for _, i := range open { + p.matchingPDI[i] = p.Len() + } } // determineParagraphEmbeddingLevel reports the resolved paragraph direction of @@ -496,16 +492,13 @@ func (s *isolatingRunSequence) resolveWeakTypes() { // Rule W2. // EN does not change at the start of the run, because sos != AL. + lastStrong := unknownClass for i, t := range s.types { - if t == EN { - for j := i - 1; j >= 0; j-- { - if t := s.types[j]; t.in(L, R, AL) { - if t == AL { - s.types[i] = AN - } - break - } - } + switch { + case t.in(L, R, AL): + lastStrong = t + case t == EN && lastStrong == AL: + s.types[i] = AN } } @@ -543,29 +536,30 @@ func (s *isolatingRunSequence) resolveWeakTypes() { } // Rule W5. - for i, t := range s.types { - if t == ET { - // locate end of sequence - runStart := i - runEnd := s.findRunLimit(runStart, ET) - - // check values at ends of sequence - t := s.sos - if runStart > 0 { - t = s.types[runStart-1] - } - if t != EN { - t = s.eos - if runEnd < len(s.types) { - t = s.types[runEnd] - } - } - if t == EN { - setTypes(s.types[runStart:runEnd], EN) + for i := 0; i < len(s.types); i++ { + if s.types[i] != ET { + continue + } + // locate end of sequence + runStart := i + runEnd := s.findRunLimit(runStart, ET) + + // check values at ends of sequence + t := s.sos + if runStart > 0 { + t = s.types[runStart-1] + } + if t != EN { + t = s.eos + if runEnd < len(s.types) { + t = s.types[runEnd] } - // continue at end of sequence - i = runEnd } + if t == EN { + setTypes(s.types[runStart:runEnd], EN) + } + // continue at end of sequence + i = runEnd } // Rule W6. @@ -576,20 +570,13 @@ func (s *isolatingRunSequence) resolveWeakTypes() { } // Rule W7. + prevStrongType := s.sos for i, t := range s.types { - if t == EN { - // set default if we reach start of run - prevStrongType := s.sos - for j := i - 1; j >= 0; j-- { - t = s.types[j] - if t == L || t == R { // AL's have been changed to R - prevStrongType = t - break - } - } - if prevStrongType == L { - s.types[i] = L - } + switch { + case t == L || t == R: // AL's have been changed to R + prevStrongType = t + case t == EN && prevStrongType == L: + s.types[i] = L } } } diff --git a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go index 7b90bc9235..5b0e3b47e3 100644 --- a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go +++ b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go @@ -2,63 +2,44 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package gcexportdata provides functions for reading and writing -// export data, which is a serialized description of the API of a Go -// package including the names, kinds, types, and locations of all -// exported declarations. -// -// The standard Go compiler (cmd/compile) writes an export data file -// for each package it compiles, which it later reads when compiling -// packages that import the earlier one. The compiler must thus -// contain logic to both write and read export data. -// (See the "Export" section in the cmd/compile/README file.) -// -// The [Read] function in this package can read files produced by the -// compiler, producing [go/types] data structures. As a matter of -// policy, Read supports export data files produced by only the last -// two Go releases plus tip; see https://go.dev/issue/68898. The -// export data files produced by the compiler contain additional -// details related to generics, inlining, and other optimizations that -// cannot be decoded by the [Read] function. -// -// In files written by the compiler, the export data is not at the -// start of the file. Before calling Read, use [NewReader] to locate -// the desired portion of the file. -// -// The [Write] function in this package encodes the exported API of a -// Go package ([types.Package]) as a file. Such files can be later -// decoded by Read, but cannot be consumed by the compiler. -// -// # Future changes -// -// Although Read supports the formats written by both Write and the -// compiler, the two are quite different, and there is an open -// proposal (https://go.dev/issue/69491) to separate these APIs. -// -// Under that proposal, this package would ultimately provide only the -// Read operation for compiler export data, which must be defined in -// this module (golang.org/x/tools), not in the standard library, to -// avoid version skew for developer tools that need to read compiler -// export data both before and after a Go release, such as from Go -// 1.23 to Go 1.24. Because this package lives in the tools module, -// clients can update their version of the module some time before the -// Go 1.24 release and rebuild and redeploy their tools, which will -// then be able to consume both Go 1.23 and Go 1.24 export data files, -// so they will work before and after the Go update. (See discussion -// at https://go.dev/issue/15651.) -// -// The operations to import and export [go/types] data structures -// would be defined in the go/types package as Import and Export. -// [Write] would (eventually) delegate to Export, -// and [Read], when it detects a file produced by Export, -// would delegate to Import. +// Package gcexportdata provides functions for writing and reading +// export data, a serialized representation of a [types.Package]. +// It describes the API of a Go package, including the names, +// kinds, types, and locations of all exported declarations. +// +// Files may be written and read using the [Write] and [Read] +// functions. +// Alternatively, files may be produced by the "go list -export" command. +// This command runs the type checker on each specified Go package and +// writes export data for each package into a file named by the Export +// field of go list's -json output. +// The [Read] function may then be used to read those files. +// +// The export data format evolves with each Go release. As a matter of +// policy, [Read] supports reading files produced by only the last two +// Go releases plus tip; see https://go.dev/issue/68898. +// +// The name of this package reflects its origins at a time when +// cmd/compile was named gc, and [Read] parsed export data +// from .a archives produced by the Go compiler. +// However, starting with go1.28, the format of the files +// produced by "go list -export" will diverge from the format +// used by the standard Go compiler. +// Consequently, this package will eventually stop being +// capable of reading those files. +// In the meantime, when using [Read] on a .a file written by the +// compiler, be aware that export data is not at the start of the file. +// Before calling Read, one must use [NewReader] to locate the export +// data section of the file. +// For more information on the compiler's export data, see the +// "Export" section in the GOROOT/src/cmd/compile/README file. // // # Deprecations // -// The [NewImporter] and [Find] functions are deprecated and should -// not be used in new code. The [WriteBundle] and [ReadBundle] -// functions are experimental, and there is an open proposal to -// deprecate them (https://go.dev/issue/69573). +// The [NewImporter], [Find], and [NewReader] functions are deprecated +// and should not be used in new code. +// The [WriteBundle] and [ReadBundle] functions are experimental, and +// there is an open proposal to deprecate them (https://go.dev/issue/69573). package gcexportdata import ( @@ -101,11 +82,30 @@ func Find(importPath, srcDir string) (filename, path string) { return data.Export, data.ImportPath } -// NewReader returns a reader for the export data section of an object -// (.o) or archive (.a) file read from r. The new reader may provide -// additional trailing data beyond the end of the export data. +// NewReader returns a reader for export data read from r. Export data +// may be read from: +// +// - The export data section of an object (.o) or archive file (.a). +// In this case, the new reader may provide additional trailing data +// beyond the end of the export data. +// - The output of the cmd/export tool (e.g. via "go list -export"). +// In this case, the new reader contains no trailing data. +// +// Deprecated: This package will stop supporting the reading of export +// data from compiler-produced archive files in Go 1.29. To read +// cmd/export files, use [Read] directly instead. func NewReader(r io.Reader) (io.Reader, error) { buf := bufio.NewReader(r) + peek, err := buf.Peek(1) + if err != nil { + return nil, err + } + if peek[0] == 'i' { + // We were given an output of cmd/export. The entire file is + // export data. + return buf, nil + } + size, err := gcimporter.FindExportData(buf) if err != nil { return nil, err @@ -176,16 +176,7 @@ func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package, case 'i': // indexed, produced by cmd/compile till go1.19, // and also by [Write]. - // - // If proposal #69491 is accepted, go/types - // serialization will be implemented by - // types.Export, to which Write would eventually - // delegate (explicitly dropping any pretence at - // inter-version Write-Read compatibility). - // This [Read] function would delegate to types.Import - // when it detects that the file was produced by Export. - _, pkg, err := gcimporter.IImportData(fset, imports, data[1:], path) - return pkg, err + return gcimporter.IImportData(fset, imports, data[1:], path) case 'u': // unified, produced by cmd/compile since go1.20 diff --git a/vendor/golang.org/x/tools/go/packages/golist.go b/vendor/golang.org/x/tools/go/packages/golist.go index 8e60cbbed7..8f66c35570 100644 --- a/vendor/golang.org/x/tools/go/packages/golist.go +++ b/vendor/golang.org/x/tools/go/packages/golist.go @@ -317,10 +317,17 @@ func (state *golistState) adhocPackage(pattern, query string) (*DriverResponse, if err != nil { return nil, err } - // If we get nothing back from `go list`, - // try to make this file into its own ad-hoc package. - // TODO(rstambler): Should this check against the original response? - if len(response.Packages) == 0 { + // Only .go files can form ad-hoc packages (command-line-arguments); + // non-Go files cannot be compiled as Go packages (golang.org/issue/54815). + if filepath.Ext(query) != ".go" { + return response, nil + } + + switch len(response.Packages) { + case 0: + // If we get nothing back from `go list`, + // try to make this file into its own ad-hoc package. + // TODO(rstambler): Should this check against the original response? response.Packages = append(response.Packages, &Package{ ID: "command-line-arguments", PkgPath: query, @@ -329,22 +336,23 @@ func (state *golistState) adhocPackage(pattern, query string) (*DriverResponse, Imports: make(map[string]*Package), }) response.Roots = append(response.Roots, "command-line-arguments") - } - // Handle special cases. - if len(response.Packages) == 1 { + + case 1: + // Handle special cases. // golang/go#33482: If this is a file= query for ad-hoc packages where // the file only exists on an overlay, and exists outside of a module, // add the file to the package and remove the errors. - if response.Packages[0].ID == "command-line-arguments" || - filepath.ToSlash(response.Packages[0].PkgPath) == filepath.ToSlash(query) { - if len(response.Packages[0].GoFiles) == 0 { + pkg := response.Packages[0] + if pkg.ID == "command-line-arguments" || + filepath.ToSlash(pkg.PkgPath) == filepath.ToSlash(query) { + if len(pkg.GoFiles) == 0 { filename := filepath.Join(pattern, filepath.Base(query)) // avoid recomputing abspath // TODO(matloob): check if the file is outside of a root dir? for path := range state.cfg.Overlay { if path == filename { - response.Packages[0].Errors = nil - response.Packages[0].GoFiles = []string{path} - response.Packages[0].CompiledGoFiles = []string{path} + pkg.Errors = nil + pkg.GoFiles = []string{path} + pkg.CompiledGoFiles = []string{path} } } } @@ -683,9 +691,14 @@ func (state *golistState) createDriverResponse(words ...string) (*DriverResponse if p.Error != nil { msg := strings.TrimSpace(p.Error.Err) // Trim to work around golang.org/issue/32363. - // Address golang.org/issue/35964 by appending import stack to error message. - if msg == "import cycle not allowed" && len(p.Error.ImportStack) != 0 { - msg += fmt.Sprintf(": import stack: %v", p.Error.ImportStack) + // Address golang.org/issue/35964 and golang.org/issue/38826 by appending import stack to error message. + // Address golang/go#38826 by removing " (test)" + if (msg == "import cycle not allowed" || msg == "import cycle not allowed in test") && len(p.Error.ImportStack) != 0 { + stack := make([]string, len(p.Error.ImportStack)) + for i, s := range p.Error.ImportStack { + stack[i] = strings.TrimSuffix(s, " (test)") + } + msg += fmt.Sprintf(": import stack: %v", stack) } pkg.Errors = append(pkg.Errors, Error{ Pos: p.Error.Pos, @@ -752,29 +765,27 @@ func (state *golistState) getPkgPath(dir string) (string, bool, error) { return "", false, err } + // A directory can be contained in multiple roots, for example when a + // replaced module is nested inside the main module. Choose the most + // specific root, breaking ties lexically for deterministic behavior. + var bestRoot, bestPath, bestRel string for rdir, rpath := range roots { - // Make sure that the directory is in the module, - // to avoid creating a path relative to another module. - if !strings.HasPrefix(dir, rdir) { - continue - } // TODO(matloob): This doesn't properly handle symlinks. r, err := filepath.Rel(rdir, dir) - if err != nil { + if err != nil || !filepath.IsLocal(r) { continue } - if rpath != "" { - // We choose only one root even though the directory even it can belong in multiple modules - // or GOPATH entries. This is okay because we only need to work with absolute dirs when a - // file is missing from disk, for instance when gopls calls go/packages in an overlay. - // Once the file is saved, gopls, or the next invocation of the tool will get the correct - // result straight from golist. - // TODO(matloob): Implement module tiebreaking? - return path.Join(rpath, filepath.ToSlash(r)), true, nil + if bestRoot == "" || len(rdir) > len(bestRoot) || len(rdir) == len(bestRoot) && rdir < bestRoot { + bestRoot, bestPath, bestRel = rdir, rpath, r } - return filepath.ToSlash(r), true, nil } - return "", false, nil + if bestRoot == "" { + return "", false, nil + } + if bestPath != "" { + return path.Join(bestPath, filepath.ToSlash(bestRel)), true, nil + } + return filepath.ToSlash(bestRel), true, nil } // absJoin absolutizes and flattens the lists of files. @@ -996,9 +1007,12 @@ func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer, return bytes.NewBufferString(output), nil } - // Workaround for #29280: go list -e has incorrect behavior when an ad-hoc package doesn't exist. + // Workaround for #29280 and #31344: go list -e has incorrect behavior when an ad-hoc package doesn't exist. // Note that the error message we look for in this case is different that the one looked for above. - if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "no such file or directory") { + // "no such file or directory" is emitted on Unix, + if len(stderr.String()) > 0 && (strings.Contains(stderr.String(), "no such file or directory") || // Unix + strings.Contains(stderr.String(), "The system cannot find the file specified") || // Windows ERROR_FILE_NOT_FOUND + strings.Contains(stderr.String(), "The system cannot find the path specified")) { // Windows ERROR_PATH_NOT_FOUND output := fmt.Sprintf(`{"ImportPath": "command-line-arguments","Incomplete": true,"Error": {"Pos": "","Err": %q}}`, strings.Trim(stderr.String(), "\n")) return bytes.NewBufferString(output), nil diff --git a/vendor/golang.org/x/tools/go/packages/golist_overlay.go b/vendor/golang.org/x/tools/go/packages/golist_overlay.go index d9d5a45cd4..8bd0f7fafd 100644 --- a/vendor/golang.org/x/tools/go/packages/golist_overlay.go +++ b/vendor/golang.org/x/tools/go/packages/golist_overlay.go @@ -31,8 +31,8 @@ func (state *golistState) determineRootDirs() (map[string]string, error) { } func (state *golistState) determineRootDirsModules() (map[string]string, error) { - // List all of the modules--the first will be the directory for the main - // module. Any replaced modules will also need to be treated as roots. + // List all of the modules. Main modules and replaced modules need to be + // treated as roots. // Editing files in the module cache isn't a great idea, so we don't // plan to ever support that. out, err := state.invokeGo("list", "-m", "-json", "all") @@ -46,8 +46,6 @@ func (state *golistState) determineRootDirsModules() (map[string]string, error) } } roots := map[string]string{} - modules := map[string]string{} - var i int for dec := json.NewDecoder(out); dec.More(); { mod := new(gocommand.ModuleJSON) if err := dec.Decode(mod); err != nil { @@ -59,13 +57,10 @@ func (state *golistState) determineRootDirsModules() (map[string]string, error) if err != nil { return nil, err } - modules[absDir] = mod.Path - // The first result is the main module. - if i == 0 || mod.Replace != nil && mod.Replace.Path != "" { + if mod.Main || mod.Replace != nil && mod.Replace.Path != "" { roots[absDir] = mod.Path } } - i++ } return roots, nil } diff --git a/vendor/golang.org/x/tools/go/packages/packages.go b/vendor/golang.org/x/tools/go/packages/packages.go index 1e5549abe4..5dadc1b0da 100644 --- a/vendor/golang.org/x/tools/go/packages/packages.go +++ b/vendor/golang.org/x/tools/go/packages/packages.go @@ -1508,7 +1508,7 @@ func (ld *loader) loadFromExportData(lpkg *loaderPackage) error { } defer f.Close() - // Read gc export data. + // Read gc or cmd/export export data. // // We don't currently support gccgo export data because all // underlying workspaces use the gc toolchain. (Even build diff --git a/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go b/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go index 9c7401c9ba..91add84944 100644 --- a/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go +++ b/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go @@ -31,8 +31,7 @@ import ( "strconv" "strings" "sync" - - "golang.org/x/tools/internal/typesinternal" + // This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. ) // TODO(adonovan): think about generic aliases. @@ -692,8 +691,13 @@ func (enc *Encoder) concreteMethod(meth *types.Func) (Path, bool) { return "", false } - _, named := typesinternal.ReceiverNamed(meth.Signature().Recv()) - if named == nil { + // Avoid dependency on typesinternal.RecvBase here. + t := meth.Signature().Recv().Type() + if ptr, ok := types.Unalias(t).(*types.Pointer); ok { + t = ptr.Elem() + } + named, ok := types.Unalias(t).(*types.Named) + if !ok { return "", false } diff --git a/vendor/golang.org/x/tools/internal/aliases/aliases.go b/vendor/golang.org/x/tools/internal/aliases/aliases.go deleted file mode 100644 index a4ae04bc71..0000000000 --- a/vendor/golang.org/x/tools/internal/aliases/aliases.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2024 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. - -package aliases - -import ( - "go/token" - "go/types" -) - -// New creates a new TypeName in Package pkg that -// is an alias for the type rhs. -func New(pos token.Pos, pkg *types.Package, name string, rhs types.Type, tparams []*types.TypeParam) *types.TypeName { - tname := types.NewTypeName(pos, pkg, name, nil) - types.NewAlias(tname, rhs).SetTypeParams(tparams) - return tname -} diff --git a/vendor/golang.org/x/tools/internal/gcimporter/bimport.go b/vendor/golang.org/x/tools/internal/gcimporter/bimport.go index 555ef626c0..3fca56c09b 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/bimport.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/bimport.go @@ -12,6 +12,7 @@ import ( "go/token" "go/types" "sync" + // This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. ) func errorf(format string, args ...any) { diff --git a/vendor/golang.org/x/tools/internal/gcimporter/exportdata.go b/vendor/golang.org/x/tools/internal/gcimporter/exportdata.go index 5662a311da..885369d426 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/exportdata.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/exportdata.go @@ -19,6 +19,7 @@ import ( "path/filepath" "strings" "sync" + // This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. ) // FindExportData positions the reader r at the beginning of the diff --git a/vendor/golang.org/x/tools/internal/gcimporter/gcimporter.go b/vendor/golang.org/x/tools/internal/gcimporter/gcimporter.go index 3dbd21d1b9..8c56f5d9d3 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/gcimporter.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/gcimporter.go @@ -28,6 +28,7 @@ import ( "go/types" "io" "os" + // This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. ) const ( @@ -95,6 +96,19 @@ func Import(fset *token.FileSet, packages map[string]*types.Package, path, srcDi defer rc.Close() buf := bufio.NewReader(rc) + peek, err := buf.Peek(1) + if err != nil { + return + } + if peek[0] == 'i' { + var data []byte // avoid redeclaring err + data, err = io.ReadAll(buf) + if err != nil { + return + } + pkg, err = IImportData(fset, packages, data[1:], path) + return + } data, err := ReadUnified(buf) if err != nil { err = fmt.Errorf("import %q: %v", path, err) diff --git a/vendor/golang.org/x/tools/internal/gcimporter/iexport.go b/vendor/golang.org/x/tools/internal/gcimporter/iexport.go index 686f171d3b..6bee3c413f 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/iexport.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/iexport.go @@ -242,6 +242,7 @@ import ( "strings" "golang.org/x/tools/go/types/objectpath" + // This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. ) // IExportShallow encodes "shallow" export data for the specified package. @@ -712,7 +713,7 @@ func (p *iexporter) doDecl(obj types.Object) { w.typ(obj.Type(), obj.Pkg()) case *types.Func: - sig, _ := obj.Type().(*types.Signature) + sig := obj.Type().(*types.Signature) if sig.Recv() != nil { // We shouldn't see methods in the package scope, // but the type checker may repair "func () F() {}" @@ -745,7 +746,7 @@ func (p *iexporter) doDecl(obj types.Object) { case *types.Const: w.tag(constTag) w.pos(obj.Pos()) - w.value(obj.Type(), obj.Val()) + w.value(obj.Type(), obj.Val(), obj.Pkg()) case *types.TypeName: t := obj.Type() @@ -822,7 +823,7 @@ func (p *iexporter) doDecl(obj types.Object) { m := named.Method(i) w.pos(m.Pos()) w.string(m.Name()) - sig, _ := m.Type().(*types.Signature) + sig := m.Type().(*types.Signature) if w.p.version >= iexportVersionGenericMethods && w.bool(sig.TypeParams().Len() > 0) { w.tparamList(obj.Name()+"."+m.Name(), sig.TypeParams(), obj.Pkg()) } @@ -970,9 +971,11 @@ func (w *exportWriter) qualifiedType(obj *types.TypeName) { // typ emits the specified type. // // Objects within the type (struct fields and interface methods) are -// qualified by pkg. It may be nil if the type cannot contain objects, -// such as the type of a constant. +// qualified by pkg. func (w *exportWriter) typ(t types.Type, pkg *types.Package) { + if pkg == nil { + pkg = w.p.localpkg + } w.data.uint64(w.p.typOff(t, pkg)) } @@ -1148,7 +1151,7 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { } w.pos(m.Pos()) w.string(m.Name()) - sig, _ := m.Type().(*types.Signature) + sig := m.Type().(*types.Signature) w.signature(sig) } @@ -1295,8 +1298,12 @@ func (w *exportWriter) param(obj types.Object) { w.typ(obj.Type(), obj.Pkg()) } -func (w *exportWriter) value(typ types.Type, v constant.Value) { - w.typ(typ, nil) +// only called for constants +func (w *exportWriter) value(typ types.Type, v constant.Value, pkg *types.Package) { + if pkg == nil { + pkg = w.p.localpkg + } + w.typ(typ, pkg) if w.p.version >= iexportVersionGo1_18 { w.int64(int64(v.Kind())) } diff --git a/vendor/golang.org/x/tools/internal/gcimporter/iimport.go b/vendor/golang.org/x/tools/internal/gcimporter/iimport.go index 7b1723e0fc..e91498828e 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/iimport.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/iimport.go @@ -21,8 +21,7 @@ import ( "strings" "golang.org/x/tools/go/types/objectpath" - "golang.org/x/tools/internal/aliases" - "golang.org/x/tools/internal/typesinternal" + // This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. ) type intReader struct { @@ -30,14 +29,6 @@ type intReader struct { path string } -func (r *intReader) int64() int64 { - i, err := binary.ReadVarint(r.Reader) - if err != nil { - errorf("import %q: read varint error: %v", r.path, err) - } - return i -} - func (r *intReader) uint64() uint64 { i, err := binary.ReadUvarint(r.Reader) if err != nil { @@ -101,12 +92,12 @@ const ( // and returns 0 and a reference to the package. // If the export data version is not recognized or the format is otherwise // compromised, an error is returned. -func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (int, *types.Package, error) { +func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (*types.Package, error) { pkgs, err := iimportCommon(fset, GetPackagesFromMap(imports), data, false, path, false, nil) if err != nil { - return 0, nil, err + return nil, err } - return 0, pkgs[0], nil + return pkgs[0], nil } // IImportBundle imports a set of packages from the serialized package bundle. @@ -574,8 +565,8 @@ func (r *importReader) obj(pkg *types.Package, name string) { if tag == genericAliasTag { tparams = r.tparamList() } - typ := r.typ() - obj := aliases.New(pos, pkg, name, typ, tparams) + obj := types.NewTypeName(pos, pkg, name, nil) + types.NewAlias(obj, r.typ()).SetTypeParams(tparams) markBlack(obj) // workaround for golang/go#69912 r.declare(obj) @@ -624,8 +615,13 @@ func (r *importReader) obj(pkg *types.Package, name string) { // If the receiver has any targs, set those as the // rparams of the method (since those are the // typeparams being used in the method sig/body). - _, recvNamed := typesinternal.ReceiverNamed(recv) - targs := recvNamed.TypeArgs() + // + // Avoid dependency on typesinternal.RecvBase here. + t := recv.Type() + if ptr, ok := types.Unalias(t).(*types.Pointer); ok { + t = ptr.Elem() + } + targs := types.Unalias(t).(*types.Named).TypeArgs() var rparams []*types.TypeParam if targs.Len() > 0 { rparams = make([]*types.TypeParam, targs.Len()) @@ -675,7 +671,7 @@ func (r *importReader) obj(pkg *types.Package, name string) { typ := r.typ() v := types.NewVar(pos, pkg, name, typ) - typesinternal.SetVarKind(v, typesinternal.PackageVar) + v.SetKind(types.PackageVar) r.declare(v) default: diff --git a/vendor/golang.org/x/tools/internal/gcimporter/predeclared.go b/vendor/golang.org/x/tools/internal/gcimporter/predeclared.go index 907c8557a5..a8bfa875fe 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/predeclared.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/predeclared.go @@ -7,6 +7,7 @@ package gcimporter import ( "go/types" "sync" + // This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. ) // predecl is a cache for the predeclared types in types.Universe. diff --git a/vendor/golang.org/x/tools/internal/gcimporter/support.go b/vendor/golang.org/x/tools/internal/gcimporter/support.go index 4af810dc41..28b176946a 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/support.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/support.go @@ -9,6 +9,7 @@ import ( "io" "strconv" "strings" + // This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. ) // Copy of $GOROOT/src/cmd/internal/archive.ReadHeader. diff --git a/vendor/golang.org/x/tools/internal/gcimporter/ureader.go b/vendor/golang.org/x/tools/internal/gcimporter/ureader.go index 5d3b7c867a..09e833ce53 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/ureader.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/ureader.go @@ -13,9 +13,8 @@ import ( "sort" "strings" - "golang.org/x/tools/internal/aliases" "golang.org/x/tools/internal/pkgbits" - "golang.org/x/tools/internal/typesinternal" + // This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. ) // A pkgReader holds the shared state for reading a unified IR package @@ -551,7 +550,9 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) { tparams = r.typeParamNames(false) } typ := r.typ() - declare(aliases.New(pos, objPkg, objName, typ, tparams)) + tname := types.NewTypeName(pos, objPkg, objName, nil) + types.NewAlias(tname, typ).SetTypeParams(tparams) + declare(tname) case pkgbits.ObjConst: pos := r.pos() @@ -588,7 +589,7 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) { sig := fn.Type().(*types.Signature) recv := types.NewVar(fn.Pos(), fn.Pkg(), "", named) - typesinternal.SetVarKind(recv, typesinternal.RecvVar) + recv.SetKind(types.RecvVar) methods[i] = types.NewFunc(fn.Pos(), fn.Pkg(), fn.Name(), types.NewSignatureType(recv, nil, nil, sig.Params(), sig.Results(), sig.Variadic())) } @@ -629,11 +630,26 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) { }) } - for i, n := 0, r.Len(); i < n; i++ { - named.AddMethod(r.method()) - } - if r.Version().Has(pkgbits.GenericMethods) { + // V4 (go1.27.0) emitted all non-generic methods + // before all generic ones, discarding source + // order: a bug (go.dev/issue/81188). + // V5 (go1.27.x) fixes it by emitting an explicit + // index along with each method. + type indexedMethod struct { + index int // (or -1 in V4) + fn *types.Func + } + + var methods []indexedMethod + + // ordinary methods + for range r.Len() { + idx, m := r.method() + methods = append(methods, indexedMethod{idx, m}) + } + + // generic methods for range r.Len() { // Careful: objIdx is used to read in package-scoped declarations, which // methods are not. Instead, decode it here. This makes it easier to @@ -648,11 +664,31 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) { pkg, name := r.selector() rtparams := r.typeParamNames(true) recv := r.param() + methodIdx := -1 + if r.Version().Has(pkgbits.PreserveMethodOrder) { + methodIdx = r.Len() + } tparams := r.typeParamNames(false) sig := r.signature(recv, rtparams, tparams) pr.retireReader(r) - named.AddMethod(types.NewFunc(pos, pkg, name, sig)) + methods = append(methods, indexedMethod{methodIdx, types.NewFunc(pos, pkg, name, sig)}) + } + + if r.Version().Has(pkgbits.PreserveMethodOrder) { + sort.Slice(methods, func(i, j int) bool { + return methods[i].index < methods[j].index + }) + } + + for _, m := range methods { + named.AddMethod(m.fn) + } + + } else { + for range r.Len() { + _, m := r.method() + named.AddMethod(m) } } @@ -660,7 +696,7 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) { pos := r.pos() typ := r.typ() v := types.NewVar(pos, objPkg, objName, typ) - typesinternal.SetVarKind(v, typesinternal.PackageVar) + v.SetKind(types.PackageVar) declare(v) } } @@ -766,8 +802,12 @@ func (r *reader) typeParamNames(isGenMeth bool) []*types.TypeParam { return tparams } -func (r *reader) method() *types.Func { +func (r *reader) method() (int, *types.Func) { r.Sync(pkgbits.SyncMethod) + idx := -1 + if r.Version().Has(pkgbits.PreserveMethodOrder) { + idx = r.Len() + } pos := r.pos() pkg, name := r.selector() @@ -775,7 +815,7 @@ func (r *reader) method() *types.Func { sig := r.signature(r.param(), rparams, nil) _ = r.pos() // TODO(mdempsky): Remove; this is a hacker for linker.go. - return types.NewFunc(pos, pkg, name, sig) + return idx, types.NewFunc(pos, pkg, name, sig) } func (r *reader) qualifiedIdent() (*types.Package, string) { return r.ident(pkgbits.SyncSym) } diff --git a/vendor/golang.org/x/tools/internal/pkgbits/codes.go b/vendor/golang.org/x/tools/internal/pkgbits/codes.go index f0cabde96e..21f44d9656 100644 --- a/vendor/golang.org/x/tools/internal/pkgbits/codes.go +++ b/vendor/golang.org/x/tools/internal/pkgbits/codes.go @@ -4,6 +4,8 @@ package pkgbits +// This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. + // A Code is an enum value that can be encoded into bitstreams. // // Code types are preferable for enum types, because they allow diff --git a/vendor/golang.org/x/tools/internal/pkgbits/decoder.go b/vendor/golang.org/x/tools/internal/pkgbits/decoder.go index c0aba26c48..f05e2696ee 100644 --- a/vendor/golang.org/x/tools/internal/pkgbits/decoder.go +++ b/vendor/golang.org/x/tools/internal/pkgbits/decoder.go @@ -15,6 +15,7 @@ import ( "os" "runtime" "strings" + // This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. ) // A PkgDecoder provides methods for decoding a package's Unified IR diff --git a/vendor/golang.org/x/tools/internal/pkgbits/doc.go b/vendor/golang.org/x/tools/internal/pkgbits/doc.go index c8a2796b5e..f5a9badf45 100644 --- a/vendor/golang.org/x/tools/internal/pkgbits/doc.go +++ b/vendor/golang.org/x/tools/internal/pkgbits/doc.go @@ -30,3 +30,5 @@ // // This is a copy of internal/pkgbits in the Go implementation. package pkgbits + +// This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. diff --git a/vendor/golang.org/x/tools/internal/pkgbits/encoder.go b/vendor/golang.org/x/tools/internal/pkgbits/encoder.go index c17a12399d..ac9c8e8b3f 100644 --- a/vendor/golang.org/x/tools/internal/pkgbits/encoder.go +++ b/vendor/golang.org/x/tools/internal/pkgbits/encoder.go @@ -13,6 +13,7 @@ import ( "math/big" "runtime" "strings" + // This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. ) // A PkgEncoder provides methods for encoding a package's Unified IR diff --git a/vendor/golang.org/x/tools/internal/pkgbits/reloc.go b/vendor/golang.org/x/tools/internal/pkgbits/reloc.go index fcdfb97ca9..99494aa31b 100644 --- a/vendor/golang.org/x/tools/internal/pkgbits/reloc.go +++ b/vendor/golang.org/x/tools/internal/pkgbits/reloc.go @@ -4,6 +4,8 @@ package pkgbits +// This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. + // A RelocKind indicates a particular section within a unified IR export. type RelocKind int32 diff --git a/vendor/golang.org/x/tools/internal/pkgbits/support.go b/vendor/golang.org/x/tools/internal/pkgbits/support.go index 50534a2955..b0011600d2 100644 --- a/vendor/golang.org/x/tools/internal/pkgbits/support.go +++ b/vendor/golang.org/x/tools/internal/pkgbits/support.go @@ -4,6 +4,7 @@ package pkgbits +// This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. import "fmt" func assert(b bool) { diff --git a/vendor/golang.org/x/tools/internal/pkgbits/sync.go b/vendor/golang.org/x/tools/internal/pkgbits/sync.go index 1520b73afb..4cf7f1ee39 100644 --- a/vendor/golang.org/x/tools/internal/pkgbits/sync.go +++ b/vendor/golang.org/x/tools/internal/pkgbits/sync.go @@ -8,6 +8,7 @@ import ( "fmt" "runtime" "strings" + // This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. ) // fmtFrames formats a backtrace for reporting reader/writer desyncs. diff --git a/vendor/golang.org/x/tools/internal/pkgbits/version.go b/vendor/golang.org/x/tools/internal/pkgbits/version.go index 0db9652748..932a92679b 100644 --- a/vendor/golang.org/x/tools/internal/pkgbits/version.go +++ b/vendor/golang.org/x/tools/internal/pkgbits/version.go @@ -4,6 +4,8 @@ package pkgbits +// This package is dependency-restricted; see x/tools/go/gcexportdata.TestDeps. + // Version indicates a version of a unified IR bitstream. // Each Version indicates the addition, removal, or change of // new data in the bitstream. @@ -37,6 +39,10 @@ const ( // V4: encodes generic methods as standalone function objects V4 + // V5: encodes the index of methods to preserve relative order + // of nongeneric and generic methods (go.dev/issue/81188). + V5 + numVersions = iota ) @@ -76,6 +82,10 @@ const ( // Generic methods may appear as standalone function objects. GenericMethods + // Method index is encoded to preserve relative order of + // nongeneric and generic methods. + PreserveMethodOrder + numFields = iota ) @@ -85,6 +95,7 @@ var introduced = [numFields]Version{ AliasTypeParamNames: V2, CompactCompLiterals: V3, GenericMethods: V4, + PreserveMethodOrder: V5, } // removed is the version a field was removed in or 0 for fields diff --git a/vendor/golang.org/x/tools/internal/stdlib/deps.go b/vendor/golang.org/x/tools/internal/stdlib/deps.go index b049e5f977..abd3c8754b 100644 --- a/vendor/golang.org/x/tools/internal/stdlib/deps.go +++ b/vendor/golang.org/x/tools/internal/stdlib/deps.go @@ -44,7 +44,7 @@ var deps = [...]pkginfo{ {"crypto/internal/boring/bcache", "\xcf\x02\x14"}, {"crypto/internal/boring/sig", ""}, {"crypto/internal/constanttime", ""}, - {"crypto/internal/cryptotest", "\x03\r\v\n%\x11\x1a\r\x12\x12!\x04\x06\n\x19\x01\x11\x11\x1d\x01\a\x03\x02\b\x02\x01\x05\f"}, + {"crypto/internal/cryptotest", "\x03\r\v\n%\x11\x1a\r\x12\x12!\x04\x06\n\x19\x01\x11\x11\x1d\x01\a\x03\x02\b\x02\x01\x04\x01\f"}, {"crypto/internal/cryptotest/wycheproof", "\x0e\x12T\x01\f\x01r@\x05\x03\x15\x10"}, {"crypto/internal/cryptotest/x509limbo", "u\n\x03\xba\x01\x03\x1e"}, {"crypto/internal/entropy", "M"}, @@ -122,7 +122,7 @@ var deps = [...]pkginfo{ {"embed/internal/embedtest", ""}, {"encoding", ""}, {"encoding/ascii85", "\x86\x02E"}, - {"encoding/asn1", "\x03|\x03h(\x01)\r\x02\x01\x11\x03\x01"}, + {"encoding/asn1", "\x03|\x03h(\x01)\x05\b\x02\x01\x11\x03\x01"}, {"encoding/base32", "\x86\x02C\x02"}, {"encoding/base64", "\xaa\x01\\C\x02"}, {"encoding/binary", "\x7f\x87\x01\f*\r\x05"}, @@ -319,7 +319,7 @@ var deps = [...]pkginfo{ {"net/rpc/jsonrpc", "u\n\x03\x84\x01\x16\x13\x1f"}, {"net/smtp", "\x196\r\x14\x0f\x03\x84\x01\x16\x16\x1a"}, {"net/textproto", "\x02\x01|\x03\x84\x01\f\n/\x01\x02\x15"}, - {"net/url", "\x7f\x03Ff\v\x10\x02\x01\x17"}, + {"net/url", "\x03|\x03Ff\v\x10\x02\x01\x17"}, {"os", "\x7f*\x01\x19\x04\x11\x14\x01\x03\x01\x05\x10\x01:\b\x05\x01\x01\r\x06"}, {"os/exec", "\x03\nrI(\x01\x15\x01-\x06\a\n\x01\x03\x01\r"}, {"os/exec/internal/fdtest", "\xd0\x02"}, diff --git a/vendor/golang.org/x/tools/internal/typesinternal/isnamed.go b/vendor/golang.org/x/tools/internal/typesinternal/isnamed.go index e0d63c46c6..9af27f80b9 100644 --- a/vendor/golang.org/x/tools/internal/typesinternal/isnamed.go +++ b/vendor/golang.org/x/tools/internal/typesinternal/isnamed.go @@ -60,12 +60,10 @@ func IsFunctionNamed(obj types.Object, pkgPath string, names ...string) bool { // which is important for the performance of syntax matching. func IsMethodNamed(obj types.Object, pkgPath string, typeName string, names ...string) bool { if fn, ok := obj.(*types.Func); ok { - if recv := fn.Signature().Recv(); recv != nil { - _, T := ReceiverNamed(recv) - return T != nil && - IsTypeNamed(T, pkgPath, typeName) && - slices.Contains(names, fn.Name()) - } + _, T := RecvBase(fn) + return T != nil && + IsTypeNamed(T, pkgPath, typeName) && + slices.Contains(names, fn.Name()) } return false } diff --git a/vendor/golang.org/x/tools/internal/typesinternal/recv.go b/vendor/golang.org/x/tools/internal/typesinternal/recv.go index 8352ea7617..564e93b10e 100644 --- a/vendor/golang.org/x/tools/internal/typesinternal/recv.go +++ b/vendor/golang.org/x/tools/internal/typesinternal/recv.go @@ -8,19 +8,32 @@ import ( "go/types" ) -// ReceiverNamed returns the named type (if any) associated with the -// type of recv, which may be of the form N or *N, or aliases thereof. -// It also reports whether a Pointer was present. +// RecvBase returns the receiver base type (if any) of the method fn, +// and reports whether the receiver is a pointer to it. // -// The named result may be nil if recv is from a method on an -// anonymous interface or struct types or in ill-typed code. -func ReceiverNamed(recv *types.Var) (isPtr bool, named *types.Named) { - t := recv.Type() - if ptr, ok := types.Unalias(t).(*types.Pointer); ok { - isPtr = true - t = ptr.Elem() +// The spec says of a method declaration: the receiver's "type must be +// a defined type T or a pointer to a defined type T, possibly followed +// by a list of type parameter names [P1, P2, …] enclosed in square +// brackets. T is called the receiver base type." +// +// The named result is nil if fn is not a method, or if its receiver +// is an anonymous interface or struct type, as in interface{ f() }. +// +// TODO(adonovan): go.dev/issue/81715 proposes this as a method of *types.Func. +func RecvBase(fn *types.Func) (isPtr bool, named *types.Named) { + // The boolean result appears first to + // avoid misinterpretation as an 'ok' + // bool, and because that's the natural + // reading order in "*Named". + + if recv := fn.Signature().Recv(); recv != nil { + t := recv.Type() + if ptr, ok := types.Unalias(t).(*types.Pointer); ok { + isPtr = true + t = ptr.Elem() + } + named, _ = types.Unalias(t).(*types.Named) } - named, _ = types.Unalias(t).(*types.Named) return } diff --git a/vendor/golang.org/x/tools/internal/typesinternal/types.go b/vendor/golang.org/x/tools/internal/typesinternal/types.go index 9fd48b088f..b916df2250 100644 --- a/vendor/golang.org/x/tools/internal/typesinternal/types.go +++ b/vendor/golang.org/x/tools/internal/typesinternal/types.go @@ -9,7 +9,7 @@ // - functions for converting types to strings or syntax (e.g. [TypeExpr], FileQualifier]); // - helpers for working with the [go/types] API (e.g. [NewTypesInfo]); // - access to internal go/types APIs that are not yet -// exported (e.g. [SetUsesCgo], [ErrorCodeStartEnd], [VarKind]); and +// exported (e.g. [SetUsesCgo], [ErrorCodeStartEnd]); and // - common algorithms related to types (e.g. [TooNewStdSymbols]). // // See also: @@ -215,17 +215,17 @@ func ObjectKind(obj types.Object) string { } case *types.Var: switch obj.Kind() { - case PackageVar: + case types.PackageVar: return "package-level variable" - case LocalVar: + case types.LocalVar: return "local variable" - case RecvVar: + case types.RecvVar: return "receiver" - case ParamVar: + case types.ParamVar: return "parameter" - case ResultVar: + case types.ResultVar: return "result variable" - case FieldVar: + case types.FieldVar: return "struct field" } case *types.Func: @@ -271,6 +271,8 @@ func ImplicitFieldSelections(seln types.Selection) iter.Seq2[*types.Var, bool] { } } +// TupleOf returns a tuple type with the specified list of (unnamed) +// var types. Neither the zero nor one cases are special. func TupleOf(elems ...types.Type) *types.Tuple { params := make([]*types.Var, len(elems)) for i, elem := range elems { diff --git a/vendor/golang.org/x/tools/internal/typesinternal/varkind.go b/vendor/golang.org/x/tools/internal/typesinternal/varkind.go deleted file mode 100644 index 26499cdd2e..0000000000 --- a/vendor/golang.org/x/tools/internal/typesinternal/varkind.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2024 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. - -//go:build go1.25 - -package typesinternal - -import "go/types" - -type VarKind = types.VarKind - -const ( - PackageVar = types.PackageVar - LocalVar = types.LocalVar - RecvVar = types.RecvVar - ParamVar = types.ParamVar - ResultVar = types.ResultVar - FieldVar = types.FieldVar -) - -func GetVarKind(v *types.Var) VarKind { return v.Kind() } -func SetVarKind(v *types.Var, kind VarKind) { v.SetKind(kind) } diff --git a/vendor/golang.org/x/tools/internal/typesinternal/varkind_go124.go b/vendor/golang.org/x/tools/internal/typesinternal/varkind_go124.go deleted file mode 100644 index 17b1804b4e..0000000000 --- a/vendor/golang.org/x/tools/internal/typesinternal/varkind_go124.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2024 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. - -//go:build !go1.25 - -package typesinternal - -import "go/types" - -type VarKind uint8 - -const ( - _ VarKind = iota // (not meaningful) - PackageVar // a package-level variable - LocalVar // a local variable - RecvVar // a method receiver variable - ParamVar // a function parameter variable - ResultVar // a function result variable - FieldVar // a struct field -) - -func (kind VarKind) String() string { - return [...]string{ - 0: "VarKind(0)", - PackageVar: "PackageVar", - LocalVar: "LocalVar", - RecvVar: "RecvVar", - ParamVar: "ParamVar", - ResultVar: "ResultVar", - FieldVar: "FieldVar", - }[kind] -} - -// GetVarKind returns an invalid VarKind. -func GetVarKind(v *types.Var) VarKind { return 0 } - -// SetVarKind has no effect. -func SetVarKind(v *types.Var, kind VarKind) {} diff --git a/vendor/modules.txt b/vendor/modules.txt index 907424b310..c62537d5f0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -780,7 +780,7 @@ go.mongodb.org/mongo-driver/x/bsonx/bsoncore # go4.org v0.0.0-20230225012048-214862532bf5 ## explicit; go 1.13 go4.org/readerutil -# golang.org/x/crypto v0.57.0 +# golang.org/x/crypto v0.58.0 ## explicit; go 1.26.0 golang.org/x/crypto/acme golang.org/x/crypto/acme/autocert @@ -803,7 +803,7 @@ golang.org/x/crypto/ssh/knownhosts # golang.org/x/mod v0.41.0 ## explicit; go 1.26.0 golang.org/x/mod/semver -# golang.org/x/net v0.60.0 +# golang.org/x/net v0.62.0 ## explicit; go 1.26.0 golang.org/x/net/context golang.org/x/net/http/httpguts @@ -815,10 +815,10 @@ golang.org/x/net/internal/httpcommon golang.org/x/net/internal/httpsfv golang.org/x/net/internal/socks golang.org/x/net/proxy -# golang.org/x/sync v0.23.0 +# golang.org/x/sync v0.24.0 ## explicit; go 1.26.0 golang.org/x/sync/errgroup -# golang.org/x/sys v0.48.0 +# golang.org/x/sys v0.49.0 ## explicit; go 1.26.0 golang.org/x/sys/cpu golang.org/x/sys/execabs @@ -826,10 +826,10 @@ golang.org/x/sys/plan9 golang.org/x/sys/unix golang.org/x/sys/windows golang.org/x/sys/windows/registry -# golang.org/x/term v0.46.0 +# golang.org/x/term v0.47.0 ## explicit; go 1.26.0 golang.org/x/term -# golang.org/x/text v0.42.0 +# golang.org/x/text v0.43.0 ## explicit; go 1.26.0 golang.org/x/text/cases golang.org/x/text/encoding @@ -851,14 +851,13 @@ golang.org/x/text/width # golang.org/x/time v0.15.0 ## explicit; go 1.25.0 golang.org/x/time/rate -# golang.org/x/tools v0.49.0 -## explicit; go 1.25.0 +# golang.org/x/tools v0.51.0 +## explicit; go 1.26.0 golang.org/x/tools/go/ast/edge golang.org/x/tools/go/ast/inspector golang.org/x/tools/go/gcexportdata golang.org/x/tools/go/packages golang.org/x/tools/go/types/objectpath -golang.org/x/tools/internal/aliases golang.org/x/tools/internal/event golang.org/x/tools/internal/event/core golang.org/x/tools/internal/event/keys From 30aa801eea11a05fc799eb76084a61efe8448355 Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Thu, 29 Oct 2026 10:47:45 -0500 Subject: [PATCH 2/7] Don't search every namespace when publishing a new ingredient without one state publish --editor outside a project has no namespace until the editor fills it in, so Run searched every namespace for the name derived from the file. Logged in, that search took long enough to time out ("Could not search for ingredient"), so the editor never opened. This is why the "New ingredient with editor flag" integration test has failed nightly on master since at least September. Its first match could also be any ingredient with that name. Skip the lookup for a new ingredient without a namespace; confirmRequest requires one and checkNamespaceEdit checks the version once it is filled in. --edit still searches, since it needs to find the ingredient. Co-Authored-By: Claude Opus 5.5 --- changelog.md | 2 ++ internal/runners/publish/publish.go | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 4ee3a59f75..3bfe16d33a 100644 --- a/changelog.md +++ b/changelog.md @@ -36,6 +36,8 @@ and this project adheres to latest version. - `state export ingredient-meta` now writes plain YAML without help comments or line wrapping, so its output can be passed back with `--meta` as is. +- `state publish` of a new ingredient without a namespace (such as with `--editor` outside a project) no longer searches + every namespace for its name, which could time out with "Could not search for ingredient" before the editor opened. - Dependencies and conditions without a version range (such as a bare `requests` in `pyproject.toml`) are now published as accepting any version instead of failing with "Expecting an OBJECT with a field named 'versionRequirements'". - Fields removed in the `state publish --editor` file are now removed from the publish instead of keeping their diff --git a/internal/runners/publish/publish.go b/internal/runners/publish/publish.go index fe57a9b123..28a9c8c984 100644 --- a/internal/runners/publish/publish.go +++ b/internal/runners/publish/publish.go @@ -171,6 +171,10 @@ func (r *Runner) Run(params *Params) error { reqVars.Name = name } + // A new ingredient without a namespace yet has nothing to look up: a search across every namespace can time out, + // and its first match could be any ingredient with this name. The namespace is checked once it is filled in. + lookup := reqVars.Namespace != "" || params.Edit + var ingredient *ParentIngredient latestRevisionTime, err := model.FetchLatestRevisionTimeStamp(r.auth) @@ -179,7 +183,7 @@ func (r *Runner) Run(params *Params) error { } isRevision := false - if params.Version != "" { + if lookup && params.Version != "" { // Attempt to get the version if it already exists, it not existing is not an error though i, err := model.GetIngredientByNameAndVersion(reqVars.Namespace, reqVars.Name, params.Version, &latestRevisionTime, r.auth) if err != nil { @@ -193,7 +197,7 @@ func (r *Runner) Run(params *Params) error { } } - if ingredient == nil { + if lookup && ingredient == nil { // Attempt to find the existing ingredient, if we didn't already get it from the version specific call above ingredients, err := model.SearchIngredientsStrict(reqVars.Namespace, reqVars.Name, true, false, &latestRevisionTime, r.auth) var errSearch404 *model.ErrSearch404 From 4a1fa626ad8608eec1ac6697ac1b9a5fbedf9296 Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Thu, 29 Oct 2026 12:36:08 -0500 Subject: [PATCH 3/7] Let state publish --editor continue when no editor can be opened Without EDITOR set and without xdg-open, as on many headless Linux machines and the ubuntu-24.04-arm runner, OpenEditor fails and publish exited with "Could not publish ingredient. Error received: ", even though the notice just before it says the file can be edited by hand. Say that no editor could be opened and wait for the confirmation as usual instead. Co-Authored-By: Claude Opus 5.5 --- changelog.md | 3 +++ internal/runners/publish/confirm_test.go | 17 +++++++++++++++++ internal/runners/publish/publish.go | 7 +++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 3bfe16d33a..34aeb6166b 100644 --- a/changelog.md +++ b/changelog.md @@ -38,6 +38,9 @@ and this project adheres to passed back with `--meta` as is. - `state publish` of a new ingredient without a namespace (such as with `--editor` outside a project) no longer searches every namespace for its name, which could time out with "Could not search for ingredient" before the editor opened. +- `state publish --editor` no longer fails with "Could not publish ingredient. Error received: " when no editor + can be opened (no `EDITOR` set and no `xdg-open`, as on many headless machines). It says so and waits for the file to + be edited by hand instead. - Dependencies and conditions without a version range (such as a bare `requests` in `pyproject.toml`) are now published as accepting any version instead of failing with "Expecting an OBJECT with a field named 'versionRequirements'". - Fields removed in the `state publish --editor` file are now removed from the publish instead of keeping their diff --git a/internal/runners/publish/confirm_test.go b/internal/runners/publish/confirm_test.go index 78f7b22e79..c6d097fa8d 100644 --- a/internal/runners/publish/confirm_test.go +++ b/internal/runners/publish/confirm_test.go @@ -106,6 +106,23 @@ func TestConfirmRequestFillsVersionRequirements(t *testing.T) { } } +func TestOpenInEditorWithoutEditor(t *testing.T) { + t.Setenv("EDITOR", filepath.Join(t.TempDir(), "no-such-editor")) + out := outputhelper.NewCatcher() + r := &Runner{out: out, prompt: &fakePrompter{}} + reqVars := newRequest() + + if err := r.OpenInEditor(reqVars); err != nil { + t.Fatalf("OpenInEditor failed without an editor instead of waiting for the file to be edited: %v", err) + } + if reqVars.Name != newRequest().Name { + t.Errorf("name = %q, want it unchanged", reqVars.Name) + } + if !strings.Contains(out.CombinedOutput(), "Could not open an editor") { + t.Errorf("output does not say the editor could not be opened:\n%s", out.CombinedOutput()) + } +} + func TestConfirmRequestEditor(t *testing.T) { t.Run("removed fields are removed", func(t *testing.T) { useTestEditor(t, "name: mypkg\nnamespace: private/org/python\nversion: 1.0.0\n") diff --git a/internal/runners/publish/publish.go b/internal/runners/publish/publish.go index 28a9c8c984..12c5ce6990 100644 --- a/internal/runners/publish/publish.go +++ b/internal/runners/publish/publish.go @@ -662,9 +662,12 @@ func (r *Runner) OpenInEditor(pr *request.PublishVariables) error { r.out.Notice(locale.Tr("uploadingredient_editor_opening", fn)) - // Open file + // Open file. Without an editor (no $EDITOR and no xdg-open, as on many headless machines), the file can still be + // edited by hand, as the notice above says, so carry on to the confirmation instead of failing. if err := osutils.OpenEditor(fn); err != nil { - return locale.WrapError(err, "err_uploadingredient_publish", "Could not open publish request file") + logging.Debug("Could not open editor: %v", errs.JoinMessage(err)) + r.out.Notice(locale.Tl("uploadingredient_editor_open_failed", + "Could not open an editor, so edit the file above yourself, or set [ACTIONABLE]EDITOR[/RESET] to the editor to use.")) } // Wait for confirmation From df4e0d1c2d6cadce3a18d04b0efa93fbd08a93ad Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Thu, 29 Oct 2026 12:36:08 -0500 Subject: [PATCH 4/7] Fix integration tests that fail only because of the runner or branch name - TestPublishBuildEncrypted installs into a Python project that state init creates without a Linux/arm64 platform, so skip it there, like the other platform-specific skips. Integration tests only run on ARM for labelled PRs. - PerformanceIntegrationTestSuite's TearDownSuite stopped state-svc even when its tests were skipped by tag. On macOS a long branch channel makes the socket path too long to dial, so every labelled PR from such a branch failed there. Only stop the service when the Performance tests ran, using a new tagsuite.RunsForTags that OnlyRunForTags is now built on. Co-Authored-By: Claude Opus 5.5 --- internal/testhelpers/tagsuite/tagsuite.go | 16 +++++++++++----- test/integration/performance_svc_int_test.go | 3 +++ test/integration/publish_int_test.go | 4 ++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/internal/testhelpers/tagsuite/tagsuite.go b/internal/testhelpers/tagsuite/tagsuite.go index 04fd9c4a5d..faa895ef43 100644 --- a/internal/testhelpers/tagsuite/tagsuite.go +++ b/internal/testhelpers/tagsuite/tagsuite.go @@ -95,21 +95,27 @@ type Suite struct { suite.Suite } -// OnlyRunForTags skips a test unless one of the given tags is asked for. -func (suite *Suite) OnlyRunForTags(tags ...string) { +// RunsForTags reports whether tests for one of the given tags are asked for. +func RunsForTags(tags ...string) bool { setTagsString, _ := os.LookupEnv("TEST_SUITE_TAGS") setTags := strings.Split(strings.ToLower(setTagsString), ":") // if no tags are defined and we're not on CI; run the test if funk.Contains(setTags, "all") || (setTagsString == "" && !condition.OnCI()) { - return + return true } for _, tag := range tags { if funk.Contains(setTags, strings.ToLower(tag)) { - return + return true } } + return false +} - suite.T().Skipf("Run only if any of the following tags are set: %s", strings.Join(tags, ", ")) +// OnlyRunForTags skips a test unless one of the given tags is asked for. +func (suite *Suite) OnlyRunForTags(tags ...string) { + if !RunsForTags(tags...) { + suite.T().Skipf("Run only if any of the following tags are set: %s", strings.Join(tags, ", ")) + } } diff --git a/test/integration/performance_svc_int_test.go b/test/integration/performance_svc_int_test.go index 46f0ecf20d..837346161f 100644 --- a/test/integration/performance_svc_int_test.go +++ b/test/integration/performance_svc_int_test.go @@ -29,6 +29,9 @@ type PerformanceSvcIntegrationTestSuite struct { } func (suite *PerformanceIntegrationTestSuite) TearDownSuite() { + if !tagsuite.RunsForTags(tagsuite.Performance) { + return // no test started a service; a long branch channel's socket path can't even be dialed on macOS + } ipcClient := svcctl.NewDefaultIPCClient() err := svcctl.StopServer(ipcClient) suite.Require().NoError(err) diff --git a/test/integration/publish_int_test.go b/test/integration/publish_int_test.go index 1264eb56bd..f31ca7857a 100644 --- a/test/integration/publish_int_test.go +++ b/test/integration/publish_int_test.go @@ -7,6 +7,7 @@ import ( "os" "path/filepath" "regexp" + "runtime" "testing" "time" @@ -491,6 +492,9 @@ authors: // The ingredient is published under a unique, random name. Published private // ingredients cannot be deleted, so the name must never collide across runs. func (suite *PublishIntegrationTestSuite) TestPublishBuildEncrypted() { + if runtime.GOOS == "linux" && runtime.GOARCH == "arm64" { + suite.T().Skip("The Python project this installs into has no Linux/arm64 platform") + } suite.OnlyRunForTags(tagsuite.Publish) ts := e2e.New(suite.T(), false) From 83d7feb090e7a4d8f7724b3e3386a42025ed4799 Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Thu, 29 Oct 2026 12:50:32 -0500 Subject: [PATCH 5/7] Don't open a real editor in the publish --editor integration test The test writes its edits to the file itself, but with no EDITOR set, macOS `open` hands the file to whatever app the runner has registered. On macos-latest, publish then read the file back without the test's edits and failed with "You have to supply the namespace". Point EDITOR at a command that doesn't exist, so publish takes the "edit the file by hand" path on every OS. Co-Authored-By: Claude Opus 5.5 --- test/integration/publish_int_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/integration/publish_int_test.go b/test/integration/publish_int_test.go index f31ca7857a..f3544dc323 100644 --- a/test/integration/publish_int_test.go +++ b/test/integration/publish_int_test.go @@ -389,8 +389,11 @@ authors: args[k] = vp } + // The test edits the file itself, so make sure no real editor is opened: on macOS `open` hands it to + // whatever app the runner has registered, which can leave the file as it was. cp := ts.SpawnWithOpts( e2e.OptArgs(append([]string{"publish"}, args...)...), + e2e.OptAppendEnv("EDITOR=state-test-no-editor"), ) if inv.expect.immediateOutput != "" { From 3746b19c07a3119d62a2119f085475248bad6d62 Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Thu, 29 Oct 2026 13:21:04 -0500 Subject: [PATCH 6/7] Fix the publish --editor integration test's flaky file path match editorFileRx matched "file:\s*?(.*?)\.\s", whose lazy \s*? left the space after "file:" in the captured path whenever the temp file name had 9 digits instead of 10 (about one run in four). The test then wrote its edits to " /tmp/NNN.ingredient.yaml", a different file, so publish read the original back and failed with "You have to supply the namespace". The last commit's macOS explanation was wrong; this was the cause on every OS. Reproduced by driving a dev build through termtest 12 times: three runs captured the leading space before this change and none after. Co-Authored-By: Claude Opus 5.5 --- test/integration/publish_int_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration/publish_int_test.go b/test/integration/publish_int_test.go index f3544dc323..6de1511a9a 100644 --- a/test/integration/publish_int_test.go +++ b/test/integration/publish_int_test.go @@ -25,7 +25,7 @@ import ( "github.com/ActiveState/cli/pkg/platform/api/graphql/request" ) -var editorFileRx = regexp.MustCompile(`file:\s*?(.*?)\.\s`) +var editorFileRx = regexp.MustCompile(`file:\s*(.*?)\.\s`) type PublishIntegrationTestSuite struct { tagsuite.Suite @@ -389,8 +389,8 @@ authors: args[k] = vp } - // The test edits the file itself, so make sure no real editor is opened: on macOS `open` hands it to - // whatever app the runner has registered, which can leave the file as it was. + // The test edits the file itself, so make sure no real editor is opened: otherwise `open` or + // `xdg-open` hands it to whatever app the runner has registered, if any. cp := ts.SpawnWithOpts( e2e.OptArgs(append([]string{"publish"}, args...)...), e2e.OptAppendEnv("EDITOR=state-test-no-editor"), From a519911cf51af4307df3192cfd3d70d00b4ed538 Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Wed, 28 Oct 2026 18:37:37 -0500 Subject: [PATCH 7/7] Make the state publish meta data clearer to review and edit Follow-up to #3867 from testing the 0.48.2-RC2 build: - Without --namespace, a --build publish from a pyproject.toml now defaults to private//python (otherwise private/, as before). - A new ingredient's namespace can be changed in the editor. It is checked like --namespace and put back, with the reason, if it can't be used. - The confirmation and editor say up front which fields can't be changed and why, and the error for changing one names it. - The preview and editor show plain yaml without a help comment on every field; the fields are described in the publish guide instead. The yaml-comment module is no longer used and is removed. - state export ingredient-meta now includes the ingredient's description. state publish --edit no longer refuses a different description on an existing version: it keeps the current one and says the change is ignored. Co-Authored-By: Claude Opus 5.5 --- changelog.md | 14 +- go.mod | 2 - go.sum | 4 - internal/runners/export/ingredientmeta.go | 8 +- internal/runners/publish/confirm_test.go | 142 ++++++++- internal/runners/publish/meta.go | 25 +- internal/runners/publish/publish.go | 165 +++++++++-- internal/runners/publish/publish_test.go | 3 +- internal/runners/publish/readme.md | 33 ++- pkg/platform/api/graphql/request/publish.go | 21 +- vendor/github.com/maruel/natural/LICENSE | 201 ------------- vendor/github.com/maruel/natural/README.md | 50 ---- vendor/github.com/maruel/natural/natsort.go | 94 ------ .../zijiren233/yaml-comment/.gitignore | 21 -- .../zijiren233/yaml-comment/LICENSE | 21 -- .../zijiren233/yaml-comment/README.md | 37 --- .../zijiren233/yaml-comment/comment.go | 275 ------------------ vendor/modules.txt | 6 - 18 files changed, 344 insertions(+), 778 deletions(-) delete mode 100644 vendor/github.com/maruel/natural/LICENSE delete mode 100644 vendor/github.com/maruel/natural/README.md delete mode 100644 vendor/github.com/maruel/natural/natsort.go delete mode 100644 vendor/github.com/zijiren233/yaml-comment/.gitignore delete mode 100644 vendor/github.com/zijiren233/yaml-comment/LICENSE delete mode 100644 vendor/github.com/zijiren233/yaml-comment/README.md delete mode 100644 vendor/github.com/zijiren233/yaml-comment/comment.go diff --git a/changelog.md b/changelog.md index 34aeb6166b..da34c115e2 100644 --- a/changelog.md +++ b/changelog.md @@ -26,16 +26,26 @@ and this project adheres to it to a meta file to edit and publish later with `--meta`, instead of only cancelling. - When `state publish --build` cannot determine the ingredient name or version, the error now says which is missing, why `pyproject.toml` did not provide it (for example, a version listed in `[project].dynamic`), and how to set it. +- Without `--namespace`, `state publish --build` now defaults to `private//python` when the source has a + `pyproject.toml` (otherwise `private/`, as before). +- The namespace of a new ingredient can now be changed in the `state publish` editor. The new namespace is checked like + one passed with `--namespace`; if it can't be used, the previous one is kept and the reason is shown. The confirmation + and the editor now say up front which fields can't be changed and why, and when one of them is edited anyway (the + name or version with `--build`, or the namespace, name or version with `--edit`), the error names it. +- The ingredient meta data `state publish` shows for confirmation and opens in the editor no longer has a help comment + on each field. The fields are described in the publish guide instead. ### Fixed - `state publish --edit` no longer overwrites the meta file's dependencies and authors with the previous revision's, - keeps inherited dependency types and conditions, and rejects author or description changes on an existing version - up front. + keeps inherited dependency types and conditions, and rejects author changes on an existing version up front. - `state publish --edit --meta` with an exported meta file now edits the version named in the file rather than the latest version. - `state export ingredient-meta` now writes plain YAML without help comments or line wrapping, so its output can be passed back with `--meta` as is. +- `state export ingredient-meta` now includes the ingredient's description instead of leaving it empty. When + `state publish --edit` is given a different description for an existing version, it no longer refuses to publish: + the confirmation says the description can't be changed, shows the current one, and the change is ignored. - `state publish` of a new ingredient without a namespace (such as with `--editor` outside a project) no longer searches every namespace for its name, which could time out with "Could not search for ingredient" before the editor opened. - `state publish --editor` no longer fails with "Could not publish ingredient. Error received: " when no editor diff --git a/go.mod b/go.mod index f1db3695bc..5f71898ed4 100644 --- a/go.mod +++ b/go.mod @@ -76,7 +76,6 @@ require ( github.com/gowebpki/jcs v1.0.1 github.com/mark3labs/mcp-go v0.33.0 github.com/mholt/archives v0.1.5 - github.com/zijiren233/yaml-comment v0.2.1 ) require ( @@ -118,7 +117,6 @@ require ( github.com/klauspost/pgzip v1.2.6 // indirect github.com/kr/pty v1.1.8 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/maruel/natural v1.1.0 // indirect github.com/mattn/go-localereader v0.0.1 // indirect github.com/mikelolasagasti/xz v1.0.1 // indirect github.com/minio/minlz v1.0.1 // indirect diff --git a/go.sum b/go.sum index 4497782e6a..20b3ce1428 100644 --- a/go.sum +++ b/go.sum @@ -520,8 +520,6 @@ github.com/mark3labs/mcp-go v0.33.0 h1:naxhjnTIs/tyPZmWUZFuG0lDmdA6sUyYGGf3gsHvT github.com/mark3labs/mcp-go v0.33.0/go.mod h1:rXqOudj/djTORU/ThxYx8fqEVj/5pvTuuebQ2RC7uk4= github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= -github.com/maruel/natural v1.1.0 h1:2z1NgP/Vae+gYrtC0VuvrTJ6U35OuyUqDdfluLqMWuQ= -github.com/maruel/natural v1.1.0/go.mod h1:eFVhYCcUOfZFxXoDZam8Ktya72wa79fNC3lc/leA0DQ= github.com/mash/go-tempfile-suffix v0.0.0-20150731093933-48f0f8a3a5ab h1:2lWb5W+cZTlTIrJUuzVMrs6vcEvY0ydkkMH66EdPaqc= github.com/mash/go-tempfile-suffix v0.0.0-20150731093933-48f0f8a3a5ab/go.mod h1:oBJAJTenVXse2frk3J4anZ7funxla2ZdJHFQShkD43k= github.com/matryer/is v1.4.1 h1:55ehd8zaGABKLXQUe2awZ99BD/PTc2ls+KV/dXphgEQ= @@ -745,8 +743,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -github.com/zijiren233/yaml-comment v0.2.1 h1:/ymMfauuR6zPme+c59FvGNmvxmjOS+BRZSU9YEM82g4= -github.com/zijiren233/yaml-comment v0.2.1/go.mod h1:Cps/tIAJVNoG6TpNN1Aaht/O1QGthZzOgUMQXXTxlBs= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= diff --git a/internal/runners/export/ingredientmeta.go b/internal/runners/export/ingredientmeta.go index 7213ab0bb1..8f1db78d82 100644 --- a/internal/runners/export/ingredientmeta.go +++ b/internal/runners/export/ingredientmeta.go @@ -8,7 +8,6 @@ import ( "github.com/ActiveState/cli/internal/locale" "github.com/ActiveState/cli/internal/runners/publish" "github.com/ActiveState/cli/pkg/platform/api/graphql/request" - "gopkg.in/yaml.v3" ) type IngredientMetaParams struct { @@ -37,11 +36,10 @@ func (i *IngredientMeta) Run(params *IngredientMetaParams) error { return writeIngredientMeta(i.prime.Output().Config().OutWriter, meta) } -// writeIngredientMeta writes meta in the format --meta reads. It is plain yaml rather than meta.MarshalYaml, whose field -// help comments would end up in the file, and written as is: the outputer's Print would word-wrap long lines and -// interpret [TAGS]. +// writeIngredientMeta writes meta in the format --meta reads. It is written as is: the outputer's Print would word-wrap +// long lines and interpret [TAGS]. func writeIngredientMeta(w io.Writer, meta *request.PublishVariables) error { - b, err := yaml.Marshal(meta) + b, err := meta.MarshalYaml(false) if err != nil { return errs.Wrap(err, "Could not marshal ingredient meta data") } diff --git a/internal/runners/publish/confirm_test.go b/internal/runners/publish/confirm_test.go index c6d097fa8d..42fdea8c53 100644 --- a/internal/runners/publish/confirm_test.go +++ b/internal/runners/publish/confirm_test.go @@ -93,7 +93,7 @@ func TestConfirmRequestFillsVersionRequirements(t *testing.T) { r := &Runner{out: outputhelper.NewCatcher(), prompt: p} reqVars := newRequest() - publish, err := r.confirmRequest(reqVars, &Params{}, false) + publish, err := r.confirmRequest(reqVars, &Params{}, false, "") if err != nil || !publish { t.Fatalf("publish = %v, err = %v", publish, err) } @@ -104,6 +104,9 @@ func TestConfirmRequestFillsVersionRequirements(t *testing.T) { if !strings.Contains(p.messages[0], "versionRequirements: '>=0'") { t.Errorf("confirmation does not show the filled in requirements:\n%s", p.messages[0]) } + if strings.Contains(p.messages[0], "#") { + t.Errorf("confirmation shows comments:\n%s", p.messages[0]) + } } func TestOpenInEditorWithoutEditor(t *testing.T) { @@ -130,7 +133,7 @@ func TestConfirmRequestEditor(t *testing.T) { r := &Runner{out: outputhelper.NewCatcher(), prompt: p} reqVars := newRequest() - publish, err := r.confirmRequest(reqVars, &Params{}, false) + publish, err := r.confirmRequest(reqVars, &Params{}, false, "") if err != nil || !publish { t.Fatalf("publish = %v, err = %v", publish, err) } @@ -139,25 +142,110 @@ func TestConfirmRequestEditor(t *testing.T) { } }) - t.Run("cleared namespace is rejected", func(t *testing.T) { - useTestEditor(t, "name: mypkg\nversion: 1.0.0\n") + t.Run("namespace change is kept", func(t *testing.T) { + useTestEditor(t, "name: mypkg\nnamespace: private/org/other\nversion: 1.0.0\n") + p := &fakePrompter{confirms: []bool{false, true}, selects: []int{choiceEdit}} + r := &Runner{out: outputhelper.NewCatcher(), prompt: p, versionExists: noVersions} + reqVars := newRequest() + + publish, err := r.confirmRequest(reqVars, &Params{}, false, "") + if err != nil || !publish { + t.Fatalf("publish = %v, err = %v", publish, err) + } + if reqVars.Namespace != "private/org/other" { + t.Errorf("namespace = %q, want the edited one", reqVars.Namespace) + } + }) + + for name, tt := range map[string]struct { + namespace string + params Params + exists bool + reason string + }{ + "cleared namespace is put back": {"", Params{}, false, "namespace is required"}, + "namespace with the version is put back": {"private/org/other", Params{}, true, "already exists"}, + "namespace outside the org is put back": {"private/other/python", Params{Build: "src"}, false, "requires a namespace under"}, + } { + t.Run(name, func(t *testing.T) { + useTestEditor(t, "name: mypkg\nnamespace: "+tt.namespace+"\nversion: 1.0.0\n") + out := outputhelper.NewCatcher() + p := &fakePrompter{confirms: []bool{false, true}, selects: []int{choiceEdit}} + r := &Runner{out: out, prompt: p, versionExists: func(_, _, _ string) (bool, error) { return tt.exists, nil }} + reqVars := newRequest() + + publish, err := r.confirmRequest(reqVars, &tt.params, false, "") + if err != nil || !publish { + t.Fatalf("publish = %v, err = %v", publish, err) + } + if reqVars.Namespace != "private/org/python" { + t.Errorf("namespace = %q, want the original one put back", reqVars.Namespace) + } + if !strings.Contains(out.CombinedOutput(), tt.reason) { + t.Errorf("output does not explain why (%q):\n%s", tt.reason, out.CombinedOutput()) + } + }) + } + + t.Run("name change with --build is saved instead", func(t *testing.T) { + t.Chdir(t.TempDir()) + useTestEditor(t, "name: otherpkg\nnamespace: private/org/python\nversion: 1.0.0\n") p := &fakePrompter{confirms: []bool{false}, selects: []int{choiceEdit}} r := &Runner{out: outputhelper.NewCatcher(), prompt: p} - _, err := r.confirmRequest(newRequest(), &Params{}, false) - if err == nil || !strings.Contains(err.Error(), "namespace") { - t.Errorf("err = %v, want the namespace error", err) + _, err := r.confirmRequest(newRequest(), &Params{Build: "src"}, false, "") + if err == nil || !strings.Contains(err.Error(), "The name can't be changed") { + t.Fatalf("err = %v, want the name named as fixed", err) + } + if !strings.Contains(p.messages[0], "name and version are built into the package") { + t.Errorf("confirmation does not say up front what is fixed:\n%s", p.messages[0]) + } + if _, err := os.Stat("otherpkg-1.0.0.meta.yaml"); err != nil { + t.Errorf("edits were not saved: %v", err) } }) - t.Run("description added on a revision is rejected", func(t *testing.T) { - useTestEditor(t, "name: mypkg\nnamespace: private/org/python\nversion: 1.0.0\ndescription: changed\n") + t.Run("namespace change with --edit is saved instead", func(t *testing.T) { + t.Chdir(t.TempDir()) + useTestEditor(t, "name: mypkg\nnamespace: private/org/other\nversion: 1.0.0\n") p := &fakePrompter{confirms: []bool{false}, selects: []int{choiceEdit}} r := &Runner{out: outputhelper.NewCatcher(), prompt: p} - _, err := r.confirmRequest(newRequest(), &Params{Edit: true}, true) - if err == nil || !strings.Contains(err.Error(), "cannot be changed") { - t.Errorf("err = %v, want the identity error", err) + _, err := r.confirmRequest(newRequest(), &Params{Edit: true}, true, "") + if err == nil || !strings.Contains(err.Error(), "The namespace can't be changed") { + t.Errorf("err = %v, want the namespace named as fixed", err) + } + }) + + t.Run("changed description on a revision is ignored", func(t *testing.T) { + useTestEditor(t, "name: mypkg\nnamespace: private/org/python\nversion: 1.0.0\ndescription: changed\n") + p := &fakePrompter{confirms: []bool{false, true}, selects: []int{choiceEdit}} + r := &Runner{out: outputhelper.NewCatcher(), prompt: p} + reqVars := newRequest() + + publish, err := r.confirmRequest(reqVars, &Params{Edit: true}, true, "current") + if err != nil || !publish { + t.Fatalf("publish = %v, err = %v, want it still published", publish, err) + } + if reqVars.Description != "current" { + t.Errorf("description = %q, want the current one kept", reqVars.Description) + } + if !strings.Contains(p.messages[1], "changed[/RESET]' is ignored and it stays '[ACTIONABLE]current") { + t.Errorf("confirmation does not say the change is ignored:\n%s", p.messages[1]) + } + }) + + t.Run("unchanged description on a revision is accepted", func(t *testing.T) { + useTestEditor(t, "name: mypkg\nnamespace: private/org/python\nversion: 1.0.0\ndescription: current\n") + p := &fakePrompter{confirms: []bool{false, true}, selects: []int{choiceEdit}} + r := &Runner{out: outputhelper.NewCatcher(), prompt: p} + + publish, err := r.confirmRequest(newRequest(), &Params{Edit: true}, true, "current") + if err != nil || !publish { + t.Errorf("publish = %v, err = %v, want the unchanged description accepted", publish, err) + } + if strings.Contains(p.messages[1], "is ignored") { + t.Errorf("confirmation notes an ignored description that wasn't changed:\n%s", p.messages[1]) } }) @@ -167,7 +255,7 @@ func TestConfirmRequestEditor(t *testing.T) { r := &Runner{out: outputhelper.NewCatcher(), prompt: p} reqVars := newRequest() - if _, err := r.confirmRequest(reqVars, &Params{Build: "src"}, false); err != nil { + if _, err := r.confirmRequest(reqVars, &Params{Build: "src"}, false, ""); err != nil { t.Fatal(err) } if len(reqVars.Dependencies) != 1 || reqVars.Dependencies[0].Name != privateBuilderName { @@ -176,12 +264,31 @@ func TestConfirmRequestEditor(t *testing.T) { }) } +// noVersions is a versionExists for a platform where nothing is published yet. +func noVersions(_, _, _ string) (bool, error) { return false, nil } + +func TestDefaultNamespace(t *testing.T) { + withPyproject := t.TempDir() + if err := os.WriteFile(filepath.Join(withPyproject, "pyproject.toml"), nil, 0644); err != nil { + t.Fatal(err) + } + for _, tt := range []struct{ buildDir, want string }{ + {"", "private/org"}, + {t.TempDir(), "private/org"}, + {withPyproject, "private/org/python"}, + } { + if got := defaultNamespace("org", tt.buildDir); got != tt.want { + t.Errorf("defaultNamespace(%q) = %q, want %q", tt.buildDir, got, tt.want) + } + } +} + func TestConfirmRequestSave(t *testing.T) { t.Chdir(t.TempDir()) p := &fakePrompter{confirms: []bool{false}, selects: []int{choiceSave}} r := &Runner{out: outputhelper.NewCatcher(), prompt: p} - publish, err := r.confirmRequest(newRequest(), &Params{Build: "src"}, false) + publish, err := r.confirmRequest(newRequest(), &Params{Build: "src"}, false, "") if err != nil || publish { t.Fatalf("publish = %v, err = %v, want saved", publish, err) } @@ -207,7 +314,7 @@ func TestConfirmRequestCancel(t *testing.T) { p := &fakePrompter{confirms: []bool{false}, selects: []int{choiceCancel}} r := &Runner{out: outputhelper.NewCatcher(), prompt: p} - if _, err := r.confirmRequest(newRequest(), &Params{}, false); err == nil || !strings.Contains(err.Error(), "cancelled") { + if _, err := r.confirmRequest(newRequest(), &Params{}, false, ""); err == nil || !strings.Contains(err.Error(), "cancelled") { t.Errorf("err = %v, want cancelled", err) } } @@ -222,7 +329,7 @@ func TestPublishFailedError(t *testing.T) { func TestMetaFromIngredient(t *testing.T) { ingredient := &ParentIngredient{Version: "1.0.0", Dependencies: windowsOnlyDependency()} - meta, err := metaFromIngredient("private/org/python", "mypkg", ingredient) + meta, err := metaFromIngredient("private/org/python", "mypkg", ingredient, "Internal helpers") if err != nil { t.Fatal(err) } @@ -232,6 +339,9 @@ func TestMetaFromIngredient(t *testing.T) { if got := meta.Dependencies[0].Conditions[0].VersionRequirements; got != ">=0" { t.Errorf("condition without requirements exported as %q, want >=0", got) } + if meta.Description != "Internal helpers" { + t.Errorf("description exported as %q", meta.Description) + } } // windowsOnlyDependency is a revision's dependency on requests, conditioned on Windows without a version requirement. diff --git a/internal/runners/publish/meta.go b/internal/runners/publish/meta.go index da43b54d5d..2d831779ef 100644 --- a/internal/runners/publish/meta.go +++ b/internal/runners/publish/meta.go @@ -5,16 +5,18 @@ import ( "github.com/ActiveState/cli/internal/errs" "github.com/ActiveState/cli/internal/locale" + "github.com/ActiveState/cli/internal/rtutils/ptr" "github.com/ActiveState/cli/pkg/platform/api/graphql/request" "github.com/ActiveState/cli/pkg/platform/api/inventory/inventory_client/inventory_operations" "github.com/ActiveState/cli/pkg/platform/authentication" "github.com/ActiveState/cli/pkg/platform/model" + "github.com/go-openapi/strfmt" ) // FetchMeta returns the meta file contents of an existing ingredient version (the latest one when version is empty), // in the format the --meta flag accepts. Its dependencies are the complete set, so the file can be modified and -// passed back with --edit to replace them. Authors and description are left out because the platform rejects them -// on a revision of an existing version. +// passed back with --edit to replace them. Authors are left out because the platform rejects them on a revision of an +// existing version; the description is included, and --edit accepts it as long as it is unchanged. func FetchMeta(namespace, name, version string, auth *authentication.Auth) (*request.PublishVariables, error) { latestRevisionTime, err := model.FetchLatestRevisionTimeStamp(auth) if err != nil { @@ -48,13 +50,26 @@ func FetchMeta(namespace, name, version string, auth *authentication.Auth) (*req ingredient = &ParentIngredient{*i.IngredientID, *i.IngredientVersionID, *i.Version, i.Dependencies} } - return metaFromIngredient(namespace, name, ingredient) + description, err := fetchDescription(ingredient.IngredientID, auth) + if err != nil { + return nil, err + } + return metaFromIngredient(namespace, name, ingredient, description) +} + +// fetchDescription returns an ingredient's description, which belongs to the ingredient rather than to its versions. +func fetchDescription(ingredientID strfmt.UUID, auth *authentication.Auth) (string, error) { + ingredient, err := model.FetchIngredient(&ingredientID, auth) + if err != nil { + return "", locale.WrapError(err, "err_ingredient_meta_fetch", "Could not fetch the ingredient's description") + } + return ptr.From(ingredient.Description, ""), nil } // metaFromIngredient builds the meta file contents of an existing ingredient version, complete enough to be published // back as is: dependencies and conditions without a version requirement get the any-version one. -func metaFromIngredient(namespace, name string, ingredient *ParentIngredient) (*request.PublishVariables, error) { - meta := &request.PublishVariables{Name: name, Namespace: namespace} +func metaFromIngredient(namespace, name string, ingredient *ParentIngredient, description string) (*request.PublishVariables, error) { + meta := &request.PublishVariables{Name: name, Namespace: namespace, Description: description} // As a revision, prepareEditRequest doesn't fetch authors, so it needs no auth. if err := prepareEditRequest(ingredient, meta, true, nil); err != nil { return nil, errs.Wrap(err, "Could not read ingredient meta data") diff --git a/internal/runners/publish/publish.go b/internal/runners/publish/publish.go index 12c5ce6990..f13fd25055 100644 --- a/internal/runners/publish/publish.go +++ b/internal/runners/publish/publish.go @@ -58,6 +58,8 @@ type Runner struct { project *project.Project cfg *config.Instance bp *buildplanner.BuildPlanner + // versionExists reports whether a version of an ingredient is published; tests replace it. + versionExists func(namespace, name, version string) (bool, error) } type primeable interface { @@ -70,7 +72,7 @@ type primeable interface { } func New(prime primeable) *Runner { - return &Runner{ + r := &Runner{ auth: prime.Auth(), out: prime.Output(), prompt: prime.Prompt(), @@ -78,6 +80,8 @@ func New(prime primeable) *Runner { cfg: prime.Config(), bp: buildplanner.NewBuildPlannerModel(prime.Auth(), prime.SvcModel()), } + r.versionExists = r.ingredientVersionExists + return r } type ParentIngredient struct { @@ -144,7 +148,7 @@ func (r *Runner) Run(params *Params) error { if params.Namespace != "" { reqVars.Namespace = params.Namespace } else if reqVars.Namespace == "" && r.project != nil && r.project.Owner() != "" { - reqVars.Namespace = model.NewNamespaceOrg(r.project.Owner(), "").String() + reqVars.Namespace = defaultNamespace(r.project.Owner(), params.Build) } // A --build publish is encrypted under the project org's key, so its resolved @@ -213,6 +217,8 @@ func (r *Runner) Run(params *Params) error { } } + // The description of the ingredient a revision belongs to, which the revision can't change. + var currentDescription string if params.Edit { if ingredient == nil { return locale.NewInputError("err_uploadingredient_edit_not_found", @@ -222,6 +228,11 @@ func (r *Runner) Run(params *Params) error { if err := prepareEditRequest(ingredient, &reqVars, isRevision, r.auth); err != nil { return errs.Wrap(err, "Could not prepare edit request") } + if isRevision { + if currentDescription, err = fetchDescription(ingredient.IngredientID, r.auth); err != nil { + return err + } + } } else { if isRevision { return locale.NewInputError("err_uploadingredient_exists", @@ -252,13 +263,16 @@ func (r *Runner) Run(params *Params) error { } } - publish, err := r.confirmRequest(&reqVars, params, isRevision) + publish, err := r.confirmRequest(&reqVars, params, isRevision, currentDescription) if err != nil { return err } if !publish { return nil // saved to a meta file instead } + if params.Edit && isRevision { + reqVars.Description = "" // kept as it was, and the platform rejects a description on a revision + } r.out.Notice(locale.Tl("uploadingredient_uploading", "Publishing ingredient...")) @@ -317,16 +331,56 @@ func (r *Runner) Run(params *Params) error { var versionRegexp = regexp.MustCompile(`\d+\.\d+(\.\d+)?`) -// checkEditKeepsIdentity rejects author and description changes on a revision of an existing version, which the -// platform does not allow; it would otherwise fail the publish with an unclear API error. +// defaultNamespace is the namespace used when neither --namespace nor the meta file gives one: the owner's private +// namespace, under python when a pyproject.toml in the --build directory makes the package a Python one. +func defaultNamespace(owner, buildDir string) string { + if buildDir != "" && fileutils.FileExists(filepath.Join(buildDir, "pyproject.toml")) { + return model.NewNamespaceOrg(owner, "python").String() + } + return model.NewNamespaceOrg(owner, "").String() +} + +// ingredientVersionExists reports whether the given version of an ingredient is published. +func (r *Runner) ingredientVersionExists(namespace, name, version string) (bool, error) { + latestRevisionTime, err := model.FetchLatestRevisionTimeStamp(r.auth) + if err != nil { + return false, errs.Wrap(err, "Unable to determine latest revision time") + } + _, err = model.GetIngredientByNameAndVersion(namespace, name, version, &latestRevisionTime, r.auth) + var notFound *inventory_operations.GetNamespaceIngredientVersionNotFound + if errors.As(err, ¬Found) { + return false, nil + } + if err != nil { + return false, errs.Wrap(err, "could not get ingredient version") + } + return true, nil +} + +// checkEditKeepsIdentity rejects authors on a revision of an existing version, which the platform does not allow; it +// would otherwise fail the publish with an unclear API error. func checkEditKeepsIdentity(r *request.PublishVariables, edit, isRevision bool) error { - if edit && isRevision && (len(r.Authors) > 0 || r.Description != "") { + if edit && isRevision && len(r.Authors) > 0 { return locale.NewInputError("err_uploadingredient_edit_identity", - "Authors and description cannot be changed when editing an existing version. Remove them from the meta file and flags.") + "Authors cannot be changed when editing an existing version. Remove them from the meta file and flags.") } return nil } +// keepDescription shows a revision with its ingredient's current description, which can't be changed on an existing +// version. A different description is replaced rather than refused, and the returned note, ending in a newline, tells +// the user it is ignored; it is empty when there was nothing to ignore. +func keepDescription(r *request.PublishVariables, currentDescription string) string { + ignored := r.Description + r.Description = currentDescription + if ignored == "" || ignored == currentDescription { + return "" + } + return locale.Tl("uploadingredient_description_ignored", + "The description can't be changed on an existing version, so '[ACTIONABLE]{{.V0}}[/RESET]' is ignored and it stays '[ACTIONABLE]{{.V1}}[/RESET]'.", + ignored, currentDescription) + "\n" +} + func prepareRequestFromParams(r *request.PublishVariables, params *Params, isRevision bool) error { if params.Version != "" { r.Version = params.Version @@ -474,7 +528,7 @@ func prepareEditRequest(ingredient *ParentIngredient, r *request.PublishVariable // confirmRequest shows the prepared request and asks the user to publish it. Until they confirm, they can edit it or // save it to a meta file and start over with it. Each pass completes and validates the request again, since an edit // can undo what was done to it before. It reports whether to publish: false means the request was saved instead. -func (r *Runner) confirmRequest(reqVars *request.PublishVariables, params *Params, isRevision bool) (bool, error) { +func (r *Runner) confirmRequest(reqVars *request.PublishVariables, params *Params, isRevision bool, currentDescription string) (bool, error) { for { if params.Build != "" { addPrivateBuilderDependency(reqVars) @@ -486,6 +540,10 @@ func (r *Runner) confirmRequest(reqVars *request.PublishVariables, params *Param if err := checkEditKeepsIdentity(reqVars, params.Edit, isRevision); err != nil { return false, err } + var descriptionNote string + if params.Edit && isRevision { + descriptionNote = keepDescription(reqVars, currentDescription) + } b, err := reqVars.MarshalYaml(false) if err != nil { @@ -497,9 +555,9 @@ func (r *Runner) confirmRequest(reqVars *request.PublishVariables, params *Param locale.Tl("uploadingredient_confirm", `Prepared the following ingredient: {{.V0}} - +{{.V1}} Do you want to publish this ingredient? Answer 'n' to edit it or save it to a file instead. -`, string(b)), ptr.To(true), nil) +`, string(b), fixedFieldsNote(params)+descriptionNote), ptr.To(true), nil) if err != nil { return false, errs.Wrap(err, "Not confirmed") } @@ -555,18 +613,44 @@ func (r *Runner) reviseRequest(reqVars *request.PublishVariables, params *Params return false, locale.NewInputError("uploadingredient_cancel", "Publish cancelled") } -// editRequest opens the request in the user's editor. With --build or --edit, the name, namespace and version were -// already used to build the package or find the ingredient, so changing them here would publish something -// inconsistent: the edits are saved to a meta file instead, and the user is told to start over with it. +// editRequest opens the request in the user's editor. A new namespace is checked again and put back if it can't be +// used. Other fields that were already used can't be changed here: --build packed the name and version into the +// package, and --edit found the ingredient to revise by its namespace, name and version. Changing them would publish +// something inconsistent, so the edits are saved to a meta file instead, and the user is told to start over with it. func (r *Runner) editRequest(reqVars *request.PublishVariables, params *Params) error { + if note := fixedFieldsNote(params); note != "" { + r.out.Notice(note + locale.Tl("uploadingredient_edit_fixed_saved", + "If you change them in the editor, your edits are saved to a meta file to publish from instead.")) + } + before := *reqVars if err := r.OpenInEditor(reqVars); err != nil { return err } + + if !params.Edit && reqVars.Namespace != before.Namespace { + if err := r.checkNamespaceEdit(reqVars, params); err != nil { + r.out.Notice(locale.Tl("uploadingredient_namespace_kept", + "Kept the namespace '[ACTIONABLE]{{.V0}}[/RESET]', because '[ACTIONABLE]{{.V1}}[/RESET]' can't be used: {{.V2}}", + before.Namespace, reqVars.Namespace, errs.JoinMessage(err))) + reqVars.Namespace = before.Namespace + } + } + if params.Build == "" && !params.Edit { return nil } - if reqVars.Name == before.Name && reqVars.Namespace == before.Namespace && reqVars.Version == before.Version { + var changed []string + if params.Edit && reqVars.Namespace != before.Namespace { + changed = append(changed, "namespace") + } + if reqVars.Name != before.Name { + changed = append(changed, "name") + } + if reqVars.Version != before.Version { + changed = append(changed, "version") + } + if len(changed) == 0 { return nil } @@ -574,10 +658,54 @@ func (r *Runner) editRequest(reqVars *request.PublishVariables, params *Params) if err != nil { return err } + reason := locale.Tl("uploadingredient_fixed_reason_build", "it was already built into the package") + if params.Edit { + reason = locale.Tl("uploadingredient_fixed_reason_edit", "it identifies the ingredient you are editing") + } return locale.NewInputError("err_uploadingredient_edit_identity_changed", - "The name, namespace or version can't be changed at this point, because they were already used to build the package "+ - "or find the ingredient. Your changes were saved to [ACTIONABLE]{{.V0}}[/RESET]. Publish them with:\n\n [ACTIONABLE]{{.V1}}[/RESET]", - path, rerunCommand(params, path)) + "The {{.V0}} can't be changed at this point, because {{.V1}}. Your changes were saved to [ACTIONABLE]{{.V2}}[/RESET]. "+ + "Publish them with:\n\n [ACTIONABLE]{{.V3}}[/RESET]", + strings.Join(changed, " and "), reason, path, rerunCommand(params, path)) +} + +// fixedFieldsNote tells the user up front which fields can't be changed before publishing, and why, ending in a +// newline; it is empty when every field can be. +func fixedFieldsNote(params *Params) string { + switch { + case params.Edit: + return locale.Tl("uploadingredient_fixed_edit", + "The namespace, name and version identify the ingredient you are editing, so they can't be changed.") + "\n" + case params.Build != "": + return locale.Tl("uploadingredient_fixed_build", + "The name and version are built into the package, so they can't be changed. To change them, publish again with '[ACTIONABLE]--name[/RESET]' or '[ACTIONABLE]--version[/RESET]'.") + "\n" + } + return "" +} + +// checkNamespaceEdit checks a namespace changed in the editor the way Run checked the original one: a --build package +// must stay in the organization whose key encrypted it, and a new ingredient's version must not already exist in it. +func (r *Runner) checkNamespaceEdit(reqVars *request.PublishVariables, params *Params) error { + if reqVars.Namespace == "" { + return locale.NewInputError("err_uploadingredient_namespace_empty", "a namespace is required") + } + if params.Build != "" { + owner := "" + if r.project != nil { + owner = r.project.Owner() + } + if err := requireOrgNamespace(reqVars.Namespace, owner); err != nil { + return err + } + } + exists, err := r.versionExists(reqVars.Namespace, reqVars.Name, reqVars.Version) + if err != nil { + return err + } + if exists { + return locale.NewInputError("err_uploadingredient_namespace_version_exists", + "version {{.V0}} of '{{.V1}}' already exists in it", reqVars.Version, reqVars.Name) + } + return nil } // saveMetaFile writes the request to -.meta.yaml in the working directory, in the format --meta reads, @@ -598,8 +726,7 @@ func (r *Runner) saveMetaFile(reqVars *request.PublishVariables) (string, error) } } - // Plain yaml rather than MarshalYaml, whose field help comments don't belong in a file the user keeps. - b, err := yaml.Marshal(reqVars) + b, err := reqVars.MarshalYaml(false) if err != nil { return "", errs.Wrap(err, "Could not marshal publish variables") } diff --git a/internal/runners/publish/publish_test.go b/internal/runners/publish/publish_test.go index f188293fae..ee3f7deb5c 100644 --- a/internal/runners/publish/publish_test.go +++ b/internal/runners/publish/publish_test.go @@ -94,10 +94,9 @@ func TestCheckEditKeepsIdentity(t *testing.T) { wantErr bool }{ {"author on revision", withAuthor, true, true, true}, - {"description on revision", withDescription, true, true, true}, + {"description on revision is left to keepDescription", withDescription, true, true, false}, {"no identity change on revision", plain, true, true, false}, {"author on new version via edit", withAuthor, true, false, false}, - {"description on new ingredient", withDescription, false, false, false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/internal/runners/publish/readme.md b/internal/runners/publish/readme.md index 6b6e0e97b4..ed336d0e23 100644 --- a/internal/runners/publish/readme.md +++ b/internal/runners/publish/readme.md @@ -78,7 +78,8 @@ From the project checkout: state publish --build ./mypkg-src --namespace private//python ``` -The namespace must be under `private/`, the organization that owns the project. Before uploading, the State Tool +The namespace must be under `private/`, the organization that owns the project. Without `--namespace`, it is +`private//python` when the source directory has a `pyproject.toml`, and `private/` otherwise. Before uploading, the State Tool shows the ingredient it is about to publish and asks for confirmation: ``` @@ -112,6 +113,9 @@ dependencies: namespace: builder versionRequirements: '>=0' +The name and version are built into the package, so they can't be changed. To change them, publish again with +'--name' or '--version'. + Do you want to publish this ingredient? Answer 'n' to edit it or save it to a file instead. (Y/n) ``` @@ -121,8 +125,10 @@ it is what decrypts and installs the package, so leave it in place. If something is wrong, answer `n` and choose one of: - **Edit it in my editor:** opens the meta data in `$EDITOR` (or the default program for `.yaml` files), then shows - the result for confirmation again. Name, namespace and version can't be changed this way, because the package was - already built with them: if you change them, your edits are saved to a meta file as below. + the result for confirmation again. You can change the namespace here: it is checked the same way as `--namespace`, + and if it can't be used (it is outside your organization, or the version already exists there), the previous one is + kept and the reason is shown. The name and version can't be changed this way, because the package was already built + with them: if you change them, your edits are saved to a meta file as below. - **Save it to a meta file to edit and publish later:** writes `mypkg-1.0.0.meta.yaml` to the current directory and prints the command to publish it, e.g. `state publish --build ./mypkg-src --meta mypkg-1.0.0.meta.yaml`. Edit the file, then run that command. The meta file takes precedence over `pyproject.toml`, so its name, version and dependency list @@ -165,7 +171,7 @@ complete dependency list: name: mypkg namespace: private//python version: 1.0.0 -description: "" +description: Internal helpers for the data team dependencies: - dependency: name: private-builder @@ -182,6 +188,18 @@ dependencies: ... ``` +The meta file has these fields: + +| Field | Meaning | +|----------------|------------------------------------------------------------------------------------------------------| +| `name` | The name of the ingredient. | +| `namespace` | Where the ingredient is published, under `private/`, e.g. `private//python`. | +| `version` | The version, following semantic versioning. It must match the version in the source file name, if any. | +| `description` | A short description of the ingredient. It can't be changed on an existing version. | +| `authors` | Optional. The people who contributed to it, each with `name`, `email` and `websites`. They can't be changed on an existing version. | +| `dependencies` | Optional. The ingredients it requires, described below. | +| `features` | Optional. The features it provides, each with `name`, `namespace` and `version`. | + **Edit the `dependencies` list.** Change version ranges, remove entries, or add new ones. Each entry nests its fields under `dependency:`, with optional `conditions:` beside it: @@ -215,9 +233,10 @@ Things to know about `--edit`: `pyproject.toml` lists any, the previous revision's dependencies are kept. - **Name, namespace and version identify what you are editing; they cannot be changed.** To publish under a new version, see step 6. -- **Authors and description cannot be changed** on an existing version. The exported file leaves authors out and the - description empty. If you fill the description in, the publish is refused with "Authors and description cannot be - changed when editing an existing version." +- **Authors and description cannot be changed** on an existing version. The exported file leaves authors out, and + adding any is refused with "Authors cannot be changed when editing an existing version." It includes the current + description. If you change it, the change is ignored: the confirmation shows the current description and says so, + and you can still publish the rest of your edits. - The `language/python` dependencies the platform adds by itself come back automatically, so it does no harm if they are missing from your file. diff --git a/pkg/platform/api/graphql/request/publish.go b/pkg/platform/api/graphql/request/publish.go index 45b7313dd2..6a1cb6a81c 100644 --- a/pkg/platform/api/graphql/request/publish.go +++ b/pkg/platform/api/graphql/request/publish.go @@ -11,7 +11,6 @@ import ( "github.com/ActiveState/cli/internal/fileutils" "github.com/ActiveState/cli/internal/gqlclient" "github.com/ActiveState/cli/internal/locale" - yamlcomment "github.com/zijiren233/yaml-comment" "gopkg.in/yaml.v3" ) @@ -54,15 +53,15 @@ func Publish(vars PublishVariables, filepath string) (*PublishInput, error) { // which is done with yaml. As such the yaml tags are used for representing data to the user, and the json is used for // inputs to graphql. type PublishVariables struct { - Name string `yaml:"name" json:"-" hc:"The name of the ingredient"` // User representation only - Namespace string `yaml:"namespace" json:"-" hc:"The namespace field should be in the format org/folder. Org can simply be your username or any organization you're a member of."` // User representation only - Version string `yaml:"version" json:"version" hc:"The version field should follow semantic versioning and match the version in the filename (if any)."` - Description string `yaml:"description" json:"description" hc:"The description field should be a short description of the ingredient."` + Name string `yaml:"name" json:"-"` // User representation only + Namespace string `yaml:"namespace" json:"-"` // User representation only + Version string `yaml:"version" json:"version"` + Description string `yaml:"description" json:"description"` // Optional - Authors []PublishVariableAuthor `yaml:"authors,omitempty" json:"authors,omitempty" hc:"A list of authors who contributed to the ingredient."` - Dependencies []PublishVariableDep `yaml:"dependencies,omitempty" json:"dependencies,omitempty" hc:"A list of dependencies that the ingredient requires."` - Features []PublishVariableFeature `yaml:"features,omitempty" json:"features,omitempty" hc:"A list of features that the ingredient provides."` + Authors []PublishVariableAuthor `yaml:"authors,omitempty" json:"authors,omitempty"` + Dependencies []PublishVariableDep `yaml:"dependencies,omitempty" json:"dependencies,omitempty"` + Features []PublishVariableFeature `yaml:"features,omitempty" json:"features,omitempty"` // GraphQL input only Path string `yaml:"-" json:"path"` @@ -123,14 +122,14 @@ func (p PublishVariables) MarshalJSON() ([]byte, error) { } func (p PublishVariables) MarshalYaml(includeExample bool) ([]byte, error) { - v, err := yamlcomment.Marshal(p) + v, err := yaml.Marshal(p) if err != nil { return nil, errs.Wrap(err, "Could not marshal publish request") } if includeExample { if len(p.Authors) == 0 { - exampleAuthorYaml, err := yamlcomment.Marshal(exampleAuthor) + exampleAuthorYaml, err := yaml.Marshal(exampleAuthor) if err != nil { return nil, errs.Wrap(err, "Could not marshal example author") } @@ -140,7 +139,7 @@ func (p PublishVariables) MarshalYaml(includeExample bool) ([]byte, error) { } if len(p.Dependencies) == 0 { - exampleDepYaml, err := yamlcomment.Marshal(exampleDep) + exampleDepYaml, err := yaml.Marshal(exampleDep) if err != nil { return nil, errs.Wrap(err, "Could not marshal example deps") } diff --git a/vendor/github.com/maruel/natural/LICENSE b/vendor/github.com/maruel/natural/LICENSE deleted file mode 100644 index 8e539f6924..0000000000 --- a/vendor/github.com/maruel/natural/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018 Marc-Antoine Ruel - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/maruel/natural/README.md b/vendor/github.com/maruel/natural/README.md deleted file mode 100644 index 7d1a18a264..0000000000 --- a/vendor/github.com/maruel/natural/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# natural - -Yet another natural sort, with 100% test coverage and a benchmark. It **does not -allocate memory**, doesn't depend on package `sort` and hence doesn't depend on -`reflect`. It is optimized for speed. - -[![Go -Reference](https://pkg.go.dev/badge/github.com/maruel/natural.svg)](https://pkg.go.dev/github.com/maruel/natural) -[![codecov](https://codecov.io/gh/maruel/natural/branch/main/graph/badge.svg?token=iQg8Y62BBg)](https://codecov.io/gh/maruel/natural) - - -## Benchmarks - -On Go 1.18.3. - -``` -$ go test -bench=. -cpu 1 -goos: linux -goarch: amd64 -pkg: github.com/maruel/natural -cpu: Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz -BenchmarkLessDigitsTwoGroupsNative 331287298 3.597 ns/op 0 B/op 0 allocs/op -BenchmarkLessDigitsTwoGroups 32479050 36.55 ns/op 0 B/op 0 allocs/op -BenchmarkLessStringOnly 157775884 7.603 ns/op 0 B/op 0 allocs/op -BenchmarkLessDigitsOnly 69210796 17.52 ns/op 0 B/op 0 allocs/op -BenchmarkLess10Blocks 6331066 190.8 ns/op 0 B/op 0 allocs/op -``` - -On a Raspberry Pi 3: - -``` -$ go test -bench=. -cpu 1 -goos: linux -goarch: arm -pkg: github.com/maruel/natural -BenchmarkLessDigitsTwoGroupsNative 14181789 86.57 ns/op 0 B/op 0 allocs/op -BenchmarkLessDigitsTwoGroups 1600195 748.9 ns/op 0 B/op 0 allocs/op -BenchmarkLessStringOnly 8286034 142.3 ns/op 0 B/op 0 allocs/op -BenchmarkLessDigitsOnly 3653055 331.4 ns/op 0 B/op 0 allocs/op -BenchmarkLess10Blocks 310687 3838 ns/op 0 B/op 0 allocs/op -``` - -Coverage: - -``` -$ go test -cover -PASS -coverage: 100.0% of statements -ok github.com/maruel/natural 0.012s -``` diff --git a/vendor/github.com/maruel/natural/natsort.go b/vendor/github.com/maruel/natural/natsort.go deleted file mode 100644 index cf743a76d2..0000000000 --- a/vendor/github.com/maruel/natural/natsort.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2018 Marc-Antoine Ruel. All rights reserved. -// Use of this source code is governed under the Apache License, Version 2.0 -// that can be found in the LICENSE file. - -// Package natural defines a natural "less" to compare two strings while -// interpreting natural numbers. -// -// This is occasionally nicknamed 'natsort'. -// -// It does so with no memory allocation. -package natural - -import ( - "strconv" -) - -// Less does a 'natural' comparison on the two strings. -// -// It treats digits as decimal numbers, so that Less("10", "2") return true. -// -// This function does no memory allocation. -func Less(a, b string) bool { - for { - if p := commonPrefix(a, b); p != 0 { - a = a[p:] - b = b[p:] - } - if len(a) == 0 { - return len(b) != 0 - } - if ia := digits(a); ia > 0 { - if ib := digits(b); ib > 0 { - // Both sides have digits. - an, aerr := strconv.ParseUint(a[:ia], 10, 64) - bn, berr := strconv.ParseUint(b[:ib], 10, 64) - if aerr == nil && berr == nil { - if an != bn { - return an < bn - } - // Semantically the same digits, e.g. "00" == "0", "01" == "1". In - // this case, only continue processing if there's trailing data on - // both sides, otherwise do lexical comparison. - if ia != len(a) && ib != len(b) { - a = a[ia:] - b = b[ib:] - continue - } - } - } - } - return a < b - } -} - -// StringSlice attaches the methods of Interface to []string, sorting in -// increasing order using natural order. -type StringSlice []string - -func (p StringSlice) Len() int { return len(p) } -func (p StringSlice) Less(i, j int) bool { return Less(p[i], p[j]) } -func (p StringSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -// - -// commonPrefix returns the common prefix except for digits. -func commonPrefix(a, b string) int { - m := len(a) - if n := len(b); n < m { - m = n - } - if m == 0 { - return 0 - } - _ = a[m-1] - _ = b[m-1] - for i := 0; i < m; i++ { - ca := a[i] - cb := b[i] - if (ca >= '0' && ca <= '9') || (cb >= '0' && cb <= '9') || ca != cb { - return i - } - } - return m -} - -func digits(s string) int { - for i := 0; i < len(s); i++ { - c := s[i] - if c < '0' || c > '9' { - return i - } - } - return len(s) -} diff --git a/vendor/github.com/zijiren233/yaml-comment/.gitignore b/vendor/github.com/zijiren233/yaml-comment/.gitignore deleted file mode 100644 index 3b735ec4a8..0000000000 --- a/vendor/github.com/zijiren233/yaml-comment/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# If you prefer the allow list template instead of the deny list, see community template: -# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore -# -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Dependency directories (remove the comment below to include it) -# vendor/ - -# Go workspace file -go.work diff --git a/vendor/github.com/zijiren233/yaml-comment/LICENSE b/vendor/github.com/zijiren233/yaml-comment/LICENSE deleted file mode 100644 index dbf44df17a..0000000000 --- a/vendor/github.com/zijiren233/yaml-comment/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 zijiren - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/zijiren233/yaml-comment/README.md b/vendor/github.com/zijiren233/yaml-comment/README.md deleted file mode 100644 index 27426ac6a7..0000000000 --- a/vendor/github.com/zijiren233/yaml-comment/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# yaml-comment -golang yaml comment encoder - -# How to use -```go -package main - -import ( - "fmt" - "github.com/zijiren233/yaml-comment" -) - -type Config struct { - Name string `yaml:"name,omitempty" hc:"this is head comment"` - Age int `yaml:"age,omitempty" lc:"this is line comment" fc:"this is foot comment"` -} - -func main() { - c := Config{ - Name: "comment", - Age: 18, - } - data, err := yamlcomment.Marshal(c) - if err != nil { - panic(err) - } - fmt.Println(string(data)) -} -``` - -# Output -```yaml -# this is head comment -name: comment -age: 18 # this is line comment -# this is foot comment -``` \ No newline at end of file diff --git a/vendor/github.com/zijiren233/yaml-comment/comment.go b/vendor/github.com/zijiren233/yaml-comment/comment.go deleted file mode 100644 index 19acc35a72..0000000000 --- a/vendor/github.com/zijiren233/yaml-comment/comment.go +++ /dev/null @@ -1,275 +0,0 @@ -package yamlcomment - -import ( - "reflect" - "sort" - "strings" - - "github.com/maruel/natural" - yaml "gopkg.in/yaml.v3" -) - -const ( - HeadCommentTag = "hc" - LineCommentTag = "lc" - FootCommentTag = "fc" - OmitemptyTag = "omitempty" - InlineTag = "inline" - FlowTag = "flow" -) - -type option struct { - fieldName string - omitempty bool - skip bool - inline bool - flow bool -} - -type comment struct { - HeadComment string - LineComment string - FootComment string -} - -func setComment(cm *comment, tag reflect.StructTag) { - if cm == nil { - return - } - cm.HeadComment = tag.Get(HeadCommentTag) - cm.LineComment = tag.Get(LineCommentTag) - cm.FootComment = tag.Get(FootCommentTag) -} - -func newComment(tag reflect.StructTag) *comment { - cm := new(comment) - setComment(cm, tag) - return cm -} - -type CommentEncoder struct { - encoder *yaml.Encoder -} - -func NewEncoder(encoder *yaml.Encoder) *CommentEncoder { - return &CommentEncoder{ - encoder: encoder, - } -} - -func (e *CommentEncoder) Encode(v any) error { - node, err := anyToYamlNode(v, false) - if err != nil { - return err - } - return e.encoder.Encode(node) -} - -func Marshal(v any) ([]byte, error) { - node, err := anyToYamlNode(v, false) - if err != nil { - return nil, err - } - return yaml.Marshal(node) -} - -func isZero(value reflect.Value) bool { - if !value.IsValid() { - return true - } - - return value.IsZero() -} - -func isNil(value reflect.Value) bool { - if !value.IsValid() { - return true - } - - switch value.Kind() { - case reflect.Chan, reflect.Func, reflect.Map, reflect.Pointer, reflect.UnsafePointer, reflect.Interface, reflect.Slice: - return value.IsNil() - default: - return false - } -} - -func parseTags(tag reflect.StructTag) (*option, *comment) { - yamlTags := strings.Split(tag.Get("yaml"), ",") - - var op = &option{ - fieldName: yamlTags[0], - } - - if op.fieldName == "-" { - op.skip = true - return op, nil - } - - for _, part := range yamlTags[1:] { - switch part { - case OmitemptyTag: - op.omitempty = true - case InlineTag: - op.inline = true - case FlowTag: - op.flow = true - } - } - - return op, newComment(tag) -} - -func AnyToYamlNode(model any) (*yaml.Node, error) { - return anyToYamlNode(model, false) -} - -func anyToYamlNode(model any, skip bool) (*yaml.Node, error) { - if n, ok := model.(*yaml.Node); ok { - return n, nil - } - - if m, ok := model.(yaml.Marshaler); ok && !isNil(reflect.ValueOf(model)) { - res, err := m.MarshalYAML() - if err != nil { - return nil, err - } - - if n, ok := res.(*yaml.Node); ok { - return n, nil - } - - model = res - } - - v := reflect.ValueOf(model) - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - - node := new(yaml.Node) - - switch v.Kind() { - case reflect.Struct: - node.Kind = yaml.MappingNode - - t := v.Type() - for i := 0; i < v.NumField(); i++ { - field := v.Field(i) - if !field.CanInterface() { - continue - } - - op, cm := parseTags(t.Field(i).Tag) - - if op.skip || (op.omitempty && isZero(field)) { - continue - } - - if op.fieldName == "" { - op.fieldName = strings.ToLower(t.Field(i).Name) - } - - var value any - if field.CanInterface() { - value = field.Interface() - } - - var style yaml.Style - if op.flow { - style |= yaml.FlowStyle - } - - if op.inline { - child, err := anyToYamlNode(value, skip) - if err != nil { - return nil, err - } - - if child.Kind == yaml.MappingNode || child.Kind == yaml.SequenceNode { - appendNodes(node, child.Content...) - } - } else if err := addToMap(node, op.fieldName, value, cm, style, skip); err != nil { - return nil, err - } - } - case reflect.Map: - node.Kind = yaml.MappingNode - keys := v.MapKeys() - sort.SliceStable(keys, func(i, j int) bool { - return natural.Less(keys[i].String(), keys[j].String()) - }) - - for i, k := range keys { - if i != 0 { - skip = true - } - if err := addToMap(node, k.Interface(), v.MapIndex(k).Interface(), nil, 0, skip); err != nil { - return nil, err - } - } - case reflect.Slice: - node.Kind = yaml.SequenceNode - nodes := make([]*yaml.Node, v.Len()) - - for i := 0; i < v.Len(); i++ { - if i != 0 { - skip = true - } - element := v.Index(i) - - var err error - - nodes[i], err = anyToYamlNode(element.Interface(), skip) - if err != nil { - return nil, err - } - } - appendNodes(node, nodes...) - default: - if err := node.Encode(model); err != nil { - return nil, err - } - } - - return node, nil -} - -func appendNodes(dest *yaml.Node, nodes ...*yaml.Node) { - if dest.Content == nil { - dest.Content = nodes - return - } - - dest.Content = append(dest.Content, nodes...) -} - -func addToMap(dest *yaml.Node, fieldName, in any, cm *comment, style yaml.Style, skip bool) error { - key, err := anyToYamlNode(fieldName, skip) - if err != nil { - return err - } - - value, err := anyToYamlNode(in, skip) - if err != nil { - return err - } - value.Style = style - - if !skip { - addComment(key, cm) - } - appendNodes(dest, key, value) - - return nil -} - -func addComment(node *yaml.Node, cm *comment) { - if cm == nil { - return - } - - node.HeadComment = cm.HeadComment - node.LineComment = cm.LineComment - node.FootComment = cm.FootComment -} diff --git a/vendor/modules.txt b/vendor/modules.txt index c62537d5f0..2622c5a9a5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -556,9 +556,6 @@ github.com/mailru/easyjson/jwriter github.com/mark3labs/mcp-go/mcp github.com/mark3labs/mcp-go/server github.com/mark3labs/mcp-go/util -# github.com/maruel/natural v1.1.0 -## explicit; go 1.11 -github.com/maruel/natural # github.com/mash/go-tempfile-suffix v0.0.0-20150731093933-48f0f8a3a5ab ## explicit github.com/mash/go-tempfile-suffix @@ -765,9 +762,6 @@ github.com/yosida95/uritemplate/v3 # github.com/yusufpapurcu/wmi v1.2.4 ## explicit; go 1.16 github.com/yusufpapurcu/wmi -# github.com/zijiren233/yaml-comment v0.2.1 -## explicit; go 1.18 -github.com/zijiren233/yaml-comment # go.mongodb.org/mongo-driver v1.17.7 ## explicit; go 1.18 go.mongodb.org/mongo-driver/bson