Skip to content

Regression in 1.1.20+ in FAT directory reading #22

Description

@oerg866

TL;DR: FATDirentry.IsLabel() treats every LFN entry as a volume label so listdir()/walk() silently drop all files with LFNs.

The regression was introduced in commit 3dccfee ("FAT IsLabel must set/check bit 3 ONLY").

IsLabel() tests self._buf[0x0B] & 0x08. For LFN entries _buf has the LFN slots before the 8.3 slot, so _buf[0x0B] is the first LFN slot's attribute byte (0x0F), which satisfies the condition -> listdir() / walk() skip these entries

Previously, the check was simply "== 0x08", (and well, 0x08 != 0x0F :P ) so this was masked.
IsDir() uses self._buf[-21] (the last slot), which should be the correct offset...

Example: on a Windows 98 Raw disk image, \WINDOWS\SYSTEM dropped around 100 files, all of which had LFN slots, the 8.3-only names are fine.

(I think the same 0x0B offset into _buf is wrong for mark=1 too, which would corrupt the first LFN slot instead of marking the 8.3 slot)

Awesome library btw, I use it a lot :D

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions