On Wed, Sep 15, 2021 at 01:40:36PM +0100, Pádraig Brady wrote: > Support checksum files with CRLF line endings, > which is a common gotcha for using --check on windows, > or with checksum files generated on windows. > Note we escape \r here to support the original coreutils format > (with file name at EOL), and file names with literal > \r characters as the last character of their name. >
> +++ b/doc/coreutils.texi > @@ -4066,10 +4066,12 @@ Binary mode is indicated with @samp{*}, text mode > with @samp{ } (space). > Binary mode is the default on systems where it's significant, > otherwise text mode is the default. The @command{cksum} command always > uses binary mode and a @samp{ } (space) flag. > -Without @option{--zero}, if @var{file} contains a backslash or newline, > -the line is started with a backslash, and each problematic character in > -the file name is escaped with a backslash, making the output > -unambiguous even in the presence of arbitrary file names. Pre-existing, but... > + > +Without @option{--zero}, if @var{file} contains a backslash, newline, > +or carriage return, the line is started with a backslash, and each > +problematic character in the file name is escaped with a backslash, > +making the output unambiguous even in the presence of arbitrary file names. We output backslash-n, not backslash-newline, when escaping newline. And with the new carriage return escaping, we output backslash-r, not backslash-CR. So this sentence is a bit misleading in stating that the problematic character is escaped with backslash, when in reality it is replaced by an escape sequence that starts with backslash. Overall, I like where you're headed with this. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org