[PATCH] chgrp: correct the usage for non-desktop chgrp calls

Denys Vlasenko vda.linux at googlemail.com
Sun Nov 17 16:08:53 UTC 2019


Applied, thanks!

On Wed, Nov 13, 2019 at 3:46 PM Liu, Shuang (ADITG/ESM)
<sliu at de.adit-jv.com> wrote:
>
> 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...
>
>
>
> From f97d77db6dfe9c6e0edc6c9f7577d40febfdd426 Mon Sep 17 00:00:00 2001
> From: Shuang Liu <sliu at de.adit-jv.com>
> Date: Wed, 13 Nov 2019 15:26:29 +0100
> Subject: [PATCH 1/1] chgrp: correct the usage for non-desktop chgrp calls
>  chown, so the recognized options shall be the same.
>
> Signed-off-by: Shuang Liu <sliu at de.adit-jv.com>
> ---
>  coreutils/chgrp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c
> index ae216aa..4da43c4 100644
> --- a/coreutils/chgrp.c
> +++ b/coreutils/chgrp.c
> @@ -21,15 +21,15 @@
>  /* 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"
> --
> 2.7.4
>
> Best regards
>
> Shuang Liu
> Engineering Software Multimedia (ADITG/ESM)
> Advanced Driver Information Technology GmbH
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list