Quote arguments in diagnostic messages.

Copyright-paperwork-exempt: yes
This commit is contained in:
David Leadbeater 2025-11-12 13:09:02 +02:00 committed by Sergey Poznyakoff
parent f501cf8c9a
commit 5def5cb369
3 changed files with 15 additions and 13 deletions

View 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:

View 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
}
}

View 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;
}
}