Web lists-archives.com

Re: [ANNOUNCEMENT] Updated: dash-0.5.9.1-1




On 2017-03-02 07:29, Eric Blake wrote:
> On 03/02/2017 07:36 AM, Marco Atzeri wrote:
>> On 02/03/2017 13:36, Steven Penny wrote:
>>> On Wed, 1 Mar 2017 23:31:24, Vince Rice wrote:
>>>> Then you haven't been paying attention. And I didn't even
>>>> attempt to make an argument one way or the other, except to say
>>>> stop arguing. The horse is dead.
>>>
>>> Perhaps you could link to a constructive, concrete idea against
>>> the change that someone has made besides Eric. Even better, you
>>> could post your own constructive idea; surely you havent emailed
>>> twice now with nothing constructive to add?
>>
>> He was constructive, but you seems biased in understanding the answer.
> 
> To reiterate my answer in different terms:
> 
> If you can convince Fedora to switch /bin/sh to dash, then I will
> immediately follow in Cygwin.  Until then, I'm worried that there are
> enough scripts in the wild that use bashisms and will therefore break if
> /bin/sh is not bash, even though that number has reduced somewhat since
> Debian made their switch.  Trying to make Cygwin the guinea pig, instead
> of Fedora, is going about it backwards (you WANT the change to be done
> in a place where there is plenty of manpower to deal with the fallout,
> and Fedora has more manpower than Cygwin).

I can see distros like *BSD or Debian making decisions like that or 
systemd, but not vendors like RH or Canonical: too little upside with 
too much downside for paying customers.

> I'm still toying with the idea of doing a test release of both bash
> and dash that flips /bin/sh between them; but I'm still stuck on the
> problem that a user MUST upgrade (or downgrade) both packages in
> tandem, or else risk being left without a /bin/sh at all. Help would
> be appreciated in figuring out the problem (telling me that "dash is
> faster than bash" is not help, nor is telling me that "portable shell
> scripts don't care if /bin/sh is bash or dash" - I already know those
> points. What I don't know is how many non-portable scripts are out
> there, so how much breakage would I be causing by forcing those
> non-portable scripts to deal with their non-portability, and how to
> minimize the even-worse breakage of an upgrade scenario that leaves
> no /bin/sh at all).

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): 
     14 /bin/cronbug
      7 /bin/procmail-config
      5 /bin/ca-legacy
      4 /bin/pcdovtoppm
      3 /bin/ppmshadow
      3 /bin/ppmfade
      3 /bin/fig2ps2tex
      3 /bin/bzgrep
      2 /bin/ppmrainbow
      2 /bin/pnmquant
      2 /bin/pnmflip
      2 /bin/install-catalog
      1 /bin/zgrep
      1 /bin/zdiff
      1 /bin/xzdiff
      1 /bin/updatedb
      1 /bin/texi2dvi
      1 /bin/ppmquant
      1 /bin/pnmquantall
      1 /bin/pic2graph
      1 /bin/pgmcrater
      1 /bin/pdfroff
      1 /bin/messagebus-config
      1 /bin/gzexe
      1 /bin/grap2graph
      1 /bin/gettextize
      1 /bin/gettext.sh
      1 /bin/eqn2graph
      1 /bin/clisp-link
      1 /bin/ccmakedep
      1 /bin/autopoint
      1 /bin/autoconf-2.69

with diagnostics (some from wrapped scripts because of -f):
     16 echo -e
     12 '((' should be '$(('
      7 alternative test command ([[ foo ]] should be [ foo ])
      7 $RANDOM
      6 unsafe echo with backslash
      5 'function' is useless
      4 type
      4 bash arrays, ${name[0|*|@]}
      3 ${parm/?/pat[/str]}
      3 $_
      1 should be '.', not 'source'
      1 $BASH_SOMETHING
      1 $(OS|MACH)TYPE

So about 20% of packages have scripts installed, with potential issues 
ranging from 5-12*70 == 350-840.
Some potential fixes are obvious from my sample (attached, hopefully 
as inline text which will pass thru the filters): 

- change these scripts to shebang #!/bin/bash 
- replace echo -e with printf in most cases
- replace [[ ... ]] with [ ... ] or case if patterns are used 
- strip leading function 
- use  mktemp to eliminate $RANDOM

but most require judgement in application.

Generated scripts like libtool{,ize} may require complex patches submitted 
upstream to fix what may be sh dependent code generation or execution; not 
included in the attached sample, as file categorized these as:
/bin/libtool:    POSIX shell script, ASCII text executable, with very long lines, with escape sequences
/bin/libtoolize: POSIX shell script, ASCII text executable, with very long lines, with escape sequences

> Hmm, maybe I could create a NEW package, 'sh', which packages /bin/sh as
> however I want it (probably bash to begin with, to at least give people
> time to upgrade and pick up the packaging change before also having to
> deal with any shell changing). New releases of both bash and dash would
> depend on the new package, to guarantee that if you upgrade one shell,
> you pick up the dependency.  And by not having /bin/sh in either the
> bash or dash package, then we would at least avoid the current situation
> where upgrading/downgrading in the wrong order could leave a user
> without /bin/sh at all.  You might still be in a situation where the
> wrong version of the 'sh' package leaves you with an outdated version of
> a shell, or the wrong flavor in relation to the current distro choice,
> but that's less of a problem than having no /bin/sh at all.  In fact,
> having a separate 'sh' package may make it even easier to pick which
> shell flavor you prefer (if I always keep the 'curr' and 'test' versions
> pointed to different shells, then you make the choice of which sh flavor
> you want by which version you install).

Smart idea: just a postinstall dash script dependent on the prereq shell, 
ln curr bash->sh, test dash->sh, and respective man 1 page.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
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
error: /bin/autoconf-2.69: Unterminated quoted string found, EOF reached. Wanted: <'>, opened in line 429
possible bashism in /bin/autopoint line 57 ($RANDOM):
    tmp=$TMPDIR/gt$$-$RANDOM
possible bashism in /bin/bzgrep line 66 (${parm/?/pat[/str]}):
    j=${i//\\/\\\\}
possible bashism in /bin/bzgrep line 67 (${parm/?/pat[/str]}):
    j=${j//|/\\|}
possible bashism in /bin/bzgrep line 68 (${parm/?/pat[/str]}):
    j=${j//&/\\&}
possible bashism in /bin/ca-legacy line 61 (alternative test command ([[ foo ]] should be [ foo ])):
if [[ $# -eq 0 ]]; then
possible bashism in /bin/ca-legacy line 67 (alternative test command ([[ foo ]] should be [ foo ])):
if [[ "$1" = "install" ]]; then
possible bashism in /bin/ca-legacy line 72 (alternative test command ([[ foo ]] should be [ foo ])):
if [[ "$1" = "default" ]]; then
possible bashism in /bin/ca-legacy line 76 (alternative test command ([[ foo ]] should be [ foo ])):
if [[ "$1" = "disable" ]]; then
possible bashism in /bin/ca-legacy line 81 (alternative test command ([[ foo ]] should be [ foo ])):
if [[ "$1" = "check" ]]; then
possible bashism in /bin/ccmakedep line 44 (unsafe echo with backslash):
echo " \c" > $CPPCMD
possible bashism in /bin/clisp-link line 133 ($RANDOM):
    tmp=$TMPDIR/gt$$-$RANDOM
possible bashism in /bin/cronbug line 20 (echo -e):
      echo -e "Quitting.\n"
possible bashism in /bin/cronbug line 46 (echo -e):
echo -e "\nThe report is written to the file ./cronbug.txt"
possible bashism in /bin/cronbug line 50 (echo -e):
echo -e "\nCurrent version"
possible bashism in /bin/cronbug line 53 (echo -e):
echo -e "\nRunning crons:"
possible bashism in /bin/cronbug line 56 (echo -e):
echo -e "\nSendmail:"
possible bashism in /bin/cronbug line 59 (echo -e):
echo -e "\nCrontabs:"
possible bashism in /bin/cronbug line 65 (echo -e):
echo -e "\ncron.log:"
possible bashism in /bin/cronbug line 68 (echo -e):
echo -e "\ncron.pid:"
possible bashism in /bin/cronbug line 71 (echo -e):
echo -e "\nCrontab:"
possible bashism in /bin/cronbug line 75 (echo -e):
  echo -e "\nSyslog running"
possible bashism in /bin/cronbug line 77 (echo -e):
  echo -e "\nWindows Application Events log:"
possible bashism in /bin/cronbug line 81 (echo -e):
echo -e "\nCygcheck:"
possible bashism in /bin/cronbug line 87 (echo -e):
	echo -e "\nWARNING: The Windows application log contains cron"
possible bashism in /bin/cronbug line 92 (echo -e):
	echo -e "\nWARNING: You have multiple cygwin.dll in your PATH."
possible bashism in /bin/eqn2graph line 68 ($RANDOM):
    tmp=$d/eqn2graph$$-$RANDOM
possible bashism in /bin/fig2ps2tex line 18 (unsafe echo with backslash):
echo "  \vbox to ${ysp}in{"
possible bashism in /bin/fig2ps2tex line 19 (unsafe echo with backslash):
echo "    \vfill"
possible bashism in /bin/fig2ps2tex line 22 (unsafe echo with backslash):
echo "  \vspace{-\baselineskip}"
possible bashism in /bin/gettext.sh line 20 (unsafe echo with backslash):
if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
possible bashism in /bin/gettextize line 57 ($RANDOM):
    tmp=$TMPDIR/gt$$-$RANDOM
possible bashism in /bin/grap2graph line 64 ($RANDOM):
    tmp=$d/grap2graph$$-$RANDOM
possible bashism in /bin/gzexe line 118 (type):
    type mktemp >/dev/null 2>&1
error: /bin/igawk: Unterminated quoted string found, EOF reached. Wanted: <'>, opened in line 80
possible bashism in /bin/install-catalog line 91 (echo -e):
  echo -e $SGML_HELP_MESSAGE >&2
possible bashism in /bin/install-catalog line 114 (echo -e):
  echo -e $SGML_HELP_MESSAGE >&2
possible bashism in /bin/messagebus-config line 26 (should be '.', not 'source'):
source ${CSIH_SCRIPT}
possible bashism in /bin/pcdovtoppm line 137 (bash arrays, ${name[0|*|@]}):
        if [ "${description[4]}" -le $size -a \
             "${description[6]}" -le $size ] ; then
possible bashism in /bin/pcdovtoppm line 162 (bash arrays, ${name[0|*|@]}):
    width=$(( $width + ${description[4]} ))
possible bashism in /bin/pcdovtoppm line 185 (bash arrays, ${name[0|*|@]}):
if [ ${#imagefiles[*]} -gt 0 ] ; then
possible bashism in /bin/pcdovtoppm line 198 (bash arrays, ${name[0|*|@]}):
if [ ${#rowfiles[*]} = 1 ]; then
possible bashism in /bin/pdfroff line 425 (unsafe echo with backslash):
  case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
possible bashism in /bin/pgmcrater line 45 ('((' should be '$(('):
    if (defined($arg1) && (($arg1 eq "--version") || ($arg1 eq "-version"))) {
possible bashism in /bin/pic2graph line 78 ($RANDOM):
    tmp=$d/pic2graph$$-$RANDOM
possible bashism in /bin/pnmflip line 76 ($_):
            push(@miscOptions, $_);
possible bashism in /bin/pnmflip line 85 ($_):
            $infile = $_;
possible bashism in /bin/pnmquant line 52 ('((' should be '$(('):
    if (defined($arg1) && (($arg1 eq "--version") || ($arg1 eq "-version"))) {
possible bashism in /bin/pnmquant line 183 ($_):
                print($inFh $_);
possible bashism in /bin/pnmquantall line 70 ('((' should be '$(('):
    if (defined($arg1) && (($arg1 eq "--version") || ($arg1 eq "-version"))) {
possible bashism in /bin/ppmfade line 50 ('((' should be '$(('):
    if (defined($arg1) && (($arg1 eq "--version") || ($arg1 eq "-version"))) {
possible bashism in /bin/ppmfade line 136 ('((' should be '$(('):
    if ((`pnmfile $first_file` =~ m{\b(\d+)\sby\s(\d+)} )) { 
possible bashism in /bin/ppmfade line 143 ('((' should be '$(('):
    if ((`pnmfile $last_file` =~ m{\b(\d+)\sby\s(\d+)} )) { 
possible bashism in /bin/ppmquant line 43 ('((' should be '$(('):
    if (defined($arg1) && (($arg1 eq "--version") || ($arg1 eq "-version"))) {
possible bashism in /bin/ppmrainbow line 41 ('((' should be '$(('):
    if (defined($arg1) && (($arg1 eq "--version") || ($arg1 eq "-version"))) {
possible bashism in /bin/ppmrainbow line 114 ('((' should be '$(('):
    my $w = int(($widthRemaining-1)/(@colorlist-1))+1;
possible bashism in /bin/ppmshadow line 65 ('((' should be '$(('):
    if (defined($arg1) && (($arg1 eq "--version") || ($arg1 eq "-version"))) {
possible bashism in /bin/ppmshadow line 127 ('((' should be '$(('):
    if ((substr($arg, 0, 1) eq '-') && (length($arg) > 1)) {
possible bashism in /bin/ppmshadow line 135 ('((' should be '$(('):
            if (($convolve < 11) && (($convolve & 1) == 0)) {
possible bashism in /bin/procmail-config line 7 ('function' is useless):
function syntax {
possible bashism in /bin/procmail-config line 19 ('function' is useless):
function welcome {
possible bashism in /bin/procmail-config line 36 ('function' is useless):
function groupadd {
possible bashism in /bin/procmail-config line 37 (alternative test command ([[ foo ]] should be [ foo ])):
	if [[ `getent group "$1"` ]]; then
possible bashism in /bin/procmail-config line 50 ('function' is useless):
function set_group {
possible bashism in /bin/procmail-config line 51 (alternative test command ([[ foo ]] should be [ foo ])):
	if ! [[ `getent group "$1"` ]]; then
possible bashism in /bin/procmail-config line 88 ('function' is useless):
function do_setgid {
error: /bin/sqlite3_analyzer: Unterminated quoted string found, EOF reached. Wanted: <'>, opened in line 279
possible bashism in /bin/texi2dvi line 96 ($(OS|MACH)TYPE):
if test -n "$COMSPEC$ComSpec" \
   && MSYSTEM=$OSTYPE uname | $EGREP -iv 'cygwin|msys' >/dev/null; then
error: /bin/texi2dvi: Unterminated quoted string found, EOF reached. Wanted: <">, opened in line 1823
possible bashism in /bin/updatedb line 236 ($RANDOM):
        tmp="$TMPDIR"/updatedb"$$"-"${RANDOM:-}${ts}"
possible bashism in /bin/xzdiff line 142 (type):
            if type mktemp >/dev/null 2>&1; then
error: /bin/xzgrep: Unterminated quoted string found, EOF reached. Wanted: <'>, opened in line 189
possible bashism in /bin/zdiff line 119 (type):
                        if type mktemp >/dev/null 2>&1; then
possible bashism in /bin/zgrep line 136 (type):
      if type mktemp >/dev/null 2>&1; then
error: /bin/zgrep: Unterminated quoted string found, EOF reached. Wanted: <'>, opened in line 223
--
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