On Mon, Dec 07, 2020 at 11:54:04AM +0100, Ingo Schwarze wrote:
> > 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 08:47:48 -0000
> > @@ -248,7 +248,8 @@ must be run manually to install the new 
> >             fi
> >     fi
> >  
> > -   ${_PATCH_APPLIED} && echo "Errata can be reviewed under ${_PDIR}"
> > +   ${_PATCH_APPLIED} && echo "Errata can be reviewed under ${_PDIR}" ||
> > +           return 2
> 
> This doesn't appear to work unless i screwed up my testing.
> Even if _PATCH_APPLIED==false, syspatch still exits 0 for me.
> The return value of the trap function doesn't appear to affect
> the exit status of the script.

<...>

> Listing patches is an error no matter whether or not patches are
> available, no matter whether these patches are already installed
> or not?
> 
> I doubt the patch is ready for commit in its present state.

It wasn't meant for commit just yet :-)
Thanks for the feedback.

I just tested this change and it seems to work:

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 11:58:06 -0000
@@ -64,6 +64,7 @@ of installed patches.
 .El
 .Sh EXIT STATUS
 .Ex -std syspatch
+2 indicates that 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 11:58:06 -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