Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 May 2024 05:15:05 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Ronald Klop <ronald-lists@klop.ws>
Cc:        Warner Losh <imp@freebsd.org>,  "<dev-commits-src-main@freebsd.org>" <dev-commits-src-main@freebsd.org>,  src-committers <src-committers@freebsd.org>,  "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>
Subject:   Re: git: 9bcc1b18c119 - main - /bin/rmdir: Exit with status 2 for invalid arguments
Message-ID:  <CANCZdfqNFaJBmwYB2dAFqzg1p9%2Bo%2B03tvyG-vEkB9dH%2BVV4Jdw@mail.gmail.com>
In-Reply-To: <1570892010.7412.1715499028011@localhost>
References:  <202405111916.44BJGJ2I010959@gitrepo.freebsd.org> <1570892010.7412.1715499028011@localhost>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
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()
>
> ------------------------------
>
>
>
>
>

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

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqNFaJBmwYB2dAFqzg1p9%2Bo%2B03tvyG-vEkB9dH%2BVV4Jdw>