Web lists-archives.com

Re: [ANNOUNCEMENT] Updated: dash-

On 03/02/2017 11:28 AM, Brian Inglis wrote:
> summary of checkbashisms -f run on 140 POSIX shell scripts as 
> identified by file in my Cygwin 64 /bin/ with 784 packages (about 20% 
> of cygwin-pkg-maint, 8% of setup.ini) installed, 70 possible issues 
> (some from wrapped scripts because of -f): 

Looking through some of the output, I already spot a few interesting things:

> possible bashism in /bin/autoconf-2.69 line 55 ($BASH_SOMETHING):
> if test -z "$BASH_VERSION$ZSH_VERSION" \
>     && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then

Not a problem - the script is probing whether it needs to do something
based on being bash or not, but is written with all shells in mind.

> error: /bin/autoconf-2.69: Unterminated quoted string found, EOF reached. Wanted: <'>, opened in line 429

bug in checkbashisms; looks like it happens in several places in the output

> possible bashism in /bin/autopoint line 57 ($RANDOM):
>     tmp=$TMPDIR/gt$$-$RANDOM

Not a problem - the script is using $RANDOM for an additional level of
safety, but works safely even when $RANDOM is the empty string (as on dash).

> possible bashism in /bin/bzgrep line 66 (${parm/?/pat[/str]}):
>     j=${i//\\/\\\\}

First real problem.  Except that 'grep j= /bin/bzgrep' has no hits on my
system with bzip2-1.0.6-2 installed; what version was this problem in?

> possible bashism in /bin/messagebus-config line 26 (should be '.', not 'source'):
> source ${CSIH_SCRIPT}

Ah - now we get to an example file that is Cygwin-only (part of the
Cygwin port of dbus, but reading that file makes it obvious that it is
not from upstream) - where changing /bin/sh will cause breakage that we
can't rely on Debian to have caught first.

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature