public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin@cygwin.com
Subject: Re: [ANNOUNCEMENT] Updated: dash-0.5.9.1-1
Date: Thu, 02 Mar 2017 23:23:00 -0000	[thread overview]
Message-ID: <4929557a-718a-8ce6-cada-12ce1627dee5@SystematicSw.ab.ca> (raw)
In-Reply-To: <13c0a1ce-e254-4072-170c-f8c88ec06be9@redhat.com>

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

  reply	other threads:[~2017-03-02 23:23 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17 14:01 Eric Blake (cygwin)
2017-02-23  4:20 ` Steven Penny
2017-02-23 17:50   ` Andrey Repin
2017-02-23 19:46     ` Steven Penny
2017-02-23 19:59       ` Brian Inglis
2017-02-23 20:41         ` Eric Blake
2017-02-24  7:19           ` Yaakov Selkowitz
2017-02-23 23:44         ` Steven Penny
2017-02-24 14:32           ` Eric Blake
2017-02-24 19:19             ` Brian Inglis
2017-02-23 22:05       ` Andrey Repin
2017-02-23 23:01         ` Tony Kelman
2017-02-23 23:04           ` Eliot Moss
2017-02-23 23:12             ` Kenneth Wolcott
2017-02-23 23:30             ` Vince Rice
2017-02-23 23:35           ` Andrey Repin
2017-02-24  3:16           ` Larry Hall (Cygwin)
2017-02-24  3:18           ` Larry Hall (Cygwin)
2017-02-24  4:57             ` Steven Penny
2017-02-24 14:43               ` Eric Blake
2017-02-24 15:05                 ` Lee Dilkie
2017-02-25 16:55                 ` Steven Penny
2017-03-01 23:57                   ` Matt Seitz (matseitz)
2017-02-23 23:33         ` Steven Penny
2017-02-25 16:46       ` cyg Simple
2017-02-25 17:09         ` Steven Penny
2017-02-27 10:20           ` Csaba Raduly
2017-02-27 12:48             ` Steven Penny
2017-02-27 23:13           ` Duncan Roe
2017-02-28  0:51             ` Steven Penny
2017-02-28 20:52               ` cyg Simple
2017-02-28 21:43                 ` Steven Penny
2017-03-01 14:42                   ` cyg Simple
2017-03-02  0:22                     ` Steven Penny
2017-03-02  3:46                       ` Vince Rice
2017-03-02  5:27                         ` Steven Penny
2017-03-02  5:31                           ` Vince Rice
2017-03-02 12:36                             ` Steven Penny
2017-03-02 13:37                               ` Marco Atzeri
2017-03-02 14:29                                 ` Eric Blake
2017-03-02 16:16                                   ` Nellis, Kenneth (Conduent)
2017-03-02 17:28                                   ` Brian Inglis
2017-03-02 18:45                                     ` Eric Blake
2017-03-02 23:23                                       ` Brian Inglis [this message]
2017-03-02 18:28                                   ` Achim Gratz
2017-03-02 14:31                                 ` Brian Inglis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4929557a-718a-8ce6-cada-12ce1627dee5@SystematicSw.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).