Repository navigation
fix: CLI directory parsing, glob separator and case matching, MFT extension records - #9
Merged
Merged
Conversation
…ension records - cli: a directory typed after --ext/--names was swallowed as a filter value and the search silently ran on ".". A trailing path-like value (contains a separator, or is ".", "..", "D:") is now used as the directory; path-like filter values anywhere else are an error; a bare existing directory name keeps its filter meaning but prints a note. - glob: `*`, `?` and `[...]` no longer cross path separators (only `**` does), matching glob.glob. Matching is case-insensitive on Windows. - mft: skip records without $STANDARD_INFORMATION. Extension records can hold spilled-over $FILE_NAME attributes that the base record already reports through its $ATTRIBUTE_LIST, which produced duplicate entries with zero size and no timestamps. CI now asserts no duplicate paths.
- cli: only a platform path separator marks a filter value as a path. "." and ".." are legitimate --names substrings again (they were rejected, a regression), and on POSIX backslashes and colons are legal file name characters. - cli: the "put it first" note needs at least two values, so a single filter that happens to match a folder (`--ext js` next to js/) is quiet, and the suggested command now keeps the remaining filter values. - glob: on Windows, resolve literal prefix components to their on-disk spelling so a pattern typed as "SRC/*.py" returns src\... paths. - ci: the old duplicate check could not fail on System32\drivers. Create a file with 30 long-named hard links, which forces $FILE_NAME into extension records, and assert every link appears once with its size.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three confirmed bugs and one MFT correctness fix.
1. CLI: directory after
--ext/--nameswas silently ignored--extand--namesarenargs="+", sopyofiles find --ext py D:\docsreadD:\docsas a second extension and searched.instead, with no error./, or also\on Windows) is now used as the directory when none was given. File names cannot contain a separator, so these values could never match anything..,..and colons are not treated as paths: they are legitimate--namessubstrings (and on POSIX backslashes are legal in names).--ext py src), it stays a filter and the CLI prints a note with the corrected command. A single value is left alone (--ext jsnext to ajs/folder is a normal command).cli.parse_args(argv)wrapsbuild_parser()plus the resolution step;main()uses it.2. glob:
*crossed directoriesglobset's default
literal_separator(false)meant"*.py"matched every.pyrecursively and"src/*.py"matchedsrc/deep/b.py. Now*,?and[...]stay within one component and only**recurses, matchingglob.glob. This changes behavior for anyone relying on*recursing;**/is the fix on their side.3. glob: case-sensitive on Windows
glob(d, "*.pdf")missedREPORT.PDFwhilefind(extensions=["pdf"])found it. Matching is now case-insensitive on Windows and case-sensitive elsewhere.4. MFT: possible duplicate entries from extension records
When a file's
$FILE_NAMEattributes spill into an extension record (many hard links), the base record already reports them through$ATTRIBUTE_LIST, andparse_recordthen emitted them again from the extension record with size 0 and no timestamps. Only base records carry$STANDARD_INFORMATION, so records without it are now skipped. Thentfscrate does not exposebase_file_record, hence this check. It can't be exercised locally without elevation, so a new elevated Windows CI step creates a file with 30 long-named hard links (forcing$FILE_NAMEinto extension records) and asserts every link comes back exactly once with its real size.Tests
., explicit directory untouched, path-like rejection, and the ambiguous-name note.SRC/*.pyreturnssrc\...paths.cargo test --lib9 passed; pytest 112 passed, 3 skipped (MFT/elevation-gated).Second commit addresses an adversarial review pass:
./..--namesregression, over-eager stderr note, glob prefix casing, and a CI MFT check that could not fail.