Opened 9 years ago
Closed 7 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 , 9 years ago
| Component: | jhalfs → ablfs |
|---|---|
| Type: | defect → enhancement |
comment:2 by , 7 years ago
comment:3 by , 7 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
I think I'll remove the &&
 except when preceded by [...] or test ...
comment:5 by , 7 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.

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:
to be equivalent to:
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?