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
From the ext4 documentation at https://www.kernel.org/doc/html/latest/filesystems/ext4/dynamic.html#linear-classic-directories, it says that a directory entry with inode set to 0 is an unused entry, and that "the last entry in the block has a record length that takes it all the way to the end of the block". This entry appears to be both the "unused inode" and "end-of-block" directory entry, and it is just a fluke that there is old data (the filename/namelen>0) also in the entry.
The fix appears to be to add a new check around line 220 of fs.go in extractDirectoryEntries():
On my ext4 filesystem, the ReadDir() function is returning an additional file that doesn't exist anymore. If I list from the operating system, I see:
However, if I call
ReadDir("/usr/lib/python3.8")
on my open filesystem, I get back two entries in the array:But LICENSE.txt does not exist anymore.
Tracing through the code in the debugger, I can see that the DirectoryEntry2 structure data for this "bad" file is:
From the ext4 documentation at https://www.kernel.org/doc/html/latest/filesystems/ext4/dynamic.html#linear-classic-directories, it says that a directory entry with inode set to 0 is an unused entry, and that "the last entry in the block has a record length that takes it all the way to the end of the block". This entry appears to be both the "unused inode" and "end-of-block" directory entry, and it is just a fluke that there is old data (the filename/namelen>0) also in the entry.
The fix appears to be to add a new check around line 220 of fs.go in extractDirectoryEntries():
So that the data in this unused entry doesn't get appended to the dirEntries slice.
The text was updated successfully, but these errors were encountered: