Re: [PATCH 2/5] travis-ci: use 'set -e' in the 32 bit Linux build job

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 24, 2018 at 01:12:48PM +0100, SZEDER Gábor wrote:

> >> -test -z $HOST_UID || (CI_USER="ci" && useradd -u $HOST_UID $CI_USER) &&
> [...]
> Indeed, the && chain is broken, I didn't noticed that.
> 
> Luckily it was broken in a way that it didn't lead to false successes:
> if installing dependencies fails, then the first && chain
> ensures that HOST_UID is not set, and then useradd will error out with
> "invalid user ID 'ci'", causing the second && chain to abort the script
> and thus breaking the build.

True. :) I didn't even look closely at whether the failures could be
correlated.

> >> +HOST_UID=$1
> >> +CI_USER=$USER
> >> +test -z $HOST_UID || (CI_USER="ci" && useradd -u $HOST_UID $CI_USER)
> >
> > If this "useradd" step fails, we wouldn't abort the script, because it's
> > part of a conditional. You'd need a manual "|| exit 1" at the end of
> > this line. Or to use a real "if" block.
> 
> No.  It does abort the script, because it isn't part of a conditional.
> Try to run the script twice in the same container instance: in the
> second run the user already exists, useradd fails and the whole script
> aborts.

You're right. I was confusing it with this case:

  (one; two) || three

in which we continue with "two" even if "one" fails. But it's only the
left-hand side of the || that does that.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux