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

Re: bashism question



Michael Meskes wrote, 2008-06-23, 10:07:27 +0200:
With our move to dash as sh we have to remove all bashisms from
scripts  run by /bin/sh. However, checkbashism seems to moan
about clauses that work in dash as well.
I don't know in which shells a trap with a signal number is
guaranteed to work, but it seems to work well in
dash.

It's not guaranteed to work in any shell implementing POSIX without extensions, which is what Policy says you're allowed to rely on (well, plus a few extensions, but not including trap and kill with signal numbers).

In general the definition of bashism used by checkbashisms and lintian in this case is "not portable to a shell implementing SUSv3 2004 without extensions", with the potential exception of those explicitly allowed by Policy.

I just ran a short test, so if the devil's in the detail I might have
missed something, but nevertheless I wonder if this feature can safely
be used.

It's safe for use with dash, but using it is technically a violation of Policy (albeit a widespread one). There is a Policy bug open requesting that the XSI extensions for trap and kill be permitted (#477240).

Regards,

Adam
Reply to: