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
{{ message }}
Repository navigation
-l and -L are not mutually exclusive last-wins like GNU #26
-l (--files-with-matches) and -L (--files-without-match) are opposites. GNU treats them as mutually exclusive with last-one-wins semantics. uu_grep keeps both flags independently active and always lets -l win, so -l -L (with -l first) diverges.
$ printf'match5here\n'> /tmp/p.txt
$ LC_ALL=C /usr/bin/grep -e 5 -l -L /tmp/p.txt
# Output: (none — last flag is -L, and the file *does* match, so it is not listed)# Exit code: 0
With the order reversed (-L -l, last flag -l) both print the filename, confirming GNU's last-wins rule. uu_grep prints the filename in both orders.
I checked this against current upstream/main, and it looks fixed already rather than needing another code change.
The current parser defines -l and -L with reciprocal Clap overrides, and tests/test_grep.rs already has files_with_and_without_matches_mutually_exclusive covering both orders. The original repro now matches GNU last-wins behavior for me: grep -e 5 -l -L /tmp/p.txt exits 0 with no output, while grep -e 5 -L -l /tmp/p.txt prints the filename.
I also ran cargo test files_with_and_without_matches_mutually_exclusive -- --nocapture, and that targeted test passes. Unless there is another ordering/alias variant you had in mind, I think this one can be closed as already resolved.
Activity
wondr-wclabs commentedon Jun 5, 2026
I checked this against current
upstream/main, and it looks fixed already rather than needing another code change.The current parser defines
-land-Lwith reciprocal Clap overrides, andtests/test_grep.rsalready hasfiles_with_and_without_matches_mutually_exclusivecovering both orders. The original repro now matches GNU last-wins behavior for me:grep -e 5 -l -L /tmp/p.txtexits 0 with no output, whilegrep -e 5 -L -l /tmp/p.txtprints the filename.I also ran
cargo test files_with_and_without_matches_mutually_exclusive -- --nocapture, and that targeted test passes. Unless there is another ordering/alias variant you had in mind, I think this one can be closed as already resolved.sylvestre commentedon Jun 5, 2026
it has been fixed by #30 not closed