NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/49224: [PATCH] Checking for uname in usr.bin/grep/tests/t_grep:binary is still not 100% reliable if branded OS name doesn't match ELF binary branding



>Number:         49224
>Category:       bin
>Synopsis:       [PATCH] Checking for uname in usr.bin/grep/tests/t_grep:binary 
>is still not 100% reliable if branded OS name doesn't match ELF binary branding
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 19 21:40:01 +0000 2014
>Originator:     Garrett Cooper
>Release:        n/a
>Organization:
EMC / Isilon Storage Division
>Environment:
n/a
>Description:
The fix I described in PR/47825 addressed the simple case of FreeBSD vs NetBSD, 
but it doesn't address the larger issue with /bin/sh being grep'ed for ELF 
branding information.

What I did instead (because I'm working for a company that rebrands FreeBSD as 
another OS), is I modified the test again to instead generate binary output, 
echo foobar out to the output, then grep for the expected output. This change 
will make the testcase robust in all cases.

$ svn diff t_grep.sh
Index: t_grep.sh
===================================================================
--- t_grep.sh   (revision 437720)
+++ t_grep.sh   (working copy)
@@ -43,7 +43,10 @@
 }
 binary_body()
 {
-       atf_check -o file:"$(atf_get_srcdir)/d_binary.out" grep $(uname) /bin/sh
+       dd if=/dev/random count=1 of=test.file
+       echo -n "foobar" >> test.file
+       atf_check -o file:"$(atf_get_srcdir)/d_binary.out" grep foobar test.file
 }

 atf_test_case recurse
$ svn diff d_binary.out
Index: d_binary.out
===================================================================
--- d_binary.out        (revision 437720)
+++ d_binary.out        (working copy)
@@ -1 +1 @@
-Binary file /bin/sh matches
+Binary file test.file matches
>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index