Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jun 2001 03:08:49 -0700 (PDT)
From:      bill@twwells.com
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/28095: [PATCH] pax may descend into directories even when -d specified
Message-ID:  <200106121008.f5CA8nC54137@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106121008.f5CA8nC54137>