-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
os: treat all non-symlink reparse points as ModeIrregular on Windows #61893
Comments
Change https://go.dev/cl/517815 mentions this issue: |
Hmm. Or does |
|
Hmm. I do think it makes sense to mark directories as irregular if they may require additional special handling, although I also think it makes sense to continue to omit the irregular bit for reparse points that are “just” symlinks, since the |
I gave this another thought, and now I think I've given the wrong solution to the issue of consistently identifing directory reparse points. IMO we shouldn't be treating any reparse points as a directory, trying to follow them while recursively walking directories is a recipe for problems. In fact, we almost have it right now: symlinks and mount points never have the directory bit set thanks to CL 41830. If we do the same for all reparse points, then the current logic will already mark them as irregular files.
Good point, agree. |
Change https://go.dev/cl/536655 mentions this issue: |
Is it correct to say that the above change would start causing junctions to stop showing up as symlink'd directories, and start showing up as irregular files? Given real symlinks are locked behind Developer Mode without elevation, loads of tools use junctions to emulate symlinks (e.g. yarn, pnpm in the JS ecosystem). I'm a little worried that some tooling out there will stop working properly. Right now, WSL sees junctions as symlinks (when observed via |
Junctions are currently only identified as symlinks, not directories. This prevents the infinite recursion trap for users blindly walking directories. If CL 536655 is approved, then junctions won't be identified as symlinks, but as irregular files. I'm planning to submit a companion proposal to make query the file reparse tag easier , so users can take informed decisions when implementing different FS operations. Something like this: #63429 (comment). |
Per discussion on #63429, even if we adopt a general rule that all reparse points are Irregular, we should also add an exception for dedup points, which are (1) regular enough, and (2) common enough to be worth special casing. |
This proposal has been added to the active column of the proposals project |
Just to clarify, for a
|
What is the current proposal and is there general agreement for it yet? |
Waiting here for the specific proposal. I think we agreed that dedup reparse points will not count as irregular too. |
Here comes the specific proposal, affecting
This proposal makes two breaking changes:
|
Probably the GODEBUG should seem like something that can be set to true or false. "winreparsepoint" doesn't say what happens to the reparse points. What about winreparseirregular=1 for the new behavior? |
Assuming we use winreparseirregular as the GODEBUG, have all remaining concerns been addressed? |
@rsc I was rereading #63703 and realized that @bcmills proposed to use the same debug flag,
Using a single GODEBUG is fine with me, as these two proposals are very related. |
Based on the discussion above, this proposal seems like a likely accept. The proposal is detailed in #61893 (comment). |
No change in consensus, so accepted. 🎉 The proposal is detailed in #61893 (comment). |
Change https://go.dev/cl/565136 mentions this issue: |
I want to clarify this point of the proposal, which might lead to confusion:
By |
fs.ModeIrregular
is useful to know whether a file is a reparse point or not. It is a signal that it needs more processing to fully understand how to handle it. Reparse points started to be treated asfs.ModeIrregular
in CL 460595 (submitted by @bcmills), landed in go1.21.Unfortunately, it did not mark all reparse points as irregular, only those that are not identified with
ModeSymlink | ModeDir | ModeNamedPipe | ModeDevice | ModeCharDevice
. This limits the usefulness offs.ModeIrregular
, as it is not possible to know, for example, if a directory is a reparse point or not. One can currently infer that allfs.ModeSymlink
are reparse points, which currently includesIO_REPARSE_TAG_MOUNT_POINT
, the most popular directory reparse point, but that's not a good reason to also properly support less common directory reparse ponts, such asIO_REPARSE_TAG_LX_SYMLINK
or vendors defined reparse points.I propose to treat all reparse points as
fs.ModeIrregular
, and to modify its definition fromnon-regular file; nothing else is known about this file
tonon-regular file; may need special handling
.Worth noting that this will help identifying mounted directories (aka
IO_REPARSE_TAG_MOUNT_POINT
) as reparse points if we manage to not treat them as symbolic links, that is fixing this TODO.Edit: I'm opening this issue to discuss potential concerns.
@golang/windows
The text was updated successfully, but these errors were encountered: