Version / branch / commit
main at 17fcd26602dc685fd1596739c4d718932d856d9e; found while reviewing #1211.
OS and environment
Windows 10/11, cmd.exe; junction created with mklink /J (no symlink privilege needed).
Steps to reproduce
- Create a workspace directory with a
.zerojunction pointing at a target directory. - Put a valid
hooks.jsonunder the target. - Remove the junction target, leaving
.zeroas a dangling junction. - Load the project hook layer / run a
beforeToolhook in that workspace.
Expected behavior
The hook config is known to exist but cannot be resolved, so LoadConfig returns ErrInvalidConfig and beforeTool stays blocked.
Actual behavior
On Windows, os.Lstat reports a junction as ModeIrregular rather than ModeSymlink. danglingSymlinkInPath only checked the symlink bit, so it skipped the dangling .zero junction. LoadConfig returned no error and no diagnostics, and beforeTool ran with no policy.
Relevant logs, screenshots, or error messages
Reproduced on Windows with mklink /J; Lstat returned mode ?rw-rw-rw- with no symlink bit, ReadFile returned not-exist, and LoadConfig returned no error. PR #1211 now checks Lstat existence plus Stat not-exist, which treats any dangling link/junction as invalid, and adds a Windows junction regression test.
Marking this
bugandissue-approved. I reproduced the junction case myself while reviewing #1211: a dangling.zerojunction made withmklink /Jwas skipped by the symlink-only check, and the Windows test in that PR fails when the fix is reduced to the symlink bit. #1211 is the fix and is approved from my side.