bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nodump flag


From: Walter C. Pelissero
Subject: nodump flag
Date: Tue, 20 Nov 2001 15:34:45 +0000

It would be nice if GNU tar would honor the nodump flag available on
UFS/FFS (FreeBSD, NetBSD), and EXT2FS (Linux) filesystem.

It's not difficult to implement and the benefit IMHO is substantial.
Hereafter is an example for FreeBSD.  AFAIK Linux is not very
different.

Cheers,



diff -r -u tar-1.13.orig/src/common.h tar-1.13/src/common.h
--- tar-1.13.orig/src/common.h  Tue Nov 20 15:04:26 2001
+++ tar-1.13/src/common.h       Tue Nov 20 15:14:49 2001
@@ -143,6 +143,9 @@
 /* Boolean value.  */
 GLOBAL int dereference_option;
 
+/* Boolean value.  */
+GLOBAL int honor_nodump_option;
+
 /* Patterns that match file names to be excluded.  */
 GLOBAL struct exclude *excluded;
 
diff -r -u tar-1.13.orig/src/create.c tar-1.13/src/create.c
--- tar-1.13.orig/src/create.c  Tue Nov 20 15:04:25 2001
+++ tar-1.13/src/create.c       Tue Nov 20 15:18:14 2001
@@ -1483,6 +1483,12 @@
          if (is_dot_or_dotdot (entry->d_name)
              || excluded_filename (excluded, entry->d_name))
            continue;
+#ifdef __FreeBSD__
+         /* If file has NODUMP flag set, ignore it.  Accordingly skip
+            the whole tree under a directory. */
+         if (honor_nodump_option && (current_stat.st_flags & UF_NODUMP))
+           continue;
+#endif
 
          if ((int) NAMLEN (entry) + len >= buflen)
            {
diff -r -u tar-1.13.orig/src/tar.c tar-1.13/src/tar.c
--- tar-1.13.orig/src/tar.c     Tue Nov 20 15:04:26 2001
+++ tar-1.13/src/tar.c  Tue Nov 20 15:21:57 2001
@@ -187,6 +187,7 @@
   {"gunzip", no_argument, NULL, 'z'},
   {"gzip", no_argument, NULL, 'z'},
   {"help", no_argument, &show_help, 1},
+  {"honor-nodump", no_argument, NULL, 'H'},
   {"ignore-failed-read", no_argument, &ignore_failed_read_option, 1},
   {"ignore-zeros", no_argument, NULL, 'i'},
   /* FIXME: --ignore-end as a new name for --ignore-zeros?  */
@@ -416,7 +417,7 @@
    Y  per-block gzip compression */
 
 #define OPTION_STRING \
-  "-01234567ABC:F:GK:L:MN:OPRST:UV:WX:Zb:cdf:g:hiklmoprstuvwxz"
+  "-01234567ABC:F:GHK:L:MN:OPRST:UV:WX:Zb:cdf:g:hiklmoprstuvwxz"
 
 static void
 set_subcommand_option (enum subcommand subcommand)
@@ -623,6 +624,12 @@
        /* Follow symbolic links.  */
 
        dereference_option = 1;
+       break;
+
+      case 'H':
+       /* Honor NODUMP flag.  */
+
+       honor_nodump_option = 1;
        break;
 
       case 'i':



-- 
walter pelissero
http://www.pelissero.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]