This is the mail archive of the cygwin-talk mailing list for the cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Changed handling of "!" in /bin/sh?


Eric Blake wrote on Wednesday, January 17, 2007 9:40 PM:

> According to Buchbinder, Barry (NIH/NIAID) [E] on 1/17/2007 4:14 PM:
>>> Not recommended.  The reason cygwin moved to bash as /bin/sh was to
>>> avoid ash bugs.
>> 
>> I thought that it was more to avoid all the complaints that sh did
>> not behave like bash, which is what many people expected.
> 
> And that is different from an ash bug, how?  :)

And there aren't other behaviors of cygwin than differ from what people
expect, based on their prior experience with Linux & Friends, that we
say, basically, "that's the way it is and its because of X so (submit a
patch and in the meantime) get used to it"?  :-)

I still use ash as /bin/sh and for most of my scripts.  In part, this
was because the argument that bash's slowness upon loading was
compensated for by the speed up one could get from bash builtin
functionality as compared with ash's need to load utilities to get the
same functionality.  I felt it was easier for me to stick with ash and
not need to re-write many of the scripts.  (Note: This is an explanation
of why I largely stuck with ash and was not intended as a criticism of
the sh=ash => sh=bash decision.  (Though it might be nice if setup.exe
as one what sh is desired  I've now got a script which checks whether sh
has been updated to bash and, if so, copies ash.exe over sh.exe.))

- Barry
  -  Disclaimer: Statements made herein are not made on behalf of NIAID.

# === FOR THE RECORD ==

# ==== bash vs. ash ===

/c> 0.0 /c> for Shell in bash 'bash --posix' ash; do echo; echo -n
"${Shell}" ; time for (( F=1 ; F <= 1000 ; F++ )) ; do ${Shell} -c exit
; done ; done

bash
real    0m58.662s
user    0m40.700s
sys     0m37.103s

bash --posix
real    0m57.941s
user    0m41.414s
sys     0m35.750s

ash
real    0m32.629s
user    0m35.612s
sys     0m19.356s

# === What gets run as part of a batch file loaded from the StartUp
folder ===

start /wait h:\cygwin\arc\setup.exe -R c:\cygwin -n -q -s
ftp://mirrors.kernel.org -l h:\cygwin\arc 
c:\cygwin\bin\ash -c /usr/local/bin/chk_sh.sh

# === Script to check sh.exe, run after automatic run of setup upon
booting ===

$ /c> cat /usr/local/bin/chk_sh.sh
#!/bin/ash
cd /bin
if test $(stat -c %s sh.exe) = $(stat -c %s ash.exe)
then
        echo 'sh.exe is ash.exe'
        ls.exe --color=auto --time-style=+%F\ %T -og ash.exe bash.exe
sh.exe
else
        echo 'Linking sh.exe to ash.exe'
        ls.exe --color=auto --time-style=+%F\ %T -og ash.exe bash.exe
sh.exe
        rm -v sh.exe
        cp -pv ash.exe sh.exe
        ls.exe --color=auto --time-style=+%F\ %T -og ash.exe bash.exe
sh.exe
fi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]