From owner-freebsd-bugs@FreeBSD.ORG Tue Jul 10 09:00:13 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 767DB16A46D for ; Tue, 10 Jul 2007 09:00:13 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 91E8813C46C for ; Tue, 10 Jul 2007 09:00:11 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l6A90BNI060137 for ; Tue, 10 Jul 2007 09:00:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l6A90BBi060136; Tue, 10 Jul 2007 09:00:11 GMT (envelope-from gnats) Resent-Date: Tue, 10 Jul 2007 09:00:11 GMT Resent-Message-Id: <200707100900.l6A90BBi060136@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ighighi Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BA79716A400 for ; 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 ; 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 ; 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 To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: bin/114470: [patch]: gzip(1): bad recursive behaviour X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2007 09:00:13 -0000 >Number: 114470 >Category: bin >Synopsis: [patch]: gzip(1): bad recursive behaviour >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: Tue Jul 10 09:00:10 GMT 2007 >Closed-Date: >Last-Modified: >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 . 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: >Unformatted: