Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grep: fix -Fc regression #634

Merged
merged 1 commit into from
Jun 3, 2024
Merged

grep: fix -Fc regression #634

merged 1 commit into from
Jun 3, 2024

Conversation

mknos
Copy link
Contributor

@mknos mknos commented Jun 3, 2024

  • Combining -F and -c flags had the incorrect result of showing matching lines followed by a count
  • When debugging this I discovered the opt hash was supposed to be massaged so s-flag is set if c-flag is set
%perl grep -Fc '/' aa.c     # before patch
	/* I SHOULD BE INVISIBLE */
1

* Combining -F and -c flags had the incorrect result of showing matching lines followed by a count
* When debugging this I discovered the opt hash was supposed to be massaged so s-flag is set if c-flag is set
@github-actions github-actions bot added Type: enhancement improve a feature that already exists Priority: low get to this whenever Program: grep The grep program labels Jun 3, 2024
@itsnicksia
Copy link

This fixes an issue triggered on line 400 where line is still printed because only opt s is checked:

$opt->{'s'} || print $Mult && "$name:",
				$opt->{n} ? "$.:" : "", $_,
				( $opt->{p} || $opt->{P} ) && ( '-' x 20 ) . "\n";

@briandfoy briandfoy added Type: bug an existing feature does not work and removed Type: enhancement improve a feature that already exists labels Jun 3, 2024
@briandfoy briandfoy merged commit 8f79df3 into briandfoy:master Jun 3, 2024
2 checks passed
@briandfoy
Copy link
Owner

changes: set -s implicitly when -c is used

@briandfoy briandfoy added Status: accepted The fix is accepted and removed Priority: low get to this whenever labels Jun 3, 2024
@briandfoy briandfoy self-assigned this Jun 3, 2024
@briandfoy briandfoy added Status: released there is a new release with this fix and removed Status: accepted The fix is accepted labels Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Program: grep The grep program Status: released there is a new release with this fix Type: bug an existing feature does not work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants