GNU bug report logs -
#77589
30.1; On Windows, dired does not display Junctions specially
Previous Next
Reported by: dino chiesa <dpchiesa <at> hotmail.com>
Date: Sun, 6 Apr 2025 23:23:01 UTC
Severity: wishlist
Found in version 30.1
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
From the Win32 File I/O documentation
https://learn.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants
The bit for a Reparse Point, which includes SymbolicLinks as well as Junctions, is:
FILE_ATTRIBUTE_REPARSE_POINT
1024 (0x00000400)
After brief inspection, it seems like dired.c file_attributes is relying on s_ISLNK to determine if the file is a symlink. I am not sure what S_ISLNK does for Windows Junctions or if it even makes sense for a POSIX API to do something special for Windows Junctions.
In my tests the Attributes surfaced at the powershell layer use that REPARSE_POINT bit, whether it is a symlink (file) or a Junction (directory).
PS C:\test> Get-Item -Path regular-file.txt | Select-Object FullName, @{Name='AttributesHex'; Expression={ '0x{0:X}' -f [int]$_.Attributes }} | fl
FullName : C:\test\regular-file.txt
AttributesHex : 0x20
PS C:\test> Get-Item -Path "valid-symlink.txt" | Select-Object FullName, @{Name='AttributesHex'; Expression={ '0x{0:X}' -f [int]$_.Attributes }} | fl
FullName : C:\test\valid-symlink.txt
AttributesHex : 0x420
PS C:\test> Get-Item -Path "this-is-a-directory" | Select-Object FullName, @{Name='AttributesHex'; Expression={ '0x{0:X}' -f [int]$_.Attributes }} | fl
FullName : C:\test\this-is-a-directory
AttributesHex : 0x10
PS C:\test> Get-Item -Path "this-is-a-directory-junction" | Select-Object FullName, @{Name='AttributesHex'; Expression={ '0x{0:X}' -f [int]$_.Attributes }} | fl
FullName : C:\test\this-is-a-directory-junction
AttributesHex : 0x410
This bug report was last modified 25 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.