'date --date' now parses dot delimited dd.mm.yy format common in Europe.
This is in addition to the already supported mm/dd/yy and yy-mm-dd formats.
+** Changes in behavior
+
+ 'cksum --check' now uses shell quoting when required, to more robustly
+ escape file names output in diagnostics.
+ This also affects md5sum, sha*sum, and b2sum.
+
** Improvements
'df --local' recognises more file system types as remote.
output indicating whether the named file passed the test.
After all checks have been performed, if there were any failures,
a warning is issued to standard error.
-Use the @option{--status} option to inhibit that output.
+If file names contain problematic characters,
+they will be quoted in a way suitable for POSIX-compatible shells,
+so that any file name is represented unambiguously and safely.
+
+Use the @option{--status} option to inhibit the output described above.
If any listed file cannot be opened or read, if any valid line has
a checksum inconsistent with the associated file, or if no valid
line is found, @command{cksum} exits with nonzero status. Otherwise,
exit (status);
}
+#if !HASH_ALGO_SUM
/* Given a string S, return TRUE if it contains problematic characters
that need escaping. Note we escape '\' itself to provide some forward
compat to introduce escaping of other characters. */
idx_t length = strcspn (s, "\\\n\r");
return s[length] != '\0';
}
+#endif
/* Given a file name, S of length S_LEN, that is not NUL-terminated,
modify it in place, performing the equivalent of this sed substitution:
return true;
}
+#if !HASH_ALGO_SUM
/* If ESCAPE is true, then translate each:
NEWLINE byte to the string, "\\n",
CARRIAGE RETURN byte to the string, "\\r",
file++;
}
}
+#endif
/* An interface to the function, DIGEST_STREAM.
Operate on FILENAME (it may be "-").
{
bool ok;
bool missing;
- bool needs_escape = ! status_only && problematic_chars (filename);
properly_formatted_lines = true;
{
++n_open_or_read_failures;
if (!status_only)
- {
- if (needs_escape)
- putchar ('\\');
- print_filename (filename, needs_escape);
- printf (": %s\n", _("FAILED open or read"));
- }
+ printf ("%s: %s\n", quotef (filename),_("FAILED open or read"));
}
else if (ignore_missing && missing)
{
if (!status_only)
{
if (! match || ! quiet)
- {
- if (needs_escape)
- putchar ('\\');
- print_filename (filename, needs_escape);
- }
+ fputs (quotef (filename), stdout);
if (! match)
printf (": %s\n", _("FAILED"));
md5sum --tag "$i" >> check.md5 || fail=1
done
md5sum --strict -c check.md5 > out || fail=1
- printf '%s: OK\n' '\a\\b' '\a\\' '\\\a' '\a\nb' "a${t}b" > exp ||
- framework_failure_
+ printf '%s: OK\n' "'a\\b'" "'a\\'" "'\\a'" \
+ "'a'\$'\\n''b'" "'a'\$'\\t''b'" > exp || framework_failure_
compare exp out || fail=1