bin/120249: [gzip] [patch] znew(1) is broken

Jaakko Heinonen jh at saunalahti.fi
Mon Feb 4 03:30:01 PST 2008


>Number:         120249
>Category:       bin
>Synopsis:       [gzip] [patch] znew(1) is broken
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 04 11:30:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Jaakko Heinonen
>Release:        7.0-RC1
>Organization:
>Environment:
>Description:
1) /usr/bin/znew script points to an interpreter (/bin/ksh) which doesn't exist in FreeBSD base.

2) The script uses a non-existent gzip command line option (-o).

3) After applying the patch provided below znew(1) -v switch still generates a different output compared to GNU znew.
>How-To-Repeat:
$ znew
znew: not found
$ head -1 /usr/bin/znew
#!/bin/ksh -

>Fix:


Patch attached with submission follows:

Index: znew
===================================================================
RCS file: /home/ncvs/src/usr.bin/gzip/znew,v
retrieving revision 1.1
diff -u -r1.1 znew
--- znew	26 Jan 2007 10:19:07 -0000	1.1
+++ znew	3 Feb 2008 19:54:24 -0000
@@ -1,4 +1,4 @@
-#!/bin/ksh -
+#!/bin/sh -
 #
 # $NetBSD: znew,v 1.2 2003/12/28 12:43:43 wiz Exp $
 # $OpenBSD: znew,v 1.2 2003/08/05 18:22:17 deraadt Exp $
@@ -60,7 +60,7 @@
 	trap 'rm -f "$tmp"; exit 1' HUP INT QUIT PIPE TERM
 
 	# Do the actual work, producing a file "$tmp"
-	if uncompress -f -c < "$filez" | gzip -f $gzipflags -o "$tmp"; then
+	if uncompress -f -c < "$filez" | gzip -cf $gzipflags > "$tmp"; then
 
 		if test $kflag -eq 1 && smaller "$filez" "$tmp"; then
 			echo -n "$prog: $filez is smaller than $filegz"
@@ -120,7 +120,7 @@
 	esac
 done
 
-shift OPTIND-1
+shift $(($OPTIND-1))
 
 if test $# -eq 0; then
 	echo "$usage"


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list