Skip to content

grep: list every file with -L when no line can be selected - #216

Open
yunusarda-sudo wants to merge 1 commit into
uutils:mainfrom
yunusarda-sudo:grep-files-without-match-nothing-selectable
Open

yunusarda-sudo wants to merge 1 commit into
uutils:mainfrom
yunusarda-sudo:grep-files-without-match-nothing-selectable

Conversation

@yunusarda-sudo

Copy link
Copy Markdown
Contributor

With -m 0, or -v with an empty pattern, no line can be selected, so grep exits with status 1 before opening any file. That is right for normal output, -c, -l and -q, but with -L every file has no selected line and GNU grep lists each of them (and still reports the ones it can't open). uu_grep printed nothing.

The early exit is now skipped for -L, so the normal search runs and lists the files. Added a test for both cases and for a missing file.

The GNU skip-read test still fails after this, on the empty pattern file case (#204, covered by #215).

Closes #213

@codspeed

codspeed Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 3 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 10 untouched benchmarks
⏩ 17 skipped benchmarks1


Comparing yunusarda-sudo:grep-files-without-match-nothing-selectable (0a19c4b) with main (bf6f25e)

Open in CodSpeed

Footnotes

  1. 17 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.22%. Comparing base (bf6f25e) to head (0a19c4b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #216   +/-   ##
=======================================
  Coverage   97.22%   97.22%           
=======================================
  Files           6        6           
  Lines        2270     2272    +2     
  Branches      245      248    +3     
=======================================
+ Hits         2207     2209    +2     
  Misses         63       63           
Flag Coverage Δ
macOS_latest 98.13% <100.00%> (+<0.01%) ⬆️
ubuntu_latest 98.13% <100.00%> (+<0.01%) ⬆️
windows_latest 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yunusarda-sudo
yunusarda-sudo force-pushed the grep-files-without-match-nothing-selectable branch 2 times, most recently from 01e5644 to 157f1b8 Compare November 22, 2026 08:36
@github-actions

Copy link
Copy Markdown

GNU grep testsuite comparison:

Test results comparison:
  Current:   TOTAL: 128 / PASSED: 77 / FAILED: 30 / SKIPPED: 21
  Reference: TOTAL: 128 / PASSED: 76 / FAILED: 31 / SKIPPED: 21

Changes from main branch:
  TOTAL: +0
  PASSED: +1
  FAILED: -1

Test improvements (1):
  + skip-read

@yunusarda-sudo
yunusarda-sudo force-pushed the grep-files-without-match-nothing-selectable branch from 157f1b8 to b4f9a37 Compare November 22, 2026 12:20
@github-actions

Copy link
Copy Markdown

GNU grep testsuite comparison:

Test results comparison:
  Current:   TOTAL: 128 / PASSED: 77 / FAILED: 30 / SKIPPED: 21
  Reference: TOTAL: 128 / PASSED: 76 / FAILED: 31 / SKIPPED: 21

Changes from main branch:
  TOTAL: +0
  PASSED: +1
  FAILED: -1

Test improvements (1):
  + skip-read

@yunusarda-sudo
yunusarda-sudo force-pushed the grep-files-without-match-nothing-selectable branch 2 times, most recently from 390a0b9 to 0d7707b Compare November 23, 2026 21:19
@github-actions

Copy link
Copy Markdown

GNU grep testsuite comparison:

Test results comparison:
  Current:   TOTAL: 128 / PASSED: 77 / FAILED: 30 / SKIPPED: 21
  Reference: TOTAL: 128 / PASSED: 76 / FAILED: 31 / SKIPPED: 21

Changes from main branch:
  TOTAL: +0
  PASSED: +1
  FAILED: -1

Test improvements (1):
  + skip-read

@yunusarda-sudo
yunusarda-sudo force-pushed the grep-files-without-match-nothing-selectable branch from 0d7707b to 6be5d02 Compare November 24, 2026 19:55
@github-actions

Copy link
Copy Markdown

GNU grep testsuite comparison:

Test results comparison:
  Current:   TOTAL: 128 / PASSED: 77 / FAILED: 30 / SKIPPED: 21
  Reference: TOTAL: 128 / PASSED: 76 / FAILED: 31 / SKIPPED: 21

Changes from main branch:
  TOTAL: +0
  PASSED: +1
  FAILED: -1

Test improvements (1):
  + skip-read

With -m 0, or -v and an empty pattern, grep exits before opening any
file. -L has to list each file in that case, so keep searching.
@yunusarda-sudo
yunusarda-sudo force-pushed the grep-files-without-match-nothing-selectable branch from 6be5d02 to 0a19c4b Compare November 25, 2026 22:24
@github-actions

Copy link
Copy Markdown

GNU grep testsuite comparison:

Test results comparison:
  Current:   TOTAL: 128 / PASSED: 77 / FAILED: 30 / SKIPPED: 21
  Reference: TOTAL: 128 / PASSED: 76 / FAILED: 31 / SKIPPED: 21

Changes from main branch:
  TOTAL: +0
  PASSED: +1
  FAILED: -1

Test improvements (1):
  + skip-read

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

grep - -L with -m 0 or -v '' prints nothing; GNU still lists every file

1 participant