From owner-freebsd-hackers Wed Nov 21 6:19: 4 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from pelissero.org (dyn204-40.sftm-212-159.plus.net [212.159.40.204]) by hub.freebsd.org (Postfix) with ESMTP id 7DFA237B41B for ; Wed, 21 Nov 2001 06:18:51 -0800 (PST) Received: (from wcp@localhost) by pelissero.org (8.11.6/8.9.3) id fALEIj197347; Wed, 21 Nov 2001 14:18:45 GMT (envelope-from wcp) From: "Walter C. Pelissero" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15355.47042.573852.420151@hyde.lpds.sublink.org> Date: Wed, 21 Nov 2001 14:18:42 +0000 To: hackers@FreeBSD.ORG Subject: tar and nodump flag X-Mailer: VM 6.92 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid Reply-To: walter@pelissero.org X-Attribution: WP Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG How about adding the nodump flag processing in tar? Something like: --- /usr/src/gnu/usr.bin/tar/create.c Wed Aug 11 09:03:39 1999 +++ create.c Wed Nov 21 13:52:54 2001 @@ -817,6 +817,8 @@ strcpy (namebuf + len, d->d_name); if (f_exclude && check_exclude (namebuf)) continue; + if (hstat.st_flags & UF_NODUMP) + continue; dump_file (namebuf, our_device, 0); } Or something like this patch I've submited to the GNU tar mailing list: 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': BTW, the ancient GNU tar (1.11.2) FreeBSD has bundled with the system happens to have a bug that makes it inconvenient with modern tapes. The tape length (option -L) is stored in a signed integer; a DAT DDS-2 is already too big for that. I would recommend to upgrade to the new 1.13, which, together with a brand new set of bugs, introduces the TARLONG type to store such informations as tape length. -- walter pelissero http://www.pelissero.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message