Re: git: 9bcc1b18c119 - main - /bin/rmdir: Exit with status 2 for invalid arguments
- In reply to: Ronald Klop : "Re: git: 9bcc1b18c119 - main - /bin/rmdir: Exit with status 2 for invalid arguments"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 12 May 2024 11:15:05 UTC
On Sun, May 12, 2024, 1:30 AM Ronald Klop <ronald-lists@klop.ws> wrote:
> Wouldn’t EX_USAGE fit really well?
>
>
> https://man.freebsd.org/cgi/man.cgi?query=sysexits&manpath=FreeBSD+4.3-RELEASE
>
Read the pull request.
Warner
> Regards,
> Ronald
>
> *Van:* Warner Losh <imp@FreeBSD.org>
> *Datum:* 11 mei 2024 21:16
> *Aan:* src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
> dev-commits-src-main@FreeBSD.org
> *Onderwerp:* git: 9bcc1b18c119 - main - /bin/rmdir: Exit with status 2
> for invalid arguments
>
> The branch main has been updated by imp:
>
> URL:
> https://cgit.FreeBSD.org/src/commit/?id=9bcc1b18c119148e4455e548c90b2bc9cef16d1b
>
> commit 9bcc1b18c119148e4455e548c90b2bc9cef16d1b
> Author: Henrich Hartzer
> AuthorDate: 2024-05-10 17:53:49 +0000
> Commit: Warner Losh
> CommitDate: 2024-05-11 19:13:28 +0000
>
> /bin/rmdir: Exit with status 2 for invalid arguments
>
> PR: 277677
>
> Signed-off-by: Henrich Hartzer
> Reviewed by: imp
> Pull Request: https://github.com/freebsd/freebsd-src/pull/1161
> ---
> bin/rmdir/rmdir.1 | 15 ++++++++-------
> bin/rmdir/rmdir.c | 2 +-
> bin/rmdir/tests/rmdir_test.sh | 6 +++---
> 3 files changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/bin/rmdir/rmdir.1 b/bin/rmdir/rmdir.1
> index 87ca1f1547f0..eb23c605050c 100644
> --- a/bin/rmdir/rmdir.1
> +++ b/bin/rmdir/rmdir.1
> @@ -74,14 +74,14 @@ The
> .Nm
> utility exits with one of the following values:
> .Bl -tag -width indent
> -.It Li 0
> -Each directory entry specified by a
> +.It Er 0
> +Each
> .Ar directory
> -operand
> -referred to an empty directory and was removed
> -successfully.
> -.It Li >0
> -An error occurred.
> +referred to an empty directory and was removed successfully.
> +.It Er 1
> +An error occurred while attempting to remove one or more directories.
> +.It Er 2
> +Invalid arguments.
> .El
> .Sh EXAMPLES
> Remove the directory
> @@ -97,6 +97,7 @@ stopping at the first non-empty directory (if any):
> .Dl $ rmdir -p cow/horse/monkey
> .Sh SEE ALSO
> .Xr rm 1
> +.Xr rmdir 2
> .Sh STANDARDS
> The
> .Nm
> diff --git a/bin/rmdir/rmdir.c b/bin/rmdir/rmdir.c
> index c5d3db831309..0a495018495c 100644
> --- a/bin/rmdir/rmdir.c
> +++ b/bin/rmdir/rmdir.c
> @@ -112,5 +112,5 @@ usage(void)
> {
>
> (void)fprintf(stderr, "usage: rmdir [-pv] directory ... ");
> - exit(1);
> + exit(2);
> }
> diff --git a/bin/rmdir/tests/rmdir_test.sh b/bin/rmdir/tests/rmdir_test.sh
> index d443849258b6..ba80ac6204be 100644
> --- a/bin/rmdir/tests/rmdir_test.sh
> +++ b/bin/rmdir/tests/rmdir_test.sh
> @@ -35,8 +35,8 @@ invalid_usage_head()
>
> invalid_usage_body()
> {
> - atf_check -s not-exit:0 -e match:"$usage_output" rmdir -p
> - atf_check -s not-exit:0 -e match:"$usage_output" rmdir -v
> + atf_check -s exit:2 -e match:"$usage_output" rmdir -p
> + atf_check -s exit:2 -e match:"$usage_output" rmdir -v
> }
>
> atf_test_case no_arguments
> @@ -47,7 +47,7 @@ no_arguments_head()
>
> no_arguments_body()
> {
> - atf_check -s not-exit:0 -e match:"$usage_output" rmdir
> + atf_check -s exit:2 -e match:"$usage_output" rmdir
> }
>
> atf_init_test_cases()
>
> ------------------------------
>
>
>
>
>