On 27/10/2020 00:03, Roland Illig wrote:
Hi,
 > Some of the programs add an empty line before the --help and --version 
lines, which
looks ok.  Several others do not add a line, which looks wrong.  This
should be consistent among all coreutils.

I agree we should make things as consistent as possible.
Though most utils do _not_ have a blank line before --help,--version.
The following utils do have a blank line:

$ ./build-aux/gen-lists-of-programs.sh --list-progs | while read p; do
  src/$p --help | grep -B1 -- --help | grep -q '^$' && echo $p; done | fmt

arch coreutils hostname hostid uptime users [ b2sum base64 base32 chcon
chgrp chown cksum dd expr factor false link logname md5sum nohup printf
realpath runcon sha1sum sha224sum sha256sum sha384sum sha512sum sleep
true tsort unlink whoami yes

Of those above, those that also have other options are:

base64 chcon chgrp chown md5sum realpath runcon

Now chcon, chgrp, chown, md5sum discuss the options before --help,--version
as a group and so a blank line is best there.
Therefore to improve consistency we should remove the blank line from:
base64, realpath, and runcon, which is done in the attached.

cheers,
Pádraig
>From 70935f301c3142ac1811dcf54348a24f937aa77c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
Date: Tue, 27 Oct 2020 14:10:14 +0000
Subject: [PATCH] doc: make blank lines before --help consistent

* src/basenc.c (main): Remove extraneous blank line,
to be consistent with other utils with options.
* src/realpath.c: Likewise.
* src/runcon.c: Likewise.
Addresses https://bugs.gnu.org/44248
---
 src/basenc.c   | 1 -
 src/realpath.c | 1 -
 src/runcon.c   | 1 -
 3 files changed, 3 deletions(-)

diff --git a/src/basenc.c b/src/basenc.c
index 13c37f904..ee24a3f15 100644
--- a/src/basenc.c
+++ b/src/basenc.c
@@ -142,7 +142,6 @@ Base%d encode or decode FILE, or standard input, to standard output.\n\
   -i, --ignore-garbage  when decoding, ignore non-alphabet characters\n\
   -w, --wrap=COLS       wrap encoded lines after COLS character (default 76).\n\
                           Use 0 to disable line wrapping\n\
-\n\
 "), stdout);
 #if BASE_TYPE == 42
       fputs (_("\
diff --git a/src/realpath.c b/src/realpath.c
index 6ed5f05c3..4391c697f 100644
--- a/src/realpath.c
+++ b/src/realpath.c
@@ -85,7 +85,6 @@ all but the last component must exist\n\
       --relative-base=DIR      print absolute paths unless paths below DIR\n\
   -s, --strip, --no-symlinks   don't expand symlinks\n\
   -z, --zero                   end each output line with NUL, not newline\n\
-\n\
 "), stdout);
       fputs (HELP_OPTION_DESCRIPTION, stdout);
       fputs (VERSION_OPTION_DESCRIPTION, stdout);
diff --git a/src/runcon.c b/src/runcon.c
index b2f4d4a0b..05cbb4f87 100644
--- a/src/runcon.c
+++ b/src/runcon.c
@@ -93,7 +93,6 @@ With neither CONTEXT nor COMMAND, print the current security context.\n\
   -u, --user=USER    user identity\n\
   -r, --role=ROLE    role\n\
   -l, --range=RANGE  levelrange\n\
-\n\
 "), stdout);
       fputs (HELP_OPTION_DESCRIPTION, stdout);
       fputs (VERSION_OPTION_DESCRIPTION, stdout);
-- 
2.26.2

Reply via email to