tar-1.15.1-mangling.patch   [plain text]


--- src/common.h.mangling	2006-12-04 12:47:40.000000000 +0100
+++ src/common.h	2006-12-04 12:47:40.000000000 +0100
@@ -124,6 +124,9 @@
 
 GLOBAL bool absolute_names_option;
 
+/* Allow GNUTYPE_NAMES type? */
+GLOBAL bool allow_name_mangling_option;
+
 /* Display file times in UTC */
 GLOBAL bool utc_option;
 
--- src/extract.c.mangling	2006-12-04 12:47:40.000000000 +0100
+++ src/extract.c	2006-12-04 12:47:40.000000000 +0100
@@ -1168,7 +1168,13 @@
       break;
 
     case GNUTYPE_NAMES:
-      extract_mangle ();
+      if (allow_name_mangling_option) {
+          extract_mangle ();
+      }
+      else {
+          ERROR ((0, 0, _("GNUTYPE_NAMES mangling ignored")));
+          skip_member ();
+      }
       break;
 
     case GNUTYPE_MULTIVOL:
--- src/tar.c.mangling	2006-12-04 12:47:40.000000000 +0100
+++ src/tar.c	2006-12-04 12:55:35.000000000 +0100
@@ -181,6 +181,7 @@
 enum
 {
   ANCHORED_OPTION = CHAR_MAX + 1,
+  ALLOW_NAME_MANGLING_OPTION,
   ATIME_PRESERVE_OPTION,
   BACKUP_OPTION,
   CHECKPOINT_OPTION,
@@ -528,6 +529,8 @@
 
   {NULL, 'o', 0, 0,
    N_("when creating, same as --old-archive. When extracting, same as --no-same-owner"), 91 },
+  {"allow-name-mangling", ALLOW_NAME_MANGLING_OPTION, 0, 0,
+   N_("when creating, allow GNUTYPE_NAMES mangling -- considered dangerous"), 91 },
 
   {NULL, 0, NULL, 0,
    N_("Other options:"), 100 },
@@ -914,6 +917,10 @@
     case 'Z':
       set_use_compress_program_option ("compress");
       break;
+
+    case ALLOW_NAME_MANGLING_OPTION:
+      allow_name_mangling_option = true;
+      break;
       
     case ANCHORED_OPTION:
       args->exclude_options |= EXCLUDE_ANCHORED;