mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-16 15:40:31 +00:00
Improve handling of weird reparse points
On Windows file system tools like `ls` would print errors when they find things like WSL symlinks, which can't be read by WIN32. I don't know how they got on my hard drive but this change ensures Cosmo will handle them more gracefully. If a reparse point can't be followed, then fstatat will return information about the link itself. If readlink encounters reparse points that are WIN32 symlinks, then it'll log more helpful details when using MODE=dbg (a.k.a. cosmocc -mdbg). Speaking of which, this change is also going to help you troubleshoot locks; when you build your app using the cosmocc -mdbg flag your --strace logs will now show lock acquisition
This commit is contained in:
parent
90460ceb3c
commit
79516bf08e
4 changed files with 57 additions and 48 deletions
|
@ -120,7 +120,17 @@ static textwindows ssize_t sys_readlinkat_nt_impl(int dirfd, const char *path,
|
|||
}
|
||||
rc = j;
|
||||
} else {
|
||||
NTTRACE("sys_readlinkat_nt() should have kNtIoReparseTagSymlink");
|
||||
// e.g. 0xA000001D means IO_REPARSE_TAG_LX_SYMLINK
|
||||
//
|
||||
// "WSL symlinks can't be opened from Windows, only from
|
||||
// within WSL, so if we identify them as fs.ModeSymlink,
|
||||
// then functions like filepath.Walk would fail when trying
|
||||
// to follow the link."
|
||||
//
|
||||
// —Quoth Quim Muntal (dev on Go team at Microsoft)
|
||||
//
|
||||
// See also MSDN Learn § 2.1.2.1 Reparse Tags
|
||||
NTTRACE("reparse tag %#x != kNtIoReparseTagSymlink", rdb->ReparseTag);
|
||||
rc = einval();
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue