On Mon, Dec 07, 2020 at 01:30:55PM +0100, Ingo Schwarze wrote:
> Hello Antoine,
> 
> Antoine Jacoutot wrote on Mon, Dec 07, 2020 at 01:01:27PM +0100:
> 
> > I just tested this change and it seems to work:
> 
> I did not repeat my testing, but here is some quick feedback purely
> from code inspection:
> 
> The proposed code change makes sense to me.
> 
> The proposed manual page text might allow the misconception that
> the tool will always exit 2 if no additional patch was installed,
> including when -c, -l, or -r was specified.
> 
> I think a slightly more explicit wording might make such a
> misunderstanding less likely, for example:
> 
>   .Sh EXIT STATUS
>   .Ex -std syspatch
>   In particular, 2 indicates that applying patches was requested
>   but no additional patch was installed.
> 
> With non-standard meanings of exit codes, i think it is worthwhile
> to be as precise as possible.

Sure that's fine as well.
I did change it to your initial proposal; but careful, since you're a doc master
I will put whatever you send my way ;-)

Index: syspatch.8
===================================================================
RCS file: /cvs/src/usr.sbin/syspatch/syspatch.8,v
retrieving revision 1.21
diff -u -p -r1.21 syspatch.8
--- syspatch.8  25 Jul 2020 15:45:44 -0000      1.21
+++ syspatch.8  7 Dec 2020 12:39:07 -0000
@@ -64,6 +64,8 @@ of installed patches.
 .El
 .Sh EXIT STATUS
 .Ex -std syspatch
+In particular, 2 indicates that applying patches was requested but no
+additional patch was installed.
 .Sh SEE ALSO
 .Xr signify 1 ,
 .Xr installurl 5 ,
Index: syspatch.sh
===================================================================
RCS file: /cvs/src/usr.sbin/syspatch/syspatch.sh,v
retrieving revision 1.166
diff -u -p -r1.166 syspatch.sh
--- syspatch.sh 27 Oct 2020 17:42:05 -0000      1.166
+++ syspatch.sh 7 Dec 2020 12:39:07 -0000
@@ -320,6 +320,7 @@ if ((OPTIND == 1)); then
                        [[ -f ${_D}/rollback.tgz ]] || rm -r ${_D}
        done
        _PATCHES=$(ls_missing) # can't use errexit in a for loop
+       [[ -n ${_PATCHES} ]] || exit 2
        for _PATCH in ${_PATCHES}; do
                apply_patch ${_OSrev}-${_PATCH}
                _PATCH_APPLIED=true


-- 
Antoine

Reply via email to