-
Notifications
You must be signed in to change notification settings - Fork 198
Add support for LX symlinks (0xA000001D) for WSL/MSYS2 compatibility #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add support for LX symlinks (0xA000001D) for WSL/MSYS2 compatibility #336
Conversation
|
@microsoft-github-policy-service agree company="Microsoft" |
- Add reparseTagLxSymlink constant (0xA000001D) - Implement decode logic for LX symlinks (UTF-8 format) - Add IsLxSymlink field to ReparsePoint struct to preserve symlink type - Implement encode logic to recreate LX symlinks on import - Add unit tests for LX symlink round-trip validation Fixes issue where Docker builds with MSYS2 failed with 'unsupported reparse point a000001d' error. Signed-off-by: Varun Gokulnath <[email protected]>
Signed-off-by: Varun Gokulnath <[email protected]>
29a5906 to
7b9940e
Compare
Extract LX symlink encode/decode into separate functions for better maintainability and cleaner separation of concerns. Signed-off-by: Varun Gokulnath <[email protected]>
Signed-off-by: Varun Gokulnath <[email protected]>
|
@msscotb @Kishon-Microsoft, could you please review this change? We hope to get this merged soon as it has been a few weeks since the PR was opened. Thanks! |
| dataLength := 4 + len(targetBytes) | ||
|
|
||
| var b bytes.Buffer | ||
| _ = binary.Write(&b, binary.LittleEndian, uint32(reparseTagLxSymlink)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any specific reason for discarding the errors?
| // mount point. | ||
| // EncodeReparsePoint encodes a Win32 REPARSE_DATA_BUFFER structure describing a symlink, | ||
| // mount point, or LX symlink. | ||
| func EncodeReparsePoint(rp *ReparsePoint) []byte { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we guard against passing a nil value?
| "testing" | ||
| ) | ||
|
|
||
| func TestLxSymlinkRoundTrip(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add tests for other scenarios? atleast with empty Target?
|
|
||
| func encodeLxReparsePoint(rp *ReparsePoint) []byte { | ||
| // LX symlink: 4-byte version + UTF-8 target | ||
| version := uint32(2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding something like const lxSymlinkVersion = 2 and then using it here would be clean.
Summary
Adds support for LX symlinks (IO_REPARSE_TAG_LX_SYMLINK, tag 0xA000001D) used by WSL and MSYS2 for native Unix-style symlinks.
Problem
Docker builds using MSYS2 with native symlinks (MSYS=winsymlinks:native) fail with error "unsupported reparse point a000001d" because go-winio doesn't recognize LX symlink reparse tags.
Solution
reparseTagLxSymlinkconstant (0xA000001D)IsLxSymlinkfield to preserve symlink type through encode/decode cyclesTesting