bug#44248: Indentation of --help and --version
On 29/10/2020 21:25, Roland Illig wrote: On 28.10.2020 21:55, Bernhard Voelker wrote: We have so many utils that it may be worth writing some utility functions to automatically do the alignment. Usually, that part of the usage output has 3 columns: a) the short option (if any), b) the long option (if any), c) the description (maybe multiline). I completely agree. This would be nice to have, both for users and for translators. E.g. for ls.c:usage: usage_param("-a", "--all", _("do not ignore entries starting with .")); ... usage_param(NULL, "--dereference-command-line-symlink-to-dir", _("follow each command line symbolic link\n" "that points to a directory")); usage_param_help(); usage_param_version(); and a final: usage_param_finish(); This code adds a bit of redundancy. The relation between -a and --all is already expressed when setting up the getopt_long. It is repeated here. Ideally there would be a single definition from which both the getopt_long options and the --help string are derived. Some prior art can be found at https://golang.org/pkg/flag/. Maybe, though I don't want to over engineer anything here. We're not going to be adding new options that often. I don't like the hard line break in the option description. The line breaks should be computed based on the terminal size or a fixed line width. It's not possible to predict the screen column in which in the option description will start, since that depends on the names of the other options. Therefore, the option descriptions should be wrapped as necessary. See fold(1). Yes agreed. Spacing or alignment should not need consideration for translators. That includes line feeds. We probably should provide some context to translators also like: /* TRANSLATORS: --dereference-command-line-symlink-to-dir option */ cheers, Pádraig
bug#44248: Indentation of --help and --version
On 28.10.2020 21:55, Bernhard Voelker wrote: We have so many utils that it may be worth writing some utility functions to automatically do the alignment. Usually, that part of the usage output has 3 columns: a) the short option (if any), b) the long option (if any), c) the description (maybe multiline). I completely agree. This would be nice to have, both for users and for translators. E.g. for ls.c:usage: usage_param("-a", "--all", _("do not ignore entries starting with .")); ... usage_param(NULL, "--dereference-command-line-symlink-to-dir", _("follow each command line symbolic link\n" "that points to a directory")); usage_param_help(); usage_param_version(); and a final: usage_param_finish(); This code adds a bit of redundancy. The relation between -a and --all is already expressed when setting up the getopt_long. It is repeated here. Ideally there would be a single definition from which both the getopt_long options and the --help string are derived. Some prior art can be found at https://golang.org/pkg/flag/. I don't like the hard line break in the option description. The line breaks should be computed based on the terminal size or a fixed line width. It's not possible to predict the screen column in which in the option description will start, since that depends on the names of the other options. Therefore, the option descriptions should be wrapped as necessary. See fold(1). Roland
bug#44308: md5sum (and other *sum utils) path dependent output
Ok, missed that bit. My bad. Cheers, On 10/29/20 4:22 PM, Kamil Dudka wrote: > On Thursday, October 29, 2020 11:41:03 AM CET Alessandro Forghieri wrote: >> Greetings. >> >> Just stumbled upon this: >> >> *# md5sum >> ./Development/rss/rss/STAGING/BATTITI_del_27_11_2016_-_Battiti_Live:_Arsene_ >> Duevi\\Roberto_Zanisi.mp3 \d41d8cd98f00b204e9800998ecf8427e >> ./Development/rss/rss/STAGING/BATTITI_del_27_11_2016_-_Battiti_Live:_Arsene_ >> Duevi\\Roberto_Zanisi.mp3* >> >> *# cp >> ./Development/rss/rss/STAGING/BATTITI_del_27_11_2016_-_Battiti_Live:_Arsene_ >> Duevi\\Roberto_Zanisi.mp3 /tmp/qlo >> # md5sum /tmp/qlo >> d41d8cd98f00b204e9800998ecf8427e /tmp/qlo** >> * >> >> IE, in the first instance a '\' character is prepended to the output. >> The file itself is an empty file, so I guess the file content is >> irrelevant to the apparent bug. >> >> Running coreutils-8.31-6.fc30.x86_64 on Linux 5.6.13-100.fc30.x86_64+debug > This is the documented behavior of md5sum [1]: > > "Without ‘--zero’, if 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." > > Kamil > > [1] > https://www.gnu.org/software/coreutils/manual/html_node/md5sum-invocation.html > >> To communicate, cc me, as I am not a ML subscriber. >> >> Cheers, > > -- Alessandro Forghieri Nouvelle s.r.l. via Giardini 456/C 41124 Modena (ITALY) tel. +39 059 2929338 - Fax +39 059 347606 <> signature.asc Description: OpenPGP digital signature
bug#44308: md5sum (and other *sum utils) path dependent output
On Thursday, October 29, 2020 11:41:03 AM CET Alessandro Forghieri wrote: > Greetings. > > Just stumbled upon this: > > *# md5sum > ./Development/rss/rss/STAGING/BATTITI_del_27_11_2016_-_Battiti_Live:_Arsene_ > Duevi\\Roberto_Zanisi.mp3 \d41d8cd98f00b204e9800998ecf8427e > ./Development/rss/rss/STAGING/BATTITI_del_27_11_2016_-_Battiti_Live:_Arsene_ > Duevi\\Roberto_Zanisi.mp3* > > *# cp > ./Development/rss/rss/STAGING/BATTITI_del_27_11_2016_-_Battiti_Live:_Arsene_ > Duevi\\Roberto_Zanisi.mp3 /tmp/qlo > # md5sum /tmp/qlo > d41d8cd98f00b204e9800998ecf8427e /tmp/qlo** > * > > IE, in the first instance a '\' character is prepended to the output. > The file itself is an empty file, so I guess the file content is > irrelevant to the apparent bug. > > Running coreutils-8.31-6.fc30.x86_64 on Linux 5.6.13-100.fc30.x86_64+debug This is the documented behavior of md5sum [1]: "Without ‘--zero’, if 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." Kamil [1] https://www.gnu.org/software/coreutils/manual/html_node/md5sum-invocation.html > To communicate, cc me, as I am not a ML subscriber. > > Cheers,
bug#44308: md5sum (and other *sum utils) path dependent output
I forgot to add, sha1sum, sha256sum and I'm guessing (but did not test) all the other *sum utils behave similarly. On 10/29/20 11:41 AM, Alessandro Forghieri wrote: > > Greetings. > > Just stumbled upon this: > > *# md5sum > ./Development/rss/rss/STAGING/BATTITI_del_27_11_2016_-_Battiti_Live:_Arsene_Duevi\\Roberto_Zanisi.mp3 > \d41d8cd98f00b204e9800998ecf8427e > ./Development/rss/rss/STAGING/BATTITI_del_27_11_2016_-_Battiti_Live:_Arsene_Duevi\\Roberto_Zanisi.mp3* > > *# cp > ./Development/rss/rss/STAGING/BATTITI_del_27_11_2016_-_Battiti_Live:_Arsene_Duevi\\Roberto_Zanisi.mp3 > /tmp/qlo > # md5sum /tmp/qlo > d41d8cd98f00b204e9800998ecf8427e /tmp/qlo** > * > > IE, in the first instance a '\' character is prepended to the output. > The file itself is an empty file, so I guess the file content is > irrelevant to the apparent bug. > > Running coreutils-8.31-6.fc30.x86_64 on Linux 5.6.13-100.fc30.x86_64+debug > > To communicate, cc me, as I am not a ML subscriber. > > Cheers, > > > -- > Alessandro Forghieri > Nouvelle s.r.l. > via Giardini 456/C 41124 Modena (ITALY) > tel. +39 059 2929338 - Fax +39 059 347606 -- Alessandro Forghieri Nouvelle s.r.l. via Giardini 456/C 41124 Modena (ITALY) tel. +39 059 2929338 - Fax +39 059 347606 <> signature.asc Description: OpenPGP digital signature
bug#44308: md5sum (and other *sum utils) path dependent output
Greetings. Just stumbled upon this: *# md5sum ./Development/rss/rss/STAGING/BATTITI_del_27_11_2016_-_Battiti_Live:_Arsene_Duevi\\Roberto_Zanisi.mp3 \d41d8cd98f00b204e9800998ecf8427e ./Development/rss/rss/STAGING/BATTITI_del_27_11_2016_-_Battiti_Live:_Arsene_Duevi\\Roberto_Zanisi.mp3* *# cp ./Development/rss/rss/STAGING/BATTITI_del_27_11_2016_-_Battiti_Live:_Arsene_Duevi\\Roberto_Zanisi.mp3 /tmp/qlo # md5sum /tmp/qlo d41d8cd98f00b204e9800998ecf8427e /tmp/qlo** * IE, in the first instance a '\' character is prepended to the output. The file itself is an empty file, so I guess the file content is irrelevant to the apparent bug. Running coreutils-8.31-6.fc30.x86_64 on Linux 5.6.13-100.fc30.x86_64+debug To communicate, cc me, as I am not a ML subscriber. Cheers, -- Alessandro Forghieri Nouvelle s.r.l. via Giardini 456/C 41124 Modena (ITALY) tel. +39 059 2929338 - Fax +39 059 347606 <> signature.asc Description: OpenPGP digital signature