From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80657 invoked by alias); 2 Mar 2017 23:23:23 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 80615 invoked by uid 89); 2 Mar 2017 23:23:22 -0000 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 Received: from smtp-out-so.shaw.ca (HELO smtp-out-so.shaw.ca) (64.59.136.139) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 02 Mar 2017 23:23:21 +0000 Received: from [192.168.1.100] ([174.0.238.184]) by shaw.ca with SMTP id ja46cxne1C3JIja47cGpvx; Thu, 02 Mar 2017 16:23:20 -0700 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@solidrocksystems.com> <58b811b2.261d9d0a.7c759.299d@mx.google.com> <8c9fefe1-a377-9188-62ac-ef960b639b75@SystematicSw.ab.ca> <13c0a1ce-e254-4072-170c-f8c88ec06be9@redhat.com> To: cygwin@cygwin.com From: Brian Inglis Reply-To: Brian.Inglis@SystematicSw.ab.ca Message-ID: <4929557a-718a-8ce6-cada-12ce1627dee5@SystematicSw.ab.ca> Date: Thu, 02 Mar 2017 23:23:00 -0000 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> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfAmo8nlO1J/cXag9Yhzyrn1VvhplUdyuYn9Ba86usYjRY6UqABG0/t7LwQzKVxmWiX+Z5NPWDaOZYWuy8Othp9A3ydxa1BKu3CPD+aKFO23Dna0JX1MC y/I7ueZm0kUT7KhVOnh8mx+vBG7XLtxpf+SMpnVetPt2gM2Zlr1ceUzwfbEp22ywkuMtkGRsO9MeyA== X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00029.txt.bz2 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