NetBSD Problem Report #51875

From www@NetBSD.org  Sat Jan 14 13:29:39 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 335617A26D
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 14 Jan 2017 13:29:39 +0000 (UTC)
Message-Id: <20170114132938.111EC7A287@mollari.NetBSD.org>
Date: Sat, 14 Jan 2017 13:29:38 +0000 (UTC)
From: yaneurabeya@gmail.com
Reply-To: yaneurabeya@gmail.com
To: gnats-bugs@NetBSD.org
Subject: [PATCH] tests/usr.bin/grep/...: portability fixes
X-Send-Pr-Version: www-1.0

>Number:         51875
>Category:       bin
>Synopsis:       [PATCH] tests/usr.bin/grep/...: portability fixes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 14 13:30:00 +0000 2017
>Closed-Date:    Sun Jan 15 20:30:55 +0000 2017
>Last-Modified:  Sun Jan 15 20:30:55 +0000 2017
>Originator:     Ngie Cooper
>Release:        7.0.2
>Organization:
>Environment:
n/a
>Description:
The attached patch does the following 2 things to ensure improved portability:
1. Doesn't assume that uname output is in /bin/sh ([un]fortunately uname can be overridden on FreeBSD, which means that the binary branding might not match the OS branding). Create a bogus temporary file instead.
2. Sort the output from grep, as not all filesystems might presenting the output in the same way.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/51875: [PATCH] tests/usr.bin/grep/...: portability fixes
Date: Sat, 14 Jan 2017 05:30:45 -0800

 --Apple-Mail=_4B34A360-E4DA-4571-B2C4-22317F1301C2
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 Patch attached.
 -Ngie

 --Apple-Mail=_4B34A360-E4DA-4571-B2C4-22317F1301C2
 Content-Disposition: attachment;
 	filename=t_grep-portability-fixes.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_grep-portability-fixes.patch"
 Content-Transfer-Encoding: 7bit

 Index: usr.bin/grep/d_binary.out
 ===================================================================
 RCS file: /cvsroot/src/tests/usr.bin/grep/d_binary.out,v
 retrieving revision 1.1
 diff -u -r1.1 d_binary.out
 --- usr.bin/grep/d_binary.out	17 Mar 2012 16:33:13 -0000	1.1
 +++ usr.bin/grep/d_binary.out	14 Jan 2017 13:27:00 -0000
 @@ -1 +1 @@
 -Binary file /bin/sh matches
 +Binary file test.file matches
 Index: usr.bin/grep/t_grep.sh
 ===================================================================
 RCS file: /cvsroot/src/tests/usr.bin/grep/t_grep.sh,v
 retrieving revision 1.2
 diff -u -r1.2 t_grep.sh
 --- usr.bin/grep/t_grep.sh	17 May 2013 15:39:17 -0000	1.2
 +++ usr.bin/grep/t_grep.sh	14 Jan 2017 13:27:00 -0000
 @@ -43,7 +43,9 @@
  }
  binary_body()
  {
 -	atf_check -o file:"$(atf_get_srcdir)/d_binary.out" grep $(uname) /bin/sh
 +	dd if=/dev/zero 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
 @@ -57,7 +59,7 @@
  	echo -e "cod\ndover sole\nhaddock\nhalibut\npilchard" > recurse/d/fish
  	echo -e "cod\nhaddock\nplaice" > recurse/a/f/favourite-fish

 -	atf_check -o file:"$(atf_get_srcdir)/d_recurse.out" grep -r haddock recurse
 +	atf_check -o file:"$(atf_get_srcdir)/d_recurse.out" -x "grep -r haddock recurse | sort"
  }

  atf_test_case recurse_symlink

 --Apple-Mail=_4B34A360-E4DA-4571-B2C4-22317F1301C2--

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51875 CVS commit: src/tests/usr.bin/grep
Date: Sat, 14 Jan 2017 15:43:52 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sat Jan 14 20:43:52 UTC 2017

 Modified Files:
 	src/tests/usr.bin/grep: d_binary.out t_grep.sh

 Log Message:
 PR/51875: Ngie Cooper: portability fixes


 To generate a diff of this commit:
 cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/grep/d_binary.out
 cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/grep/t_grep.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: snj@NetBSD.org
State-Changed-When: Sun, 15 Jan 2017 20:30:55 +0000
State-Changed-Why:
christos committed it. thanks!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.