From nobody@FreeBSD.org  Tue Jul 10 08:51:42 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id BA79716A400
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 10 Jul 2007 08:51:42 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 9282913C45D
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 10 Jul 2007 08:51:42 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l6A8pggA077763
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 10 Jul 2007 08:51:42 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l6A8pgXq077762;
	Tue, 10 Jul 2007 08:51:42 GMT
	(envelope-from nobody)
Message-Id: <200707100851.l6A8pgXq077762@www.freebsd.org>
Date: Tue, 10 Jul 2007 08:51:42 GMT
From: Ighighi <ighighi@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch]: gzip(1): bad recursive behaviour 
X-Send-Pr-Version: www-3.0

>Number:         114470
>Category:       bin
>Synopsis:       [patch]: gzip(1): bad recursive behaviour
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    delphij
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 10 09:00:10 GMT 2007
>Closed-Date:    Mon Aug 06 02:32:22 GMT 2007
>Last-Modified:  Mon Aug  6 02:40:02 GMT 2007
>Originator:     Ighighi
>Release:        6.2-STABLE
>Organization:
>Environment:
FreeBSD orion 6.2-STABLE FreeBSD 6.2-STABLE #3: Mon Jul  9 23:03:53 VET 2007     root@orion:/usr/obj/usr/src/sys/CUSTOM  i386

>Description:
The handle_dir() function should pass fts_path and not fts_name because the latter
is the basename(3).  Because of this, not just verbose output but error messages
as well are ambiguous when files with the same name exist...
It's also an issue when compatibility with GNU gzip(1) is desired.
>How-To-Repeat:
$ /bin/mkdir /tmp/x /tmp/y
$ /bin/cp /etc/services /tmp/x
$ /bin/cp /etc/services /tmp/y
$ /bin/chmod 000 /tmp/x/services
$ /usr/bin/gzip -vr /tmp/x /tmp/y
gzip: can't open services: Permission denied
services:          71.7% -- replaced with services.gz
$ /usr/bin/gzip --version
FreeBSD gzip 20070528

### Now with GNU gzip(1) in ports:

$ /bin/mkdir /tmp/x /tmp/y
$ /bin/cp /etc/services /tmp/x
$ /bin/cp /etc/services /tmp/y
$ /bin/chmod 000 /tmp/x/services
$ /usr/local/bin/gzip -vr /tmp/x /tmp/y
gzip: /tmp/x/services: Permission denied
/tmp/y/services:         71.8% -- replaced with /tmp/y/services.gz
$ /usr/local/bin/gzip --version
gzip 1.3.12
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Jean-loup Gailly.

>Fix:
Attached patch successfully built and tested on FreeBSD 6.2-STABLE and
known to patch in -CURRENT.

To apply, run:
patch -d /usr < /path/to/patch
cd /usr/src/usr.bin/gzip
make clean obj depend && make && make install

Patch attached with submission follows:

--- src/usr.bin/gzip/gzip.c.orig	Sat Jun 30 06:13:00 2007
+++ src/usr.bin/gzip/gzip.c	Tue Jul 10 04:08:11 2007
@@ -1806,7 +1806,7 @@
 
 	path_argv[0] = dir;
 	path_argv[1] = 0;
-	fts = fts_open(path_argv, FTS_PHYSICAL, NULL);
+	fts = fts_open(path_argv, FTS_PHYSICAL | FTS_NOCHDIR, NULL);
 	if (fts == NULL) {
 		warn("couldn't fts_open %s", dir);
 		return;
@@ -1824,7 +1824,7 @@
 			maybe_warn("%s", entry->fts_path);
 			continue;
 		case FTS_F:
-			handle_file(entry->fts_name, entry->fts_statp);
+			handle_file(entry->fts_path, entry->fts_statp);
 		}
 	}
 	(void)fts_close(fts);


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->delphij 
Responsible-Changed-By: rodrigc 
Responsible-Changed-When: Tue Jul 10 17:25:57 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=114470 
State-Changed-From-To: open->patched 
State-Changed-By: delphij 
State-Changed-When: Thu Jul 12 01:19:52 UTC 2007 
State-Changed-Why:  
Patch applied against -HEAD, pending MFC. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=114470 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/114470: commit references a PR
Date: Thu, 12 Jul 2007 01:17:20 +0000 (UTC)

 delphij     2007-07-12 01:17:14 UTC
 
   FreeBSD src repository
 
   Modified files:
     usr.bin/gzip         gzip.c 
   Log:
    - Simulate GNU gzip(1) behavior where full filename is
      being output in verbose mode when doing recursive[1].
    - Use better representation of S:
   
   PR:             bin/114470
   Submitted by:   Ighighi <ighighi gmail com> [1]
   Approved by:    re (hrs)
   
   Revision  Changes    Path
   1.4       +7 -7      src/usr.bin/gzip/gzip.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: delphij 
State-Changed-When: Mon Aug 6 02:32:03 UTC 2007 
State-Changed-Why:  
Patch applied against RELENG_6, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=114470 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/114470: commit references a PR
Date: Mon,  6 Aug 2007 02:31:33 +0000 (UTC)

 delphij     2007-08-06 02:31:25 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     usr.bin/gzip         gzip.c 
   Log:
   MFC revision 1.4:
   date: 2007/07/12 01:17:14;  author: delphij;  state: Exp;  lines: +7 -7
    - Simulate GNU gzip(1) behavior where full filename is
      being output in verbose mode when doing recursive[1].
    - Use better representation of S:
   
   PR:             bin/114470
   Submitted by:   Ighighi <ighighi gmail com> [1]
   
   Revision  Changes    Path
   1.2.2.3   +7 -7      src/usr.bin/gzip/gzip.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
