]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
Quote arguments in diagnostic messages.
authorDavid Leadbeater <dgl@dgl.cx>
Wed, 12 Nov 2025 11:09:02 +0000 (13:09 +0200)
committerSergey Poznyakoff <gray@gnu.org>
Wed, 12 Nov 2025 11:11:00 +0000 (13:11 +0200)
Copyright-paperwork-exempt: yes

src/extract.c
src/xattrs.c
src/xheader.c

index 7bf41feff52d7ec793918a4bfcdcb9089b81afbb..010966bace172a1aeccccf1c0391244331b08db2 100644 (file)
@@ -370,7 +370,7 @@ check_time (char const *file_name, struct timespec t)
 {
   if (t.tv_sec < 0)
     warnopt (WARN_TIMESTAMP, 0, _("%s: implausibly old time stamp %s"),
-            file_name, tartime (t, true));
+            quotearg_colon (file_name), tartime (t, true));
   else if (timespec_cmp (volume_start_time, t) < 0)
     {
       struct timespec now;
@@ -387,7 +387,8 @@ check_time (char const *file_name, struct timespec t)
              diff.tv_sec--;
            }
          warnopt (WARN_TIMESTAMP, 0, _("%s: time stamp %s is %s s in the future"),
-                  file_name, tartime (t, true), code_timespec (diff, buf));
+                  quotearg_colon (file_name), tartime (t, true),
+                  code_timespec (diff, buf));
        }
     }
 }
@@ -916,7 +917,8 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made)
       switch (old_files_option)
        {
        case SKIP_OLD_FILES:
-         warnopt (WARN_EXISTING_FILE, 0, _("%s: skipping existing file"), file_name);
+         warnopt (WARN_EXISTING_FILE, 0, _("%s: skipping existing file"),
+                  quotearg_colon (file_name));
          return RECOVER_SKIP;
 
        case KEEP_OLD_FILES:
index 2f45025018931a04f99b036a4a3bc080d1ca6398..445dde345dc9b6123192f0384323921bf7fcb516 100644 (file)
@@ -297,7 +297,7 @@ xattrs__acls_set (struct tar_stat_info const *st,
        warnopt (WARN_XATTR_WRITE, errno,
                  _("acl_delete_def_file_at: Cannot drop default POSIX ACLs "
                    "for file '%s'"),
-                file_name);
+                quote (file_name));
       return;
     }
   else
@@ -313,7 +313,7 @@ xattrs__acls_set (struct tar_stat_info const *st,
     /* warn even if filesystem does not support acls */
     warnopt (WARN_XATTR_WRITE, errno,
             _ ("acl_set_file_at: Cannot set POSIX ACLs for file '%s'"),
-            file_name);
+            quote (file_name));
 
   acl_free (acl);
 }
@@ -610,7 +610,7 @@ xattrs__fd_set (char const *file_name, char typeflag,
       if (ret < 0)
        warnopt (WARN_XATTR_WRITE, errno,
                 _("%s: Cannot set '%s' extended attribute for file '%s'"),
-                sysname, attr, file_name);
+                sysname, attr, quote (file_name));
     }
 }
 #endif
@@ -675,7 +675,7 @@ xattrs_selinux_set (MAYBE_UNUSED struct tar_stat_info const *st,
       if (ret < 0)
        warnopt (WARN_XATTR_WRITE, errno,
                 _("%s: Cannot set SELinux context for file '%s'"),
-                sysname, file_name);
+                sysname, quote (file_name));
 #endif
     }
 }
index b940e7f4f2c9f23677106093c8396c584a6ed632..6d2f4d473c83a31a12fca77d382aca194405575f 100644 (file)
@@ -973,7 +973,7 @@ out_of_range_header (char const *keyword, char const *value,
   /* TRANSLATORS: The first %s is the pax extended header keyword
      (atime, gid, etc.).  */
   paxerror (0, _("Extended header %s=%s is out of range %jd..%ju"),
-           keyword, value, minval, maxval);
+           keyword, quote (value), minval, maxval);
 }
 
 static void
@@ -1024,13 +1024,13 @@ decode_time (struct timespec *ts, char const *arg, char const *keyword)
                             TYPE_MAXIMUM (time_t));
       else
        paxerror (0, _("Malformed extended header: invalid %s=%s"),
-                 keyword, arg);
+                 keyword, quote (arg));
       return false;
     }
   if (*arg_lim)
     {
       paxerror (0, _("Malformed extended header: invalid %s=%s"),
-               keyword, arg);
+               keyword, quote (arg));
       return false;
     }
 
@@ -1064,7 +1064,7 @@ decode_signed_num (intmax_t *num, char const *arg,
   if ((arg_lim == arg) | *arg_lim)
     {
       paxerror (0, _("Malformed extended header: invalid %s=%s"),
-               keyword, arg);
+               keyword, quote (arg));
       return false;
     }
 
@@ -1417,7 +1417,7 @@ sparse_map_decoder (struct tar_stat_info *st,
       if (delim == arg)
        {
          paxerror (0, _("Malformed extended header: invalid %s=%s"),
-                   keyword, arg);
+                   keyword, quote (arg));
          return;
        }
 
@@ -1443,7 +1443,7 @@ sparse_map_decoder (struct tar_stat_info *st,
          else
            {
              paxerror (0, _("Malformed extended header: excess %s=%s"),
-                       keyword, arg);
+                       keyword, quote (arg));
              return;
            }
        }