Quoting Vasudev Kamath (2014-12-30 06:48:42) > Jonas Smedegaard <[email protected]> writes: >> Quoting Vasudev Kamath (2014-12-29 17:44:54) >>> Jonas Smedegaard <[email protected]> writes: >>>> But (judging only from above comments) there might be another issue >>>> with that loop not handling errors correctly. Perhaps as simple as >>>> a "set -e" (although I seem to recall that maintainer scripts >>>> shouldn't blindly do that). >>> >>> Yes, there should be probably a declaration >>> >>> SHELL := sh -e >>> >>> which would error out when anything in shell command goes wrong. But >>> I think its better to target this post Jessie. >> >> I recommend to not unconditonally instruct make to fail any and all >> shell invocations, but care for error handling separately for each >> call. >> >> E.g. when using pipes, failures may be hidden, which I fear has a >> higher risk of being missed if not every single shell call is >> inspected for error handling. >> > > I see. What is your way of handling the shell errors?. I would be > happy to adopt your version :).
I would replace this:
target:
sh foo; sh optional bar; sh crucial baz
...to either this:
target:
set -e; sh foo; sh optional bar || true; sh crucial baz
...or this:
target:
sh foo && sh optional bar; sh crucial baz
I.e. I would examine each specific case - e.g. "case ...; do; ...; done"
need its semicolons, and some code may deliberately be ok to fail.
I prefer to use "set -e" and then also explicitly declare when failure
is acceptable, but I don't like altering make to always include "-e"
because then I am quite likely to miss close inspection of the code (and
others will too!).
- Jonas
--
* Jonas Smedegaard - idealist & Internet-arkitekt
* Tlf.: +45 40843136 Website: http://dr.jones.dk/
[x] quote me freely [ ] ask before reusing [ ] keep private
signature.asc
Description: signature

