From owner-freebsd-bugs Tue Jun 12 3:10: 8 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 3927C37B403 for ; Tue, 12 Jun 2001 03:10:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.3/8.11.3) id f5CAA1M54358; Tue, 12 Jun 2001 03:10:01 -0700 (PDT) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 5A3F837B401 for ; Tue, 12 Jun 2001 03:08:49 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.3/8.11.3) id f5CA8nC54137; Tue, 12 Jun 2001 03:08:49 -0700 (PDT) (envelope-from nobody) Message-Id: <200106121008.f5CA8nC54137@freefall.freebsd.org> Date: Tue, 12 Jun 2001 03:08:49 -0700 (PDT) From: bill@twwells.com To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/28095: [PATCH] pax may descend into directories even when -d specified Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 28095 >Category: misc >Synopsis: [PATCH] pax may descend into directories even when -d specified >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jun 12 03:10:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Bill Wells >Release: 4.3-STABLE >Organization: >Environment: >Description: When the -d option is specified and a -T, -G, or -U option causes a directory to be skipped, pax will descend into that directory. Other selection options may have a similar problem. I have not addressed that. >How-To-Repeat: pax -w -v -d -G tty -f /dev/null /usr/bin This will dump wall and write, which are group tty, even though the -d option says to not descend into /usr/bin. >Fix: Sorry for the very likely screwiness of this patch; this is not my normal interface. When my system is back up, I'll e-mail the patch if requested. diff -bru pax.orig/ar_subs.c pax/ar_subs.c --- pax.orig/ar_subs.c Fri Aug 27 16:14:39 1999 +++ pax/ar_subs.c Tue Jun 12 02:53:37 2001 @@ -395,8 +395,10 @@ /* * check if this file meets user specified options match. */ - if (sel_chk(arcn) != 0) + if (sel_chk(arcn) != 0) { + ftree_notsel(arcn); continue; + } fd = -1; if (uflag) { /* @@ -791,9 +793,10 @@ /* * check if this file meets user specified options */ - if (sel_chk(arcn) != 0) + if (sel_chk(arcn) != 0) { + ftree_notsel(arcn); continue; - + } /* * if there is already a file in the destination directory with * the same name and it is newer, skip the one stored on the diff -bru pax.orig/extern.h pax/extern.h --- pax.orig/extern.h Mon Mar 5 04:30:41 2001 +++ pax/extern.h Tue Jun 12 02:48:42 2001 @@ -157,6 +157,7 @@ int ftree_start __P((void)); int ftree_add __P((register char *)); void ftree_sel __P((register ARCHD *)); +void ftree_notsel __P((register ARCHD *)); void ftree_chk __P((void)); int next_file __P((register ARCHD *)); diff -bru pax.orig/ftree.c pax/ftree.c --- pax.orig/ftree.c Fri Aug 27 16:14:42 1999 +++ pax/ftree.c Tue Jun 12 02:48:21 2001 @@ -234,6 +234,24 @@ } /* + * ftree_notsel() + * this entry has been skipped by pax. + */ + +#if __STDC__ +void +ftree_notsel(register ARCHD *arcn) +#else +void +ftree_notsel(arcn) + register ARCHD *arcn; +#endif +{ + if (ftent != NULL) + (void)fts_set(ftsp, ftent, FTS_SKIP); +} + +/* * ftree_chk() * called at end on pax execution. Prints all those file args that did not * have a selected member (reference count still 0) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message