From 918603909bd32e6ac7a3f95c5140d17b02239579 Mon Sep 17 00:00:00 2001 From: Jan Verbeek Date: Tue, 7 Sep 2021 19:48:28 +0200 Subject: [PATCH] Update hashsum quoting FIXME instructions --- src/uu/hashsum/src/hashsum.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index 2081d7612..f820b083e 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -547,10 +547,15 @@ where ) ) .to_ascii_lowercase(); - // FIXME: (How) should these be quoted? - // They seem like they would be processed programmatically, and - // our ordinary quoting might interfere, but newlines should be - // sanitized probably + // FIXME: Filenames with newlines should be treated specially. + // GNU appears to replace newlines by \n and backslashes by + // \\ and prepend a backslash (to the hash or filename) if it did + // this escaping. + // Different sorts of output (checking vs outputting hashes) may + // handle this differently. Compare carefully to GNU. + // If you can, try to preserve invalid unicode using OsStr(ing)Ext + // and display it using uucore::display::print_verbatim(). This is + // easier (and more important) on Unix than on Windows. if sum == real_sum { if !options.quiet { println!("{}: OK", ck_filename);