chgrp: correct the usage for non-desktop chgrp calls
authorLiu, Shuang (ADITG/ESM) <sliu@de.adit-jv.com>
Wed, 13 Nov 2019 14:36:20 +0000 (14:36 +0000)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 17 Nov 2019 16:06:31 +0000 (17:06 +0100)
When IF_DESKTOP is not defined, chown and chgrp only takes option -R -h,
However the usage output of chgrp is wrong:

$ ./busybox.nosuid chown
Usage: chown [-Rh]... USER[:[GRP]] FILE...

$ ./busybox.nosuid chgrp
Usage: chgrp [-RhLHP]... GROUP FILE...

$ ./busybox.nosuid chgrp -H group dummy
chgrp: invalid option -- 'H'
Usage: chgrp [-RhLHP]... GROUP FILE...

The chgrp is now a wrapper of chown, so the recognized options shall be the same.
This is introduced by 34425389e09353a8dacdd6b23a62553f699c544c

I would expect the correct behavior shall be the same as chown.
So suggest the below patch, the behavior shall be:

$ ./busybox.nosuid chgrp
Usage: chgrp [-Rh]... GROUP FILE...

Signed-off-by: Shuang Liu <sliu@de.adit-jv.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
coreutils/chgrp.c

index ae216aa3f09027c5030bbaa8206a23ec0744843b..4da43c45e4a6388eb40da168a9ec1e876d3aeeb6 100644 (file)
 /* http://www.opengroup.org/onlinepubs/007904975/utilities/chgrp.html */
 
 //usage:#define chgrp_trivial_usage
-//usage:       "[-RhLHP"IF_DESKTOP("cvf")"]... GROUP FILE..."
+//usage:       "[-Rh"IF_DESKTOP("LHPcvf")"]... GROUP FILE..."
 //usage:#define chgrp_full_usage "\n\n"
 //usage:       "Change the group membership of each FILE to GROUP\n"
 //usage:     "\n       -R      Recurse"
 //usage:     "\n       -h      Affect symlinks instead of symlink targets"
+//usage:       IF_DESKTOP(
 //usage:     "\n       -L      Traverse all symlinks to directories"
 //usage:     "\n       -H      Traverse symlinks on command line only"
 //usage:     "\n       -P      Don't traverse symlinks (default)"
-//usage:       IF_DESKTOP(
 //usage:     "\n       -c      List changed files"
 //usage:     "\n       -v      Verbose"
 //usage:     "\n       -f      Hide errors"