bash postinstall script returns an error
Fri Aug 13 16:15:00 GMT 2010
On 08/12/2010 06:14 PM, firstname.lastname@example.org wrote:
> I was going to mention passwd-grp.sh, but I see there's already a thread
> for that, so I'll move right on to the next one.
> When I run setup.exe I always get an error for the bash.sh postinstall
> script, it seems to be on the line of:
> /bin/test -e /dev/stdin || ln -s /proc/self/fd/0 /dev/stdin || result=1
> I'm not so clear as to why this fails. test returns a status of 1 when
> the script is run by the installer, and yet /dev/stdin does exist.
> setup.log.full contains a predictable "ln: creating symbolic link
> `/dev/stdin': File exists".
Aha. I finally figured out why.
The postinstall script is run with stdin closed, but when you run it by
hand, unless you did the redirection <&-, you run with stdin open.
test -e /dev/stdin fails if it is a dangling symlink (which it is when
stdin is closed), which then tries the ln but that fails because the
dangling symlink is in the way.
I should really be using test -h.
$ test -e /dev/stdin; echo $?
$ test -e /dev/stdin <&-; echo $?
$ test -h /dev/stdin; echo $?
$ test -h /dev/stdin <&-; echo $?
Thanks for insisting that I fix this.
Eric Blake email@example.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 619 bytes
Desc: OpenPGP digital signature
More information about the Cygwin