Populate PrintName in junction reparse point#33
Merged
tesuji merged 3 commits intotesuji:mainfrom Feb 24, 2026
Merged
Conversation
When creating a junction, the `PrintName` field in the [reparse data buffer](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/ca069dad-ed16-42aa-b057-b6b207f447cc) was left empty, which diverges from `mklink /j`. The empty `PrintName` causes junctions to break in Windows Containers (WCoW) during layer serialization, which can be encountered, e.g., by creating and consuming a junction across container build steps: ```dockerfile FROM mcr.microsoft.com/windows/servercore:ltsc2022 RUN ... RUN ... ``` WCoW uses [`microsoft/hcsshim`](https://github.com/microsoft/hcsshim) for layer serialization which in turn uses [`microsoft/go-winio`](https://github.com/microsoft/go-winio) for encoding and decoding reparse points. They [only read `PrintName`](https://github.com/microsoft/go-winio/blob/75610162e7da1816cf16fe88f0da73dea994ea50/reparse.go#L70-L82), and discard `SubstituteName`. When the junction is re-encoded, the empty `PrintName` results in a broken junction. You could argue this is a bug there, I think, but it seems reasonable to write the `PrintName` here too. This was reported downstream in astral-sh/uv#17966 (comment). I wrote a janky test binary and WCoW build in GitHub Actions to reproduce the reported failure and validated that this change resolves it. Disclosure — I'm far from an expert on junctions and relied on Claude Opus to diagnose and fix this issue.
Contributor
Author
|
This was also just reported upstream in microsoft/go-winio#340 |
Owner
|
Interesting, however the new added test failed. |
Contributor
Author
|
I'll look at that. |
The test opened an exclusive handle (share_mode(0)) to the junction and held it while calling get_target(), which tries to open its own handle. Scope the file handle into a block so it is dropped before the second open.
tesuji
requested changes
Feb 24, 2026
Owner
tesuji
left a comment
There was a problem hiding this comment.
lgtm minus one minor styling issue
zanieb
added a commit
to astral-sh/uv
that referenced
this pull request
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When creating a junction, the
PrintNamefield in the reparse data buffer was left empty.The empty
PrintNamecauses junctions to break in Windows Containers (WCoW) during layer serialization, which can be encountered, e.g., by creating and consuming a junction across container build steps:WCoW uses
microsoft/hcsshimfor layer serialization which in turn usesmicrosoft/go-winiofor encoding and decoding reparse points. They only readPrintName, and discardSubstituteName. When the junction is re-encoded, the emptyPrintNameresults in a broken junction.You could argue this is a bug there, I think, but it seems reasonable to write the
PrintNamehere too.This was reported downstream in astral-sh/uv#17966 (comment).
I wrote a janky test binary and WCoW build in GitHub Actions to reproduce the reported failure and validated that this change resolves it. Disclosure — I'm far from an expert on junctions and relied on Claude Opus to diagnose and fix this issue.