You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would need to look at the source to see where the lndir program logic goes south, but the difficulty seems to be with WSL getdents. That /* d_reclen < sizeof(struct dirent) */ looks problematic.
I've looked into this, and it doesn't look like we'll be able to fix this at this time.
The getdents issue that therealkenc pointed out is not related to this issue. We're not correctly padding our entries, which confuses strace, but otherwise doesn't impact the functionality.
The real issue is that lndir is checking st_nlinks on the parent, and assumes that if it's 0, there are no subdirectories. All of the subdirectory processing, including checking for '.' and '..' entries, is then skipped. Unfortunately, we return 0 for st_nlinks because we cannot determine the correct value easily (NTFS does not store this information, so it could only be determined by listing the directory, a very expensive operation).
It could be argued that this is a bug in lndir. On Linux, with file systems that report the correct link count for directories, the value is always at least 2 (for the '.' and '..' entries). We used to return 2 regardless of how many subdirectories there are, but found that most tools take the value 2 to mean "no subdirectories, so no need to recurse". The value zero seems to mean the value is incorrect and can't be trusted, causing those tools to ignore it. This is why we switched to returning zero.
This is the first case where we've seen a tool that skips processing based on the value zero (a value which it should never encounter on a file system that returns correct link counts for directories, so this seems like incorrect behavior on the part of lndir). We cannot fix this tool without breaking a whole bunch of others, so unfortunately I don't think there's anything we can do for you right now.
This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.
Activity
therealkenc commentedon Jun 18, 2017
Would need to look at the source to see where the
lndirprogram logic goes south, but the difficulty seems to be with WSLgetdents. That/* d_reclen < sizeof(struct dirent) */looks problematic.WSL:
Real Linux:
sunilmut commentedon Jun 22, 2017
Adding Sven Groot (@SvenGroot) to see if he can chime in on this.
SvenGroot commentedon Jun 22, 2017
I've looked into this, and it doesn't look like we'll be able to fix this at this time.
The getdents issue that therealkenc pointed out is not related to this issue. We're not correctly padding our entries, which confuses strace, but otherwise doesn't impact the functionality.
The real issue is that lndir is checking st_nlinks on the parent, and assumes that if it's 0, there are no subdirectories. All of the subdirectory processing, including checking for '.' and '..' entries, is then skipped. Unfortunately, we return 0 for st_nlinks because we cannot determine the correct value easily (NTFS does not store this information, so it could only be determined by listing the directory, a very expensive operation).
It could be argued that this is a bug in lndir. On Linux, with file systems that report the correct link count for directories, the value is always at least 2 (for the '.' and '..' entries). We used to return 2 regardless of how many subdirectories there are, but found that most tools take the value 2 to mean "no subdirectories, so no need to recurse". The value zero seems to mean the value is incorrect and can't be trusted, causing those tools to ignore it. This is why we switched to returning zero.
This is the first case where we've seen a tool that skips processing based on the value zero (a value which it should never encounter on a file system that returns correct link counts for directories, so this seems like incorrect behavior on the part of lndir). We cannot fix this tool without breaking a whole bunch of others, so unfortunately I don't think there's anything we can do for you right now.
microsoft-github-policy-service commentedon Feb 1, 2024
This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.
Thank you!