This is the mail archive of the cygwin-apps 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: Upload: bash-3.0-4 [test]


On Jul  5 19:52, Eric Blake wrote:
> > > Or, I could first do "cygcheck /bin/sh.exe", and see if "Error: could
> > > not find <libname>.dll" appears in the output [...]
> > 
> > Or even just test -f...
> 
> "test -f /bin/sh.exe" checks whether /bin/sh exists.  From there,
> "cygcheck /bin/sh.exe" and parsing the output for "Error: could not find"
> checks whether attempting to run sh would cause a popup box.  (Too
> bad cygcheck exit status doesn't currently work).  So, how about this,
> which only runs /bin/sh --version if cygcheck found no missing
> dependencies:
> 
> 00bash.sh:
> 
> #!/bin/bash
> # Update /bin/sh to be this version of bash if it is missing, ash,
> # older bash, or un-runnable.  Leave it alone if it is anything else.
> 
> running=yes update=yes
> test -x /bin/sh.exe || running=no  # missing executable
> case `cygcheck /bin/sh.exe` in
>     *Error:\ could\ not\ find*) running=no;;  # missing library
> esac
> test $running = yes && case `/bin/sh.exe --version 2>&1` in
>     Illegal\ option\ --*) ;; # ash
>     GNU\ bash*) ;; # possibly-older version of bash
>     *) update=no ;; # leave anything else alone
> esac
> test $update = yes && ln -f /bin/bash.exe /bin/sh.exe
> 
> 
> This works even on the upgrade path that Igor originally complained
> about, without requiring a separate preremove.  Users wanting to
> completely uninstall cygwin already have enough other files which
> setup.exe won't remove, that leaving a dangling /bin/sh won't be
> any worse than the status quo.

Looks basically good to me and I was going to use it for the 00ash.sh
script.  It just doesn't work on NTFS.  The reason is that, as soon as
the hardlink has been created, the script will fail to run another time:

$ /bin/bash 00bash.sh
$ /bin/bash 00bash.sh
ln: cannot remove `/bin/sh.exe': Permission denied

Unfortunately, since the hardlink points to the same executable which
is going to be replaced *and* is running the script, the OS refuses
to unlink the executable.

So, it looks to me we should refrain from using ln but use cp instead.
Who cares for 500K?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.


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