From 930ea95db81a31eb8b88630164f22e3239af1fd4 Mon Sep 17 00:00:00 2001 From: Dawei Wei Date: Thu, 17 Sep 2026 20:29:06 -0700 Subject: [PATCH] deps: update go-winio for sparse layer exports Update the root and test modules to upstream go-winio commit 526e22f39a0a and regenerate vendor. This includes microsoft/go-winio#375 and complements the logical-size fix in microsoft/hcsshim#2926 for moby/moby#53464. The selected revision also includes upstream LX symlink support. No other dependency versions change. Signed-off-by: Dawei Wei --- go.mod | 2 +- go.sum | 4 +- test/go.mod | 2 +- test/go.sum | 4 +- .../Microsoft/go-winio/backuptar/tar.go | 4 ++ .../github.com/Microsoft/go-winio/reparse.go | 60 +++++++++++++++++-- vendor/modules.txt | 2 +- 7 files changed, 66 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 39fd1e019b..f7398d1be9 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ tool ( require ( github.com/Microsoft/cosesign1go v1.6.0 github.com/Microsoft/didx509go v0.0.3 - github.com/Microsoft/go-winio v0.6.3-0.20251027160822-ad3df93bed29 + github.com/Microsoft/go-winio v0.6.3-0.20260917205003-526e22f39a0a github.com/blang/semver/v4 v4.0.0 github.com/cenkalti/backoff/v4 v4.3.0 github.com/containerd/cgroups/v3 v3.1.3 diff --git a/go.sum b/go.sum index 438d9ab279..367afc64bb 100644 --- a/go.sum +++ b/go.sum @@ -366,8 +366,8 @@ github.com/Microsoft/cosesign1go v1.6.0 h1:/dGDBxrrbqdkUDOgUDvFAKBou85XmSrB58G3s github.com/Microsoft/cosesign1go v1.6.0/go.mod h1:7x+fdYtZ4ureEgfVtl2K+nY4MMfujMsCIb5kRuncpmg= github.com/Microsoft/didx509go v0.0.3 h1:n/owuFOXVzCEzSyzivMEolKEouBm9G0NrEDgoTekM8A= github.com/Microsoft/didx509go v0.0.3/go.mod h1:wWt+iQsLzn3011+VfESzznLIp/Owhuj7rLF7yLglYbk= -github.com/Microsoft/go-winio v0.6.3-0.20251027160822-ad3df93bed29 h1:0kQAzHq8vLs7Pptv+7TxjdETLf/nIqJpIB4oC6Ba4vY= -github.com/Microsoft/go-winio v0.6.3-0.20251027160822-ad3df93bed29/go.mod h1:ZWa7ssZJT30CCDGJ7fk/2SBTq9BIQrrVjrcss0UW2s0= +github.com/Microsoft/go-winio v0.6.3-0.20260917205003-526e22f39a0a h1:fAOaVG8riXgBe8ACxoYCTv8191XXOvQ7q5BKfig48i8= +github.com/Microsoft/go-winio v0.6.3-0.20260917205003-526e22f39a0a/go.mod h1:ZWa7ssZJT30CCDGJ7fk/2SBTq9BIQrrVjrcss0UW2s0= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= diff --git a/test/go.mod b/test/go.mod index 1f22089aaa..3b904dbf0b 100644 --- a/test/go.mod +++ b/test/go.mod @@ -3,7 +3,7 @@ module github.com/Microsoft/hcsshim/test go 1.26.3 require ( - github.com/Microsoft/go-winio v0.6.3-0.20251027160822-ad3df93bed29 + github.com/Microsoft/go-winio v0.6.3-0.20260917205003-526e22f39a0a github.com/Microsoft/hcsshim v0.15.0-rc.1 github.com/containerd/cgroups/v3 v3.1.3 github.com/containerd/containerd/api v1.11.1 diff --git a/test/go.sum b/test/go.sum index 945ac0e729..7727fb3f33 100644 --- a/test/go.sum +++ b/test/go.sum @@ -6,8 +6,8 @@ github.com/Microsoft/cosesign1go v1.6.0 h1:/dGDBxrrbqdkUDOgUDvFAKBou85XmSrB58G3s github.com/Microsoft/cosesign1go v1.6.0/go.mod h1:7x+fdYtZ4ureEgfVtl2K+nY4MMfujMsCIb5kRuncpmg= github.com/Microsoft/didx509go v0.0.3 h1:n/owuFOXVzCEzSyzivMEolKEouBm9G0NrEDgoTekM8A= github.com/Microsoft/didx509go v0.0.3/go.mod h1:wWt+iQsLzn3011+VfESzznLIp/Owhuj7rLF7yLglYbk= -github.com/Microsoft/go-winio v0.6.3-0.20251027160822-ad3df93bed29 h1:0kQAzHq8vLs7Pptv+7TxjdETLf/nIqJpIB4oC6Ba4vY= -github.com/Microsoft/go-winio v0.6.3-0.20251027160822-ad3df93bed29/go.mod h1:ZWa7ssZJT30CCDGJ7fk/2SBTq9BIQrrVjrcss0UW2s0= +github.com/Microsoft/go-winio v0.6.3-0.20260917205003-526e22f39a0a h1:fAOaVG8riXgBe8ACxoYCTv8191XXOvQ7q5BKfig48i8= +github.com/Microsoft/go-winio v0.6.3-0.20260917205003-526e22f39a0a/go.mod h1:ZWa7ssZJT30CCDGJ7fk/2SBTq9BIQrrVjrcss0UW2s0= github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= diff --git a/vendor/github.com/Microsoft/go-winio/backuptar/tar.go b/vendor/github.com/Microsoft/go-winio/backuptar/tar.go index a4d2202f9c..3378d87e63 100644 --- a/vendor/github.com/Microsoft/go-winio/backuptar/tar.go +++ b/vendor/github.com/Microsoft/go-winio/backuptar/tar.go @@ -255,6 +255,8 @@ func WriteTarFileFromBackupStream(t *tar.Writer, r io.Reader, name string, size case winio.BackupAlternateData, winio.BackupLink, winio.BackupPropertyData, winio.BackupObjectId, winio.BackupTxfsData: // ignore these streams + case winio.BackupSparseBlock: + // Skip sparse content during the metadata scan; copySparse handles it in the data pass. default: return fmt.Errorf("%s: unknown stream ID %d", name, bhdr.Id) } @@ -365,6 +367,8 @@ func WriteTarFileFromBackupStream(t *tar.Writer, r io.Reader, name string, size } case winio.BackupEaData, winio.BackupLink, winio.BackupPropertyData, winio.BackupObjectId, winio.BackupTxfsData: // ignore these streams + case winio.BackupSparseBlock: + // Empty sparse files skip copySparse and may leave a zero-size, zero-offset terminator. default: return fmt.Errorf("%s: unknown stream ID %d after data", name, bhdr.Id) } diff --git a/vendor/github.com/Microsoft/go-winio/reparse.go b/vendor/github.com/Microsoft/go-winio/reparse.go index b03e517f3c..9847fbd6c5 100644 --- a/vendor/github.com/Microsoft/go-winio/reparse.go +++ b/vendor/github.com/Microsoft/go-winio/reparse.go @@ -5,6 +5,7 @@ package winio import ( "bytes" "encoding/binary" + "errors" "fmt" "strings" "unicode/utf16" @@ -14,6 +15,9 @@ import ( const ( reparseTagMountPoint = 0xA0000003 reparseTagSymlink = 0xA000000C + reparseTagLxSymlink = 0xA000001D // WSL/MSYS2 native symlinks + + lxSymlinkVersion = 2 // LX symlink format version ) type reparseDataBuffer struct { @@ -30,6 +34,7 @@ type reparseDataBuffer struct { type ReparsePoint struct { Target string IsMountPoint bool + IsLxSymlink bool // True if this is an LX symlink (WSL/MSYS2 native) } // UnsupportedReparsePointError is returned when trying to decode a non-symlink or @@ -50,14 +55,19 @@ func DecodeReparsePoint(b []byte) (*ReparsePoint, error) { } func DecodeReparsePointData(tag uint32, b []byte) (*ReparsePoint, error) { - isMountPoint := false switch tag { case reparseTagMountPoint: - isMountPoint = true + return decodeWindowsReparsePointData(b, true) case reparseTagSymlink: + return decodeWindowsReparsePointData(b, false) + case reparseTagLxSymlink: + return decodeLxReparsePointData(b) default: return nil, &UnsupportedReparsePointError{tag} } +} + +func decodeWindowsReparsePointData(b []byte, isMountPoint bool) (*ReparsePoint, error) { nameOffset := 8 + binary.LittleEndian.Uint16(b[4:6]) if !isMountPoint { nameOffset += 4 @@ -68,16 +78,56 @@ func DecodeReparsePointData(tag uint32, b []byte) (*ReparsePoint, error) { if err != nil { return nil, err } - return &ReparsePoint{string(utf16.Decode(name)), isMountPoint}, nil + return &ReparsePoint{Target: string(utf16.Decode(name)), IsMountPoint: isMountPoint, IsLxSymlink: false}, nil +} + +func decodeLxReparsePointData(b []byte) (*ReparsePoint, error) { + // LX symlinks store the target as UTF-8 after a 4-byte version field + if len(b) < 4 { + return nil, errors.New("LX symlink buffer too short") + } + targetBytes := b[4:] + for i, c := range targetBytes { + if c == 0 { + targetBytes = targetBytes[:i] + break + } + } + target := string(targetBytes) + return &ReparsePoint{Target: target, IsMountPoint: false, IsLxSymlink: true}, nil } func isDriveLetter(c byte) bool { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') } -// EncodeReparsePoint encodes a Win32 REPARSE_DATA_BUFFER structure describing a symlink or -// mount point. +// EncodeReparsePoint encodes a Win32 REPARSE_DATA_BUFFER structure describing a symlink, +// mount point, or LX symlink. func EncodeReparsePoint(rp *ReparsePoint) []byte { + if rp == nil { + return nil + } + if rp.IsLxSymlink { + return encodeLxReparsePoint(rp) + } + return encodeWindowsReparsePoint(rp) +} + +func encodeLxReparsePoint(rp *ReparsePoint) []byte { + // LX symlink: 4-byte version + UTF-8 target + targetBytes := []byte(rp.Target) + dataLength := 4 + len(targetBytes) + + var b bytes.Buffer + _ = binary.Write(&b, binary.LittleEndian, uint32(reparseTagLxSymlink)) + _ = binary.Write(&b, binary.LittleEndian, uint16(dataLength)) + _ = binary.Write(&b, binary.LittleEndian, uint16(0)) + _ = binary.Write(&b, binary.LittleEndian, uint32(lxSymlinkVersion)) + _, _ = b.Write(targetBytes) + return b.Bytes() +} + +func encodeWindowsReparsePoint(rp *ReparsePoint) []byte { // Generate an NT path and determine if this is a relative path. var ntTarget string relative := false diff --git a/vendor/modules.txt b/vendor/modules.txt index 0937a8f1fb..760344f634 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -10,7 +10,7 @@ github.com/Microsoft/cosesign1go/pkg/cosesign1 # github.com/Microsoft/didx509go v0.0.3 ## explicit; go 1.20 github.com/Microsoft/didx509go/pkg/did-x509-resolver -# github.com/Microsoft/go-winio v0.6.3-0.20251027160822-ad3df93bed29 +# github.com/Microsoft/go-winio v0.6.3-0.20260917205003-526e22f39a0a ## explicit; go 1.23.0 github.com/Microsoft/go-winio github.com/Microsoft/go-winio/backuptar