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

Re: controlling error handling in sourced shell code



control: tags -1 -help

On 20-12-15 15:03, Paul Gevers wrote:
> I am looking into fixing bug 807353¹ against my package dbconfig-common.
> dbconfig-common is written in shell, such that it can easily be sourced
> and used in maintainer scripts. The issue is that when you call a
> sourced function in the test part of an if-then-fi statement, the "set
> -e" option of the calling script doesn't propagate into the sourced
> function. Unfortunately, dbconfig-commons error handling relies on that
> behavior. I found a (slightly hacky, but probably adequate) solution for
> bash², but that doesn't seem to be generic enough for e.g. dash as it
> relies on the errtrace option. Does anybody here have an idea how to
> solve this properly?

I think I'll just have to add a "|| return $?" in several dozens of
locations and hope I don't miss any. Anybody a better idea?

And I'll probably contact the packages that call dbconfig-common in such
an if statement to reconsider.

Paul

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: