On Fri, Apr 24, 2026 at 05:06:43PM -0700, Song Liu wrote:
> On Wed, Apr 22, 2026 at 9:04 PM Josh Poimboeuf <[email protected]> wrote:
> >
> > The --short-circuit option implicitly requires that certain directories
> > are already in klp-tmp.  Enforce that to prevent confusing errors.
> >
> > Signed-off-by: Josh Poimboeuf <[email protected]>
> > ---
> >  scripts/livepatch/klp-build | 18 ++++++++++++++++++
> >  1 file changed, 18 insertions(+)
> >
> > diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
> > index eda690b297cc..b44924d097a5 100755
> > --- a/scripts/livepatch/klp-build
> > +++ b/scripts/livepatch/klp-build
> > @@ -440,6 +440,20 @@ do_init() {
> >         [[ ! "$SRC" -ef "$SCRIPT_DIR/../.." ]] && die "please run from the 
> > kernel root directory"
> >         [[ ! "$OBJ" -ef "$SCRIPT_DIR/../.." ]] && die "please run from the 
> > kernel root directory"
> >
> > +       if (( SHORT_CIRCUIT >= 2 )); then
> > +               [[ -f "$ORIG_DIR/.complete" ]] || die "-S $SHORT_CIRCUIT 
> > requires completed $ORIG_DIR"
> > +               if (( SHORT_CIRCUIT >= 3 )); then
> > +                       [[ -f "$PATCHED_DIR/.complete" ]] || die "-S 
> > $SHORT_CIRCUIT requires completed $PATCHED_DIR"
> > +                       if (( SHORT_CIRCUIT >= 4 )); then
> > +                               [[ -f "$ORIG_CSUM_DIR/.complete" ]] || die 
> > "-S $SHORT_CIRCUIT requires completed $ORIG_CSUM_DIR"
> > +                               [[ -f "$PATCHED_CSUM_DIR/.complete" ]] || 
> > die "-S $SHORT_CIRCUIT requires completed $PATCHED_CSUM_DIR"
> > +                               if (( SHORT_CIRCUIT >= 5 )); then
> > +                                       [[ -f "$DIFF_DIR/.complete" ]] || 
> > die "-S $SHORT_CIRCUIT requires completed $DIFF_DIR"
> > +                               fi
> > +                       fi
> > +               fi
> > +       fi
> > +
> 
> Do we really need these to nest together?

Hm, I suppose flattening is a little less offensive to the eye:


        if (( SHORT_CIRCUIT >= 2 )); then
                [[ -f "$ORIG_DIR/.complete" ]] || die "-S $SHORT_CIRCUIT 
requires completed $ORIG_DIR"
        fi
        if (( SHORT_CIRCUIT >= 3 )); then
                [[ -f "$PATCHED_DIR/.complete" ]] || die "-S $SHORT_CIRCUIT 
requires completed $PATCHED_DIR"
        fi
        if (( SHORT_CIRCUIT >= 4 )); then
                [[ -f "$ORIG_CSUM_DIR/.complete" ]] || die "-S $SHORT_CIRCUIT 
requires completed $ORIG_CSUM_DIR"
                [[ -f "$PATCHED_CSUM_DIR/.complete" ]] || die "-S 
$SHORT_CIRCUIT requires completed $PATCHED_CSUM_DIR"
        fi
        if (( SHORT_CIRCUIT >= 5 )); then
                [[ -f "$DIFF_DIR/.complete" ]] || die "-S $SHORT_CIRCUIT 
requires completed $DIFF_DIR"
        fi
-- 
Josh

Reply via email to