Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 May 2024 09:30:28 +0200 (CEST)
From:      Ronald Klop <ronald-lists@klop.ws>
To:        Warner Losh <imp@FreeBSD.org>
Cc:        dev-commits-src-main@FreeBSD.org, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org
Subject:   Re: git: 9bcc1b18c119 - main - /bin/rmdir: Exit with status 2  for invalid arguments
Message-ID:  <1570892010.7412.1715499028011@localhost>
In-Reply-To: <202405111916.44BJGJ2I010959@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
------=_Part_7411_631143796.1715499028007
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Wouldn=E2=80=99t EX_USAGE fit really well?

https://man.freebsd.org/cgi/man.cgi?query=3Dsysexits&manpath=3DFreeBSD+4.3-=
RELEASE

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-commi=
ts-src-main@FreeBSD.org
Onderwerp: git: 9bcc1b18c119 - main - /bin/rmdir: Exit with status 2  for i=
nvalid arguments

>=20
>=20
> The branch main has been updated by imp:
>=20
> URL: https://cgit.FreeBSD.org/src/commit/?id=3D9bcc1b18c119148e4455e548c9=
0b2bc9cef16d1b
>=20
> commit 9bcc1b18c119148e4455e548c90b2bc9cef16d1b
> Author:     Henrich Hartzer=20
> AuthorDate: 2024-05-10 17:53:49 +0000
> Commit:     Warner Losh=20
> CommitDate: 2024-05-11 19:13:28 +0000
>=20
>     /bin/rmdir: Exit with status 2 for invalid arguments
>    =20
>     PR: 277677
>    =20
>     Signed-off-by: Henrich Hartzer=20
>     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(-)
>=20
> 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)
>  {
> =20
>     (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.s=
h
> 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()
> =20
>  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
>  }
> =20
>  atf_test_case no_arguments
> @@ -47,7 +47,7 @@ no_arguments_head()
> =20
>  no_arguments_body()
>  {
> -   atf_check -s not-exit:0 -e match:"$usage_output" rmdir
> +   atf_check -s exit:2 -e match:"$usage_output" rmdir
>  }
> =20
>  atf_init_test_cases()
>=20
>=20
>=20
>=20
>=20
------=_Part_7411_631143796.1715499028007
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html><head></head><body>Wouldn=E2=80=99t EX_USAGE fit really well?<div><br=
></div><div><a href=3D"https://man.freebsd.org/cgi/man.cgi?query=3Dsysexits=
&amp;manpath=3DFreeBSD+4.3-RELEASE">https://man.freebsd.org/cgi/man.cgi?que=
ry=3Dsysexits&amp;manpath=3DFreeBSD+4.3-RELEASE</a></div><div><br></div><di=
v>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-co=
mmits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org<br><strong>Onde=
rwerp:</strong> git: 9bcc1b18c119 - main - /bin/rmdir: Exit with status 2  =
for invalid arguments<br></small></p><blockquote style=3D"margin-left: 5px;=
 border-left: 3px solid #ccc; margin-right: 0px; padding-left: 5px;"><div c=
lass=3D"MessageRFC822Viewer do_not_remove" id=3D"P"><!-- P -->
<!-- processMimeMessage --><div class=3D"TextPlainViewer do_not_remove" id=
=3D"P.P"><!-- P.P -->The branch main has been updated by imp:<br>
<br>
URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D9bcc1b18c119148e4=
455e548c90b2bc9cef16d1b">https://cgit.FreeBSD.org/src/commit/?id=3D9bcc1b18=
c119148e4455e548c90b2bc9cef16d1b</a><br>
<br>
commit 9bcc1b18c119148e4455e548c90b2bc9cef16d1b<br>
Author: &nbsp;&nbsp;&nbsp;&nbsp;Henrich Hartzer <henrichhartzer@tuta.io><br=
>
AuthorDate: 2024-05-10 17:53:49 +0000<br>
Commit: &nbsp;&nbsp;&nbsp;&nbsp;Warner Losh <imp@freebsd.org><br>
CommitDate: 2024-05-11 19:13:28 +0000<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;/bin/rmdir: Exit with status 2 for invalid argument=
s<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;PR: 277677<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Signed-off-by: Henrich Hartzer <henrichhartzer@tuta=
.io><br>
&nbsp;&nbsp;&nbsp;&nbsp;Reviewed by: imp<br>
&nbsp;&nbsp;&nbsp;&nbsp;Pull Request: <a href=3D"https://github.com/freebsd=
/freebsd-src/pull/1161">https://github.com/freebsd/freebsd-src/pull/1161</a=
><br>
---<br>
&nbsp;bin/rmdir/rmdir.1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;| 15 ++++++++-------<br>
&nbsp;bin/rmdir/rmdir.c &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;| &nbsp;2 +-<br>
&nbsp;bin/rmdir/tests/rmdir_test.sh | &nbsp;6 +++---<br>
&nbsp;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>
&nbsp;.Nm<br>
&nbsp;utility exits with one of the following values:<br>
&nbsp;.Bl -tag -width indent<br>
-.It Li 0<br>
-Each directory entry specified by a<br>
+.It Er 0<br>
+Each<br>
&nbsp;.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>
&nbsp;.El<br>
&nbsp;.Sh EXAMPLES<br>
&nbsp;Remove the directory<br>
@@ -97,6 +97,7 @@ stopping at the first non-empty directory (if any):<br>
&nbsp;.Dl $ rmdir -p cow/horse/monkey<br>
&nbsp;.Sh SEE ALSO<br>
&nbsp;.Xr rm 1<br>
+.Xr rmdir 2<br>
&nbsp;.Sh STANDARDS<br>
&nbsp;The<br>
&nbsp;.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>
&nbsp;{<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;(void)fprintf(stderr, "usage: rmdir [-pv] directory=
 ...
");<br>
- &nbsp;&nbsp;exit(1);<br>
+ &nbsp;&nbsp;exit(2);<br>
&nbsp;}<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>
&nbsp;<br>
&nbsp;invalid_usage_body()<br>
&nbsp;{<br>
- &nbsp;&nbsp;atf_check -s not-exit:0 -e match:"$usage_output" rmdir -p<br>
- &nbsp;&nbsp;atf_check -s not-exit:0 -e match:"$usage_output" rmdir -v<br>
+ &nbsp;&nbsp;atf_check -s exit:2 -e match:"$usage_output" rmdir -p<br>
+ &nbsp;&nbsp;atf_check -s exit:2 -e match:"$usage_output" rmdir -v<br>
&nbsp;}<br>
&nbsp;<br>
&nbsp;atf_test_case no_arguments<br>
@@ -47,7 +47,7 @@ no_arguments_head()<br>
&nbsp;<br>
&nbsp;no_arguments_body()<br>
&nbsp;{<br>
- &nbsp;&nbsp;atf_check -s not-exit:0 -e match:"$usage_output" rmdir<br>
+ &nbsp;&nbsp;atf_check -s exit:2 -e match:"$usage_output" rmdir<br>
&nbsp;}<br>
&nbsp;<br>
&nbsp;atf_init_test_cases()<br>
<br>
</henrichhartzer@tuta.io></imp@freebsd.org></henrichhartzer@tuta.io></div><=
!-- TextPlainViewer -->
<hr>
</div><!-- MessageRFC822Viewer -->
</blockquote><br><br><br></div></body></html>
------=_Part_7411_631143796.1715499028007--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1570892010.7412.1715499028011>