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

d-l error handling



On Fri, Nov 02, 2007 at 06:46:50PM -0400, Justin Pryzby wrote:
> I just realized the reason for d-l poor error handling:
> 
> /usr/share/live-helper/functions/lockfile.sh:
> trap "test -f ${FILE} && rm -f ${FILE}; exit 0" 0 1 2 3 9 15
> 
> This exit 0 happens in the helper helper so callers don't notice the
> error.
> 
> My naive though is that the trap should be:
> trap 'ret=$?; '"rm -f \"${FILE}\";"' exit $ret' EXIT
> 
> IIRC this works around broken shells or ambiguity about the return
> value of the shell process after ret (is it the value of $? on
> entering the trap, or after running the trap commands?)
I just tested with this change and succeeded in built an image.  The
2>&1 |tee binary.log differs only in insignificant ways.

If this change had unexpected consequences, I would the expect effect
would be early failure.  So I think this is safe to apply, and any
problems found in the future can be considered bugs rather than future
goals.

Also the "aptitude doesn't return nonzero for some failures" thing
should now be fixed eg. by using dpkg-query -W or whatever the
preferred interface is.

Justin



Reply to: