[OE-core] [PATCH v2] sstate.bbclass: update .siginfo atime

Peter Kjellerstedt peter.kjellerstedt at axis.com
Tue Mar 7 11:29:22 UTC 2017


> -----Original Message-----
> From: openembedded-core-bounces at lists.openembedded.org
> [mailto:openembedded-core-bounces at lists.openembedded.org] On Behalf Of
> Patrick Ohly
> Sent: den 6 mars 2017 22:46
> To: ed.bartosh at linux.intel.com
> Cc: OE-core
> Subject: Re: [OE-core] [PATCH v2] sstate.bbclass: update .siginfo atime
> 
> On Mon, 2017-03-06 at 21:58 +0200, Ed Bartosh wrote:
> > On Mon, Mar 06, 2017 at 08:31:55PM +0100, Patrick Ohly wrote:
> > > On Mon, 2017-03-06 at 19:50 +0200, Ed Bartosh wrote:
> > > > On Mon, Mar 06, 2017 at 04:49:25PM +0000, Burton, Ross wrote:
> > > > > On 6 March 2017 at 15:31, Ed Bartosh
> <ed.bartosh at linux.intel.com> wrote:
> > > > >
> > > > > > +       [ -h ${SSTATE_PKG}.siginfo ] && touch -a
> ${SSTATE_PKG}.siginfo
> > > > > >
> > > > >
> > > > > $ ( [ -h / ] && echo something ); echo $?
> > > > > 1
> > > > >
> > > > > If the -h fails then this is still going to cause
> sstate_unpack_package to
> > > > > trap.
> > > >
> > > > I don't think it will as '&&' and '||' lists are among other
> special cases where
> > > > shell doesn't exits on error.
> > >
> > > True, but if the clause happens to be the last one in a function or
> > > script (for example, after restructuring code), then the return
> code of
> > > that becomes non-zero, which isn't intended.
> >
> > Exactly because of this I moved my changes up in the function in v2.
> 
> And someone else might accidentally move it down again, without
> understanding the consequences. It's simply safer to be explicit, IMHO.
> Not worth a v3, but perhaps in the future.

This is why our shell expert always recommends that tests like this 
should be written this way instead:

     [ ! -h /foobar ] || echo 'fstab is a symlink'

I.e., reverse the first test and always use || rather than &&.

//Peter




More information about the Openembedded-core mailing list