Opened 7 years ago

Closed 5 years ago

#1700 closed enhancement (fixed)

Remove &&<cr> in BLFS scripts

Reported by: Pierre Labastie Owned by: Pierre Labastie
Priority: normal Milestone: 3.0
Component: ablfs Version: SVN
Severity: normal Keywords:
Cc:

Description

If you have instructions of the form:

instruction A &&
instruction B &&
instruction C

and A fails, B and C are not executed (which is what is intended), but the error code is 0 (because bash thinks it is equivalent to:

if instruction A; then
  if instruction B; then
    instruction C
  fi
fi

which returns an error code only if C is executed and exits with an error.

This is not desirable in our case, because it defeats the use of set -e.

Change History (5)

comment:1 by Pierre Labastie, 7 years ago

Component: jhalfsablfs
Type: defectenhancement

comment:2 by Pierre Labastie, 5 years ago

This should be easy enough. of course, only && at the end of lines should be removed. But it is possible the a dev intends to have:

long instruction A &&
  instruction B

to be equivalent to:

if long instruction A; then
  instruction B

How to know? Ask dev to not use the && construct? When long instruction A is of the form [ -letter something ], that may be detected, but otherwise?

comment:3 by Pierre Labastie, 5 years ago

Owner: changed from alfs-log@… to Pierre Labastie
Status: newassigned

I think I'll remove the &amp;&amp;&#xA; except when preceded by [...] or test ...

comment:4 by Pierre Labastie, 5 years ago

Fixed at r4100

comment:5 by Pierre Labastie, 5 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.