delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/03/02/18:23:38

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:references:to:from:reply-to:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=kWA1GJQfucQv5C6C
vDgoNcpfNl6/V+bSsRJxBMzgt2B5NCDlvYI57zl1BDP2yf83nc5vd+rpOENbVp9G
+ivXh8n8Db/jfksKN4H/gy8wUnzdcx0XXZER1fMIicOo9TobH5s3MWxg0wk+8fg8
T68pYW/nHavwzfLIXdLWJ2KX03s=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:references:to:from:reply-to:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=5kI4EN0PYDZkLpmS3VaJMa
e0L+M=; b=V5tA2PnNquD2/QzuZ3chVlJ411Ou6mUwCbUClqso5dLX8+3UywEpq+
5vRM0VagfWDXLgLdkSSxxVhjzbtPi1cDp7N4eGsGPcwwJGKCsqz7L0ShxDff7ngS
Zp9bujNJhS2ZDT2RNe8y1dEAtVlLE0f0ErYEs4DUVeQD67CgntMhk=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=H*R:D*ca, H*r:ip*192.168.1.100, Hx-spam-relays-external:sk:smtp-ou, H*RU:sk:smtp-ou
X-HELO: smtp-out-so.shaw.ca
X-Authority-Analysis: v=2.2 cv=XbT59Mx5 c=1 sm=1 tr=0 a=WqCeCkldcEjBO3QZneQsCg==:117 a=WqCeCkldcEjBO3QZneQsCg==:17 a=eIhxMilvRf8A:10 a=IkcTkHD0fZMA:10 a=Ip_s7Tc3kvJuDrS_YksA:9 a=QEXdDO2ut3YA:10
Subject: Re: [ANNOUNCEMENT] Updated: dash-0.5.9.1-1
References: <485AF0C5-7E1B-49AA-BE3E-C3717DA3268B AT solidrocksystems DOT com> <58b811b2 DOT 261d9d0a DOT 7c759 DOT 299d AT mx DOT google DOT com> <db63a27c-a322-7fce-1a94-a1371d387c50 AT gmail DOT com> <acb13acc-28e8-c508-1b55-c88d404f9c1b AT redhat DOT com> <8c9fefe1-a377-9188-62ac-ef960b639b75 AT SystematicSw DOT ab DOT ca> <13c0a1ce-e254-4072-170c-f8c88ec06be9 AT redhat DOT com>
To: cygwin AT cygwin DOT com
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
Message-ID: <4929557a-718a-8ce6-cada-12ce1627dee5@SystematicSw.ab.ca>
Date: Thu, 2 Mar 2017 16:23:18 -0700
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1
MIME-Version: 1.0
In-Reply-To: <13c0a1ce-e254-4072-170c-f8c88ec06be9@redhat.com>
X-CMAE-Envelope: MS4wfAmo8nlO1J/cXag9Yhzyrn1VvhplUdyuYn9Ba86usYjRY6UqABG0/t7LwQzKVxmWiX+Z5NPWDaOZYWuy8Othp9A3ydxa1BKu3CPD+aKFO23Dna0JX1MC y/I7ueZm0kUT7KhVOnh8mx+vBG7XLtxpf+SMpnVetPt2gM2Zlr1ceUzwfbEp22ywkuMtkGRsO9MeyA==
X-IsSubscribed: yes

On 2017-03-02 11:45, Eric Blake wrote:
> 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

Because of -f checks shell wrappers which it would otherwise just ignore 
- may not be helpful - but -px (POSIX + eXtra) may be more useful, as 
checkbashisms defaults to lintian checks where Debian Policy 10.4 
overrides POSIX.
Also running with -f on bash scripts and checking for exit 4 identifies 
candidates for changing shebang from bash to sh.

>> 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).

Those are where I suggested mktemp would be a better solution to provide 
a random string - most scripts using this open multiple temp files and 
are part of or used by autotools which may be run on MPs.

>> 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?

Cygwin patch release 1.0.6-3 installed 2017-02-24 but unchanged since 2007: 

$ ls -ghlo bzip2-1.0.6-3.src/bzip2-1.0.6/bzgrep
-rw-r--r--+ 1 1.7K Jan  2  2007 bzip2-1.0.6-3.src/bzip2-1.0.6/bzgrep

$ file /bin/bz{cmp,diff,less,more,*grep} # scripts from /etc/setup/bzip2.lst.gz
/bin/bzcmp:   symbolic link to bzdiff
/bin/bzdiff:  POSIX shell script, ASCII text executable
/bin/bzless:  symbolic link to bzmore
/bin/bzmore:  POSIX shell script, ASCII text executable
/bin/bzegrep: symbolic link to bzgrep
/bin/bzfgrep: symbolic link to bzgrep
/bin/bzgrep:  POSIX shell script, ASCII text executable
$ fgrep -C9 j= bzip2-1.0.6-3.src/bzip2-1.0.6/bzgrep
for i do
  if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi
  if test $list -eq 1; then
    bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i
    r=$?
  elif test $# -eq 1 -o $silent -eq 1; then
    bzip2 -cdfq "$i" | $grep $opt "$pat"
    r=$?
  else
    j=${i//\\/\\\\}
    j=${j//|/\\|}
    j=${j//&/\\&}
    j=`printf "%s" "$j" | tr '\n' ' '`
    bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
    r=$?
  fi
  test "$r" -ne 0 && res="$r"
done
exit $res

Judgement call whether to change shebang or spawn sed or other?

Debian release is 1.0.6-7, bzgrep dated 2014, and bash expressions 
are gone, thanks to lintian and changes made to support more newer 
grep options.

>> 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.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019