On 01/07/2023 01:10, Christoph Anton Mitterer wrote: > Hey. > > It seems to me that the output of --check mode in cksum (and likely > also in md5sum and friends) suffers from improper escaping (which, > IIRC, is not even documented for that output... but may be wrong): > > $ touch a $'new\nline' '\n' z > $ ls -al > total 0 > drwxr-xr-x 1 calestyo calestyo 24 Jul 1 02:01 . > drwxr-xr-x 1 calestyo calestyo 176 Jul 1 01:48 .. > -rw-r--r-- 1 calestyo calestyo 0 Jul 1 02:01 a > -rw-r--r-- 1 calestyo calestyo 0 Jul 1 02:01 'new'$'\n''line' > -rw-r--r-- 1 calestyo calestyo 0 Jul 1 02:01 z > -rw-r--r-- 1 calestyo calestyo 0 Jul 1 02:01 '\n' > > $ cksum -a sha512 --tag * > sums.tagged > $ cksum -c sums.tagged > a: OK > \n: OK > \new\nline: OK > z: OK > Assuming the same rules for the --check output as for the sums files, a > leading \ should serve as the escaping indicator. > > So for: > \new\nline: OK > that would be fine but for: > \n: OK > it's not but would rather need to be: > \\\n: OK Right. We traditionally didn't escape any chars in the --check output, but that changed with https://github.com/coreutils/coreutils/commit/646902b30 To minimize escaping, that patch only considered the '\n' character, but we should also have considered file names with a leading '\'. The attached should address this. Marking this as done. thanks, Pádraig