Page MenuHomeFreeBSD

D10607.id28048.diff
No OneTemporary

D10607.id28048.diff

Index: contrib/netbsd-tests/usr.bin/grep/t_grep.sh
===================================================================
--- contrib/netbsd-tests/usr.bin/grep/t_grep.sh
+++ contrib/netbsd-tests/usr.bin/grep/t_grep.sh
@@ -494,6 +494,25 @@
atf_check -s exit:1 grep -v -w "x" test1
atf_check -s exit:1 grep -v -w "x" test2
}
+
+atf_test_case grep_lflag_nolines
+grep_lflag_nolines_head()
+{
+ atf_set "descr" "Check for -l flag not producing line matches or context (PR 219077)"
+}
+
+grep_lflag_nolines_body()
+{
+ printf "A\nB\nC\n" > test1
+
+ atf_check -o inline:"test1\n" grep -l -e "B" test1
+
+ atf_check -o inline:"test1\n" grep -l -B 1 -e "B" test1
+
+ atf_check -o inline:"test1\n" grep -l -A 1 -e "B" test1
+
+ atf_check -o inline:"test1\n" grep -l -C 1 -e "B" test1
+}
# End FreeBSD
atf_init_test_cases()
@@ -527,5 +546,6 @@
atf_add_test_case fgrep_sanity
atf_add_test_case egrep_sanity
atf_add_test_case grep_sanity
+ atf_add_test_case grep_lflag_nolines
# End FreeBSD
}
Index: usr.bin/grep/util.c
===================================================================
--- usr.bin/grep/util.c
+++ usr.bin/grep/util.c
@@ -283,7 +283,7 @@
tail = Aflag;
}
/* Print the matching line, but only if not quiet/binary */
- if (t == 0 && !qflag && !pc.binary) {
+ if (t == 0 && !lflag && !qflag && !pc.binary) {
printline(&pc, ':');
first_match = false;
same_file = true;

File Metadata

Mime Type
text/plain
Expires
Sat, Aug 22, 9:58 AM (3 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37070654
Default Alt Text
D10607.id28048.diff (1 KB)

Event Timeline