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

Re: List of packages shipping shell scripts with bashisms + MBF proposal



Hi,

On Wed, 2008-01-30 at 12:12 -0800, Russ Allbery wrote:
> "Adam D. Barratt" <adam@adam-barratt.org.uk> writes:
> 
> > lintian's parsing code certainly sounds better (mainly because
> > checkbashisms is based on an old version of the lintian code) but, from
> > a quick look, checkbashisms flags more issues than lintian does. We do
> > appear to be missing a few though; I'll have a look at getting them back
> > in sync.
> 
> I'd definitely welcome any additional regexes or code to add to lintian.
> (And at some point we can figure out how to keep this in sync with less
> effort.)

Having had chance to compare the two sets of regexes in more detail,
there's (predictably enough) a lot of overlap. The differences are:

        Only in checkbashisms:
        
        '(?:^|\s+)select\s+\w+' - 'select' is not POSIX
        '\$\{!\w+[@*]\}' - ${!prefix[*|@]}
        '\$\{!\w+\}' - ${!name}
        '\$\(\([A-Za-z]' - cnt=$((cnt + 1)) does not work in dash
        'echo\s+-[e]' - echo -e
        'exec\s+-[acl]' - exec -c/-l/-a name
        '\blet\s'  - let ...
        '\$RANDOM\b' - $RANDOM
        '(?<!\$)\(\(' - '((' should be '$(('
        '(\[|test)\s+-a' - test with unary -a (should be -e)
        
        [Optional as Policy requires it to work]
        'echo\s+-[n]' => 'q<echo -n>'
        
        Only in lintian:
        
        '(?:^|\s+)kill\s+-[^sl]\w*' - kill -[0-9] or -[A-Z]
        '(?:^|\s+)trap\s+["\']?.*["\']?\s+.*[1-9]' - trap with signal
        numbers
        '\[\[(?!:)' - alternative test command (i.e. [[ ]] rather than
        [ ])
        
        I'm assuming these two are intended to catch the same case:
        
        [checkbashsisms] '\D+(>&|&>)\w+' - should be >word 2>&1
        [lintian] '\&>' - cshism
        
Adam


Reply to: