]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
Fix --verbatim-files-from
authorSergey Poznyakoff <gray@gnu.org.ua>
Thu, 9 Nov 2017 06:59:36 +0000 (08:59 +0200)
committerSergey Poznyakoff <gray@gnu.org.ua>
Thu, 9 Nov 2017 07:06:26 +0000 (09:06 +0200)
* src/names.c (read_next_name): Don't unquote name read from the
file, if --verbatim-files-from option is in effect.
(names_options): improve description of --verbatim-files-from
* tests/T-null2.at: Test the change.

src/names.c
tests/T-null2.at

index d14b524a25ae0621c044a74d27b6f8a490d9446c..bd1e44e35526d5ca3a823462e13a7a3fa0c5aa6d 100644 (file)
@@ -84,7 +84,7 @@ static struct argp_option names_options[] = {
   {"no-unquote", NO_UNQUOTE_OPTION, 0, 0,
    N_("do not unquote input file or member names"), GRID+1 },
   {"verbatim-files-from", VERBATIM_FILES_FROM_OPTION, 0, 0,
-   N_("-T reads file names verbatim (no option handling)"), GRID+1 },
+   N_("-T reads file names verbatim (no escape or option handling)"), GRID+1 },
   {"no-verbatim-files-from", NO_VERBATIM_FILES_FROM_OPTION, 0, 0,
    N_("-T treats file names starting with dash as options (default)"),
       GRID+1 },
@@ -1027,12 +1027,15 @@ read_next_name (struct name_elt *ent, struct name_elt *ret)
          ent->v.file.term = 0;
          /* fall through */
        case file_list_success:
-         if (unquote_option)
-           unquote_string (name_buffer);
-         if (!ent->v.file.verbatim && handle_option (name_buffer, ent) == 0)
+         if (!ent->v.file.verbatim)
            {
-             name_list_adjust ();
-             return 1;
+             if (unquote_option)
+               unquote_string (name_buffer);
+             if (handle_option (name_buffer, ent) == 0)
+               {
+                 name_list_adjust ();
+                 return 1;
+               }
            }
          ret->type = NELT_NAME;
          ret->v.name = name_buffer;
index 6ab8d5b3930a4fb504c1bcaf5bd0b6a947e3a109..b3c4e44b9997e360d1c234dc7e16b761b91c8538 100644 (file)
@@ -25,11 +25,13 @@ AT_TAR_CHECK([
 AT_DATA([file-list],[a
 -b
 --c d
+:\\.jpg
 ])
 
 genfile -f a
 genfile -f -b
 genfile -f '--c d'
+genfile -f ':\\.jpg'
 
 cat file-list | tr '\n' '\0' | tar -c -f archive -v --null -T -
 ],
@@ -37,6 +39,7 @@ cat file-list | tr '\n' '\0' | tar -c -f archive -v --null -T -
 [a
 -b
 --c d
+:\\\\.jpg
 ],
 [],[],[],[ustar]) # Testing one format is enough