summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2015-10-28 13:02:31 +0000
committerPádraig Brady <P@draigBrady.com>2015-11-04 02:03:41 +0000
commitab40a941a07d80326aaa051e3c94c88b800cbd7d (patch)
tree382e656f126d0e63ca1158f8f43630e1dd10d18b
parent00eb7af8ea30ccbefeb17213cd644b8f0ade1ef8 (diff)
downloadcoreutils-ab40a941a07d80326aaa051e3c94c88b800cbd7d.tar.xz
all: replace most uses of quotearg_colon() with quote()
Related to commit v8.24-61-g6796698 this provides more consistent quoting, as quotearg_colon() defaults to "literal" quoting by default, while quote() provides appropriate quoting for diagnostics by default. * gl/modules/randread: Depend on quote module rather than quotearg. * gl/lib/randread.c: Used quote() not quotearg_colon(). * src/: Likewise. * src/shred.c: Likewise. Also avoid unnecessary quoting introducing overhead when wiping names. * cfg.mk: Relax the matching expression to allow "qname" variables as used in shred.c to satisfy the check. * tests/: Adjust accordingly.
-rw-r--r--cfg.mk2
-rw-r--r--gl/lib/randread.c4
-rw-r--r--gl/modules/randread2
-rw-r--r--src/chcon.c3
-rw-r--r--src/chmod.c3
-rw-r--r--src/du.c9
-rw-r--r--src/head.c5
-rw-r--r--src/install.c3
-rw-r--r--src/ls.c6
-rw-r--r--src/runcon.c5
-rw-r--r--src/shred.c55
-rw-r--r--src/shuf.c5
-rw-r--r--src/sort.c2
-rw-r--r--src/stat.c3
-rw-r--r--src/tac.c19
-rw-r--r--src/wc.c5
-rwxr-xr-xtests/du/files0-from-dir.sh4
-rwxr-xr-xtests/du/files0-from.pl8
-rwxr-xr-xtests/du/move-dir-while-traversing.sh2
-rwxr-xr-xtests/misc/shred-passes.sh6
-rwxr-xr-xtests/misc/sort-files0-from.pl6
-rwxr-xr-xtests/misc/stat-printf.pl4
-rwxr-xr-xtests/misc/wc-files0-from.pl8
23 files changed, 78 insertions, 91 deletions
diff --git a/cfg.mk b/cfg.mk
index 86373b827..208f2ce80 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -182,7 +182,7 @@ sc_prohibit_quotes_notation:
# on a separate line to the following arguments.
sc_error_quotes:
@cd $(srcdir)/src && GIT_PAGER= git grep -n 'error *(.*%s.*, [^(]*);$$'\
- *.c | grep -v quote \
+ *.c | grep -v ', q' \
&& { echo '$(ME): '"Use quote() for error string arguments" 1>&2; \
exit 1; } \
|| :
diff --git a/gl/lib/randread.c b/gl/lib/randread.c
index 5efbd4fe4..bd5e38650 100644
--- a/gl/lib/randread.c
+++ b/gl/lib/randread.c
@@ -28,7 +28,7 @@
#include <error.h>
#include <exitfail.h>
#include <fcntl.h>
-#include <quotearg.h>
+#include <quote.h>
#include <stdalign.h>
#include <stdbool.h>
#include <stdint.h>
@@ -126,7 +126,7 @@ randread_error (void const *file_name)
if (file_name)
error (exit_failure, errno,
errno == 0 ? _("%s: end of file") : _("%s: read error"),
- quotearg_colon (file_name));
+ quote (file_name));
abort ();
}
diff --git a/gl/modules/randread b/gl/modules/randread
index 14af00e7b..50e1e0eed 100644
--- a/gl/modules/randread
+++ b/gl/modules/randread
@@ -13,7 +13,7 @@ exitfail
inline
fopen-safer
gettimeofday
-quotearg
+quote
stdalign
stdbool
stdint
diff --git a/src/chcon.c b/src/chcon.c
index 674d03366..4f51d70d4 100644
--- a/src/chcon.c
+++ b/src/chcon.c
@@ -24,7 +24,6 @@
#include "error.h"
#include "ignore-value.h"
#include "quote.h"
-#include "quotearg.h"
#include "root-dev-ino.h"
#include "selinux-at.h"
#include "xfts.h"
@@ -98,7 +97,7 @@ compute_context_from_mask (char const *context, context_t *ret)
if (!new_context)
{
error (0, errno, _("failed to create security context: %s"),
- quotearg_colon (context));
+ quote (context));
return 1;
}
diff --git a/src/chmod.c b/src/chmod.c
index 5c6881c44..988ba7269 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -28,7 +28,6 @@
#include "ignore-value.h"
#include "modechange.h"
#include "quote.h"
-#include "quotearg.h"
#include "root-dev-ino.h"
#include "xfts.h"
@@ -312,7 +311,7 @@ process_file (FTS *fts, FTSENT *ent)
new_perms[10] = naively_expected_perms[10] = '\0';
error (0, 0,
_("%s: new permissions are %s, not %s"),
- quotearg_colon (file_full_name),
+ quote (file_full_name),
new_perms + 1, naively_expected_perms + 1);
ok = false;
}
diff --git a/src/du.c b/src/du.c
index 0b405f47d..af6af04f2 100644
--- a/src/du.c
+++ b/src/du.c
@@ -37,7 +37,6 @@
#include "human.h"
#include "mountlist.h"
#include "quote.h"
-#include "quotearg.h"
#include "stat-size.h"
#include "stat-time.h"
#include "stdio--.h"
@@ -692,7 +691,7 @@ du_files (char **files, int bit_flags)
if (errno != 0)
{
error (0, errno, _("fts_read failed: %s"),
- quotearg_colon (fts->fts_path));
+ quote (fts->fts_path));
ok = false;
}
@@ -883,7 +882,7 @@ main (int argc, char **argv)
if (add_exclude_file (add_exclude, exclude, optarg,
EXCLUDE_WILDCARDS, '\n'))
{
- error (0, errno, "%s", quotearg_colon (optarg));
+ error (0, errno, "%s", quote (optarg));
ok = false;
}
break;
@@ -1069,7 +1068,7 @@ main (int argc, char **argv)
goto argv_iter_done;
case AI_ERR_READ:
error (0, errno, _("%s: read error"),
- quotearg_colon (files_from));
+ quote (files_from));
ok = false;
goto argv_iter_done;
case AI_ERR_MEM:
@@ -1106,7 +1105,7 @@ main (int argc, char **argv)
not totally appropriate, since NUL is the separator, not NL,
but it might be better than nothing. */
unsigned long int file_number = argv_iter_n_args (ai);
- error (0, 0, "%s:%lu: %s", quotearg_colon (files_from),
+ error (0, 0, "%s:%lu: %s", quote (files_from),
file_number, _("invalid zero-length file name"));
}
skip_file = true;
diff --git a/src/head.c b/src/head.c
index 410cc4f49..a77376d10 100644
--- a/src/head.c
+++ b/src/head.c
@@ -34,7 +34,6 @@
#include "error.h"
#include "full-read.h"
#include "quote.h"
-#include "quotearg.h"
#include "safe-read.h"
#include "stat-size.h"
#include "xfreopen.h"
@@ -223,7 +222,7 @@ elseek (int fd, off_t offset, int whence, char const *filename)
_(whence == SEEK_SET
? N_("%s: cannot seek to offset %s")
: N_("%s: cannot seek to relative offset %s")),
- quotearg_colon (filename),
+ quote (filename),
offtostr (offset, buf));
return new_offset;
@@ -838,7 +837,7 @@ head (const char *filename, int fd, uintmax_t n_units, bool count_lines,
if (fstat (fd, &st) != 0)
{
error (0, errno, _("cannot fstat %s"),
- quotearg_colon (filename));
+ quote (filename));
return false;
}
if (! presume_input_pipe && usable_st_size (&st))
diff --git a/src/install.c b/src/install.c
index bbd67bc02..d338cbb29 100644
--- a/src/install.c
+++ b/src/install.c
@@ -38,7 +38,6 @@
#include "modechange.h"
#include "prog-fprintf.h"
#include "quote.h"
-#include "quotearg.h"
#include "savewd.h"
#include "stat-time.h"
#include "utimens.h"
@@ -374,7 +373,7 @@ setdefaultfilecon (char const *file)
if (lsetfilecon (file, scontext) < 0 && errno != ENOTSUP)
error (0, errno,
_("warning: %s: failed to change context to %s"),
- quotearg_colon (file), scontext);
+ quote_n (0, file), quote_n (1, scontext));
freecon (scontext);
return;
diff --git a/src/ls.c b/src/ls.c
index ef372553f..ef708dfa3 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -2534,7 +2534,7 @@ set_exit_status (bool serious)
static void
file_failure (bool serious, char const *message, char const *file)
{
- error (0, errno, message, quotearg_colon (file));
+ error (0, errno, message, quote (file));
set_exit_status (serious);
}
@@ -2601,7 +2601,7 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
if (visit_dir (dir_stat.st_dev, dir_stat.st_ino))
{
error (0, 0, _("%s: not listing already-listed directory"),
- quotearg_colon (name));
+ quote (name));
closedir (dirp);
set_exit_status (true);
return;
@@ -3109,7 +3109,7 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
any_has_acl |= f->acl_type != ACL_T_NONE;
if (err)
- error (0, errno, "%s", quotearg_colon (absolute_name));
+ error (0, errno, "%s", quote (absolute_name));
}
if (S_ISLNK (f->stat.st_mode)
diff --git a/src/runcon.c b/src/runcon.c
index ecb12985a..d5ec57958 100644
--- a/src/runcon.c
+++ b/src/runcon.c
@@ -49,7 +49,6 @@
#include "system.h"
#include "error.h"
#include "quote.h"
-#include "quotearg.h"
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "runcon"
@@ -231,7 +230,7 @@ main (int argc, char **argv)
con = context_new (cur_context);
if (!con)
error (EXIT_FAILURE, errno, _("failed to create security context: %s"),
- quotearg_colon (cur_context));
+ quote (cur_context));
if (user && context_user_set (con, user))
error (EXIT_FAILURE, errno, _("failed to set new user: %s"),
quote (user));
@@ -248,7 +247,7 @@ main (int argc, char **argv)
if (security_check_context (context_str (con)) < 0)
error (EXIT_FAILURE, errno, _("invalid context: %s"),
- quotearg_colon (context_str (con)));
+ quote (context_str (con)));
if (setexeccon (context_str (con)) != 0)
error (EXIT_FAILURE, errno, _("unable to set security context %s"),
diff --git a/src/shred.c b/src/shred.c
index 6029d37e3..9c6752881 100644
--- a/src/shred.c
+++ b/src/shred.c
@@ -91,7 +91,6 @@
#include "fcntl--.h"
#include "human.h"
#include "quote.h"
-#include "quotearg.h" /* For quotearg_colon */
#include "randint.h"
#include "randread.h"
#include "stat-size.h"
@@ -341,7 +340,7 @@ dosync (int fd, char const *qname)
err = errno;
if ( ! ignorable_sync_errno (err))
{
- error (0, err, _("%s: fdatasync failed"), quote (qname));
+ error (0, err, _("%s: fdatasync failed"), qname);
errno = err;
return -1;
}
@@ -352,7 +351,7 @@ dosync (int fd, char const *qname)
err = errno;
if ( ! ignorable_sync_errno (err))
{
- error (0, err, _("%s: fsync failed"), quote (qname));
+ error (0, err, _("%s: fsync failed"), qname);
errno = err;
return -1;
}
@@ -470,7 +469,7 @@ dopass (int fd, struct stat const *st, char const *qname, off_t *sizep,
if (! dorewind (fd, st))
{
- error (0, errno, _("%s: cannot rewind"), quote (qname));
+ error (0, errno, _("%s: cannot rewind"), qname);
other_error = true;
goto free_pattern_mem;
}
@@ -490,8 +489,7 @@ dopass (int fd, struct stat const *st, char const *qname, off_t *sizep,
/* Set position if first status update */
if (n)
{
- error (0, 0, _("%s: pass %lu/%lu (%s)..."),
- quote (qname), k, n, pass_string);
+ error (0, 0, _("%s: pass %lu/%lu (%s)..."), qname, k, n, pass_string);
thresh = time (NULL) + VERBOSE_UPDATE;
previous_human_offset = "";
}
@@ -543,7 +541,7 @@ dopass (int fd, struct stat const *st, char const *qname, off_t *sizep,
continue;
}
error (0, errnum, _("%s: error writing at offset %s"),
- quote (qname), umaxtostr (offset + soff, buf));
+ qname, umaxtostr (offset + soff, buf));
/* 'shred' is often used on bad media, before throwing it
out. Thus, it shouldn't give up on bad blocks. This
@@ -563,7 +561,7 @@ dopass (int fd, struct stat const *st, char const *qname, off_t *sizep,
write_error = true;
continue;
}
- error (0, errno, _("%s: lseek failed"), quote (qname));
+ error (0, errno, _("%s: lseek failed"), qname);
}
other_error = true;
goto free_pattern_mem;
@@ -575,7 +573,7 @@ dopass (int fd, struct stat const *st, char const *qname, off_t *sizep,
if (OFF_T_MAX - offset < soff)
{
- error (0, 0, _("%s: file too large"), quote (qname));
+ error (0, 0, _("%s: file too large"), qname);
other_error = true;
goto free_pattern_mem;
}
@@ -600,7 +598,7 @@ dopass (int fd, struct stat const *st, char const *qname, off_t *sizep,
{
if (! known (size))
error (0, 0, _("%s: pass %lu/%lu (%s)...%s"),
- quote (qname), k, n, pass_string, human_offset);
+ qname, k, n, pass_string, human_offset);
else
{
uintmax_t off = offset;
@@ -616,8 +614,8 @@ dopass (int fd, struct stat const *st, char const *qname, off_t *sizep,
if (done)
human_offset = human_size;
error (0, 0, _("%s: pass %lu/%lu (%s)...%s/%s %d%%"),
- quote (qname), k, n, pass_string, human_offset,
- human_size, percent);
+ qname, k, n, pass_string, human_offset, human_size,
+ percent);
}
strcpy (previous_offset_buf, human_offset);
@@ -874,7 +872,7 @@ do_wipefd (int fd, char const *qname, struct randint_source *s,
if (fstat (fd, &st))
{
- error (0, errno, _("%s: fstat failed"), quote (qname));
+ error (0, errno, _("%s: fstat failed"), qname);
return false;
}
@@ -885,12 +883,12 @@ do_wipefd (int fd, char const *qname, struct randint_source *s,
|| S_ISFIFO (st.st_mode)
|| S_ISSOCK (st.st_mode))
{
- error (0, 0, _("%s: invalid file type"), quote (qname));
+ error (0, 0, _("%s: invalid file type"), qname);
return false;
}
else if (S_ISREG (st.st_mode) && st.st_size < 0)
{
- error (0, 0, _("%s: file has negative size"), quote (qname));
+ error (0, 0, _("%s: file has negative size"), qname);
return false;
}
@@ -984,7 +982,7 @@ do_wipefd (int fd, char const *qname, struct randint_source *s,
if (flags->remove_file && ftruncate (fd, 0) != 0
&& S_ISREG (st.st_mode))
{
- error (0, errno, _("%s: error truncating"), quote (qname));
+ error (0, errno, _("%s: error truncating"), qname);
ok = false;
goto wipefd_out;
}
@@ -1004,13 +1002,12 @@ wipefd (int fd, char const *qname, struct randint_source *s,
if (fd_flags < 0)
{
- error (0, errno, _("%s: fcntl failed"), quote (qname));
+ error (0, errno, _("%s: fcntl failed"), qname);
return false;
}
if (fd_flags & O_APPEND)
{
- error (0, 0, _("%s: cannot shred append-only file descriptor"),
- quote (qname));
+ error (0, 0, _("%s: cannot shred append-only file descriptor"), qname);
return false;
}
return do_wipefd (fd, qname, s, flags);
@@ -1085,7 +1082,7 @@ wipename (char *oldname, char const *qoldname, struct Options const *flags)
char *base = last_component (newname);
size_t len = base_len (base);
char *dir = dir_name (newname);
- char *qdir = xstrdup (quotearg_colon (dir));
+ char *qdir = xstrdup (quote (dir));
bool first = true;
bool ok = true;
int dir_fd = -1;
@@ -1094,7 +1091,7 @@ wipename (char *oldname, char const *qoldname, struct Options const *flags)
dir_fd = open (dir, O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NONBLOCK);
if (flags->verbose)
- error (0, 0, _("%s: removing"), quote (qoldname));
+ error (0, 0, _("%s: removing"), qoldname);
while ((flags->remove_file != remove_unlink) && len)
{
@@ -1119,7 +1116,7 @@ wipename (char *oldname, char const *qoldname, struct Options const *flags)
*/
char const *old = (first ? qoldname : oldname);
error (0, 0, _("%s: renamed to %s"),
- quote_n (0, old), quote_n (1, newname));
+ old, newname);
first = false;
}
memcpy (oldname + (base - newname), base, len + 1);
@@ -1141,18 +1138,18 @@ wipename (char *oldname, char const *qoldname, struct Options const *flags)
}
if (unlink (oldname) != 0)
{
- error (0, errno, _("%s: failed to remove"), quote (qoldname));
+ error (0, errno, _("%s: failed to remove"), qoldname);
ok = false;
}
else if (flags->verbose)
- error (0, 0, _("%s: removed"), quote (qoldname));
+ error (0, 0, _("%s: removed"), qoldname);
if (0 <= dir_fd)
{
if (dosync (dir_fd, qdir) != 0)
ok = false;
if (close (dir_fd) != 0)
{
- error (0, errno, _("%s: failed to close"), quote (qdir));
+ error (0, errno, _("%s: failed to close"), qdir);
ok = false;
}
}
@@ -1188,14 +1185,14 @@ wipefile (char *name, char const *qname,
fd = open (name, O_WRONLY | O_NOCTTY | O_BINARY);
if (fd < 0)
{
- error (0, errno, _("%s: failed to open for writing"), quote (qname));
+ error (0, errno, _("%s: failed to open for writing"), qname);
return false;
}
ok = do_wipefd (fd, qname, s, flags);
if (close (fd) != 0)
{
- error (0, errno, _("%s: failed to close"), quote (qname));
+ error (0, errno, _("%s: failed to close"), qname);
ok = false;
}
if (ok && flags->remove_file)
@@ -1305,12 +1302,12 @@ main (int argc, char **argv)
randint_source = randint_all_new (random_source, SIZE_MAX);
if (! randint_source)
- error (EXIT_FAILURE, errno, "%s", quotearg_colon (random_source));
+ error (EXIT_FAILURE, errno, "%s", quote (random_source));
atexit (clear_random_data);
for (i = 0; i < n_files; i++)
{
- char *qname = xstrdup (quotearg_colon (file[i]));
+ char *qname = xstrdup (quote (file[i]));
if (STREQ (file[i], "-"))
{
ok &= wipefd (STDOUT_FILENO, qname, randint_source, &flags);
diff --git a/src/shuf.c b/src/shuf.c
index 040b00028..d7b5a3521 100644
--- a/src/shuf.c
+++ b/src/shuf.c
@@ -27,7 +27,6 @@
#include "getopt.h"
#include "linebuffer.h"
#include "quote.h"
-#include "quotearg.h"
#include "randint.h"
#include "randperm.h"
#include "read-file.h"
@@ -545,7 +544,7 @@ main (int argc, char **argv)
? SIZE_MAX
: randperm_bound (head_lines, n_lines)));
if (! randint_source)
- error (EXIT_FAILURE, errno, "%s", quotearg_colon (random_source));
+ error (EXIT_FAILURE, errno, "%s", quote (random_source));
if (use_reservoir_sampling)
{
@@ -567,7 +566,7 @@ main (int argc, char **argv)
permutation = randperm_new (randint_source, head_lines, n_lines);
if (outfile && ! freopen (outfile, "w", stdout))
- error (EXIT_FAILURE, errno, "%s", quotearg_colon (outfile));
+ error (EXIT_FAILURE, errno, "%s", quote (outfile));
/* Generate output according to requested method */
if (repeat)
diff --git a/src/sort.c b/src/sort.c
index 09231c44b..3e741027c 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -4612,7 +4612,7 @@ main (int argc, char **argv)
unsigned long int file_number = i + 1;
error (SORT_FAILURE, 0,
_("%s:%lu: invalid zero-length file name"),
- quotearg_colon (files_from), file_number);
+ quote (files_from), file_number);
}
}
}
diff --git a/src/stat.c b/src/stat.c
index 680a598f0..a8a8c9d64 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -66,7 +66,6 @@
#include "getopt.h"
#include "mountlist.h"
#include "quote.h"
-#include "quotearg.h"
#include "stat-size.h"
#include "stat-time.h"
#include "strftime.h"
@@ -1188,7 +1187,7 @@ print_it (char const *format, int fd, char const *filename,
dest[len + 1] = *fmt_char;
dest[len + 2] = '\0';
error (EXIT_FAILURE, 0, _("%s: invalid directive"),
- quotearg_colon (dest));
+ quote (dest));
}
putchar ('%');
break;
diff --git a/src/tac.c b/src/tac.c
index 1029de63b..a260b7bad 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -46,7 +46,6 @@ tac -r -s '.\|
#include "error.h"
#include "filenamecat.h"
#include "quote.h"
-#include "quotearg.h"
#include "safe-read.h"
#include "stdlib--.h"
#include "xfreopen.h"
@@ -221,7 +220,7 @@ tac_seekable (int input_fd, const char *file, off_t file_pos)
{
file_pos -= remainder;
if (lseek (input_fd, file_pos, SEEK_SET) < 0)
- error (0, errno, _("%s: seek failed"), quotearg_colon (file));
+ error (0, errno, _("%s: seek failed"), quote (file));
}
/* Scan backward, looking for end of file. This caters to proc-like
@@ -231,7 +230,7 @@ tac_seekable (int input_fd, const char *file, off_t file_pos)
{
off_t rsize = read_size;
if (lseek (input_fd, -rsize, SEEK_CUR) < 0)
- error (0, errno, _("%s: seek failed"), quotearg_colon (file));
+ error (0, errno, _("%s: seek failed"), quote (file));
file_pos -= read_size;
}
@@ -249,7 +248,7 @@ tac_seekable (int input_fd, const char *file, off_t file_pos)
if (saved_record_size == SAFE_READ_ERROR)
{
- error (0, errno, _("%s: read error"), quotearg_colon (file));
+ error (0, errno, _("%s: read error"), quote (file));
return false;
}
@@ -341,7 +340,7 @@ tac_seekable (int input_fd, const char *file, off_t file_pos)
file_pos = 0;
}
if (lseek (input_fd, file_pos, SEEK_SET) < 0)
- error (0, errno, _("%s: seek failed"), quotearg_colon (file));
+ error (0, errno, _("%s: seek failed"), quote (file));
/* Shift the pending record data right to make room for the new.
The source and destination regions probably overlap. */
@@ -355,7 +354,7 @@ tac_seekable (int input_fd, const char *file, off_t file_pos)
if (safe_read (input_fd, G_buffer, read_size) != read_size)
{
- error (0, errno, _("%s: read error"), quotearg_colon (file));
+ error (0, errno, _("%s: read error"), quote (file));
return false;
}
}
@@ -512,13 +511,13 @@ copy_to_temp (FILE **g_tmp, char **g_tempfile, int input_fd, char const *file)
break;
if (bytes_read == SAFE_READ_ERROR)
{
- error (0, errno, _("%s: read error"), quotearg_colon (file));
+ error (0, errno, _("%s: read error"), quote (file));
goto Fail;
}
if (fwrite (G_buffer, 1, bytes_read, fp) != bytes_read)
{
- error (0, errno, _("%s: write error"), quotearg_colon (file_name));
+ error (0, errno, _("%s: write error"), quote (file_name));
goto Fail;
}
@@ -530,7 +529,7 @@ copy_to_temp (FILE **g_tmp, char **g_tempfile, int input_fd, char const *file)
if (fflush (fp) != 0)
{
- error (0, errno, _("%s: write error"), quotearg_colon (file_name));
+ error (0, errno, _("%s: write error"), quote (file_name));
goto Fail;
}
@@ -598,7 +597,7 @@ tac_file (const char *filename)
if (!is_stdin && close (fd) != 0)
{
- error (0, errno, _("%s: read error"), quotearg_colon (filename));
+ error (0, errno, _("%s: read error"), quote (filename));
ok = false;
}
return ok;
diff --git a/src/wc.c b/src/wc.c
index fc66dfc73..30a08926f 100644
--- a/src/wc.c
+++ b/src/wc.c
@@ -33,7 +33,6 @@
#include "mbchar.h"
#include "physmem.h"
#include "quote.h"
-#include "quotearg.h"
#include "readtokens0.h"
#include "safe-read.h"
#include "stat-size.h"
@@ -765,7 +764,7 @@ main (int argc, char **argv)
goto argv_iter_done;
case AI_ERR_READ:
error (0, errno, _("%s: read error"),
- quotearg_colon (files_from));
+ quote (files_from));
ok = false;
goto argv_iter_done;
case AI_ERR_MEM:
@@ -798,7 +797,7 @@ main (int argc, char **argv)
not totally appropriate, since NUL is the separator, not NL,
but it might be better than nothing. */
unsigned long int file_number = argv_iter_n_args (ai);
- error (0, 0, "%s:%lu: %s", quotearg_colon (files_from),
+ error (0, 0, "%s:%lu: %s", quote (files_from),
file_number, _("invalid zero-length file name"));
}
skip_file = true;
diff --git a/tests/du/files0-from-dir.sh b/tests/du/files0-from-dir.sh
index 2f55c4ed6..4d7e90cf5 100755
--- a/tests/du/files0-from-dir.sh
+++ b/tests/du/files0-from-dir.sh
@@ -29,10 +29,10 @@ cat dir > /dev/null && skip_ "cat dir/ succeeds"
for prog in du wc; do
$prog --files0-from=dir > /dev/null 2>err && fail=1
- printf "$prog: dir:\n" > exp || fail=1
+ printf "$prog: 'dir':\n" > exp || fail=1
# The diagnostic string is usually "Is a directory" (ENOTDIR),
# but accept a different string or errno value.
- sed 's/dir:.*/dir:/' err > k; mv k err
+ sed "s/'dir':.*/'dir':/" err > k; mv k err
compare exp err || fail=1
done
diff --git a/tests/du/files0-from.pl b/tests/du/files0-from.pl
index 3854059f0..f0177a2d0 100755
--- a/tests/du/files0-from.pl
+++ b/tests/du/files0-from.pl
@@ -53,12 +53,12 @@ my @Tests =
# one NUL
['nul-1', '--files0-from=-', '<', {IN=>"\0"}, {EXIT=>1},
- {ERR => "$prog: -:1: invalid zero-length file name\n"}],
+ {ERR => "$prog: '-':1: invalid zero-length file name\n"}],
# two NULs
['nul-2', '--files0-from=-', '<', {IN=>"\0\0"}, {EXIT=>1},
- {ERR => "$prog: -:1: invalid zero-length file name\n"
- . "$prog: -:2: invalid zero-length file name\n"}],
+ {ERR => "$prog: '-':1: invalid zero-length file name\n"
+ . "$prog: '-':2: invalid zero-length file name\n"}],
# one file name, no NUL
['1', '--files0-from=-', '<',
@@ -84,7 +84,7 @@ my @Tests =
['zero-len', '--files0-from=-', '<',
{IN=>{f=>"\0g\0"}}, {AUX=>{g=>''}},
{OUT=>"0\tg\n"}, {OUT_SUBST=>'s/^\d+/0/'},
- {ERR => "$prog: -:1: invalid zero-length file name\n"}, {EXIT=>1} ],
+ {ERR => "$prog: '-':1: invalid zero-length file name\n"}, {EXIT=>1} ],
);
my $save_temps = $ENV{DEBUG};
diff --git a/tests/du/move-dir-while-traversing.sh b/tests/du/move-dir-while-traversing.sh
index 67bb34580..33db58e44 100755
--- a/tests/du/move-dir-while-traversing.sh
+++ b/tests/du/move-dir-while-traversing.sh
@@ -92,7 +92,7 @@ du -a $t d2 2> err
test $? = 1 || fail=1
# check for the new diagnostic
-printf "du: fts_read failed: $t/3/a/b: No such file or directory\n" > exp \
+printf "du: fts_read failed: '$t/3/a/b': No such file or directory\n" > exp \
|| fail=1
compare exp err || fail=1
diff --git a/tests/misc/shred-passes.sh b/tests/misc/shred-passes.sh
index c19cc7655..ddf788b05 100755
--- a/tests/misc/shred-passes.sh
+++ b/tests/misc/shred-passes.sh
@@ -28,7 +28,7 @@ shred: 'f': pass 1/3 (random)...
shred: 'f': pass 2/3 (random)...
shred: 'f': pass 3/3 (random)...
shred: 'f': removing
-shred: 'f': renamed to '0'
+shred: 'f': renamed to 0
shred: 'f': removed" > exp || framework_failure_
shred -v -u f 2>out || fail=1
@@ -40,7 +40,7 @@ compare exp out || fail=1
touch f || framework_failure_
echo "\
shred: 'f': removing
-shred: 'f': renamed to '0'
+shred: 'f': renamed to 0
shred: 'f': removed" > exp || framework_failure_
shred -v -u f 2>out || fail=1
@@ -73,7 +73,7 @@ shred: 'f': pass 18/20 (eeeeee)...
shred: 'f': pass 19/20 (333333)...
shred: 'f': pass 20/20 (random)...
shred: 'f': removing
-shred: 'f': renamed to '0'
+shred: 'f': renamed to 0
shred: 'f': removed" > exp || framework_failure_
shred -v -u -n20 --random-source=Us f 2>out || fail=1
diff --git a/tests/misc/sort-files0-from.pl b/tests/misc/sort-files0-from.pl
index 63c5bb3e4..6773309d1 100755
--- a/tests/misc/sort-files0-from.pl
+++ b/tests/misc/sort-files0-from.pl
@@ -55,14 +55,14 @@ my @Tests =
# one NUL
['nul-1', '--files0-from=-', '<', {IN=>"\0"}, {EXIT=>2},
- {ERR => "$prog: -:1: invalid zero-length file name\n"}],
+ {ERR => "$prog: '-':1: invalid zero-length file name\n"}],
# two NULs
# Note that the behavior here differs from 'wc' in that the
# first zero-length file name is treated as fatal, so there
# is only one line of diagnostic output.
['nul-2', '--files0-from=-', '<', {IN=>"\0\0"}, {EXIT=>2},
- {ERR => "$prog: -:1: invalid zero-length file name\n"}],
+ {ERR => "$prog: '-':1: invalid zero-length file name\n"}],
# one file name, no NUL
['1', '--files0-from=-', '<',
@@ -86,7 +86,7 @@ my @Tests =
# should be no output on STDOUT.
['zero-len', '--files0-from=-', '<',
{IN=>{f=>"\0g\0"}}, {AUX=>{g=>''}},
- {ERR => "$prog: -:1: invalid zero-length file name\n"}, {EXIT=>2} ],
+ {ERR => "$prog: '-':1: invalid zero-length file name\n"}, {EXIT=>2} ],
);
my $save_temps = $ENV{DEBUG};
diff --git a/tests/misc/stat-printf.pl b/tests/misc/stat-printf.pl
index 967eef7d2..cb148b615 100755
--- a/tests/misc/stat-printf.pl
+++ b/tests/misc/stat-printf.pl
@@ -52,9 +52,9 @@ my @Tests =
{ERR=>"$prog: warning: backslash at end of format\n"}],
['err-1', "--printf=%9% .", {EXIT => 1},
- {ERR=>"$prog: %9%: invalid directive\n"}],
+ {ERR=>"$prog: '%9%': invalid directive\n"}],
['err-2', "--printf=%9 .", {EXIT => 1},
- {ERR=>"$prog: %9: invalid directive\n"}],
+ {ERR=>"$prog: '%9': invalid directive\n"}],
);
my $save_temps = $ENV{DEBUG};
diff --git a/tests/misc/wc-files0-from.pl b/tests/misc/wc-files0-from.pl
index cae3fc225..519587be6 100755
--- a/tests/misc/wc-files0-from.pl
+++ b/tests/misc/wc-files0-from.pl
@@ -53,13 +53,13 @@ my @Tests =
# one NUL
['nul-1', '--files0-from=-', '<', {IN=>"\0"}, {EXIT=>1},
- {ERR => "$prog: -:1: invalid zero-length file name\n"}],
+ {ERR => "$prog: '-':1: invalid zero-length file name\n"}],
# two NULs
['nul-2', '--files0-from=-', '<', {IN=>"\0\0"}, {EXIT=>1},
{OUT=>"0 0 0 total\n"},
- {ERR => "$prog: -:1: invalid zero-length file name\n"
- . "$prog: -:2: invalid zero-length file name\n"}],
+ {ERR => "$prog: '-':1: invalid zero-length file name\n"
+ . "$prog: '-':2: invalid zero-length file name\n"}],
# one file name, no NUL
['1', '--files0-from=-', '<',
@@ -83,7 +83,7 @@ my @Tests =
['zero-len', '--files0-from=-', '<',
{IN=>{f=>"\0g\0"}}, {AUX=>{g=>''}},
{OUT=>"0 0 0 g\n0 0 0 total\n"},
- {ERR => "$prog: -:1: invalid zero-length file name\n"}, {EXIT=>1} ],
+ {ERR => "$prog: '-':1: invalid zero-length file name\n"}, {EXIT=>1} ],
);
my $save_temps = $ENV{DEBUG};