delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/08/13/12:15:15

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4C656F3F.6030601@redhat.com>
Date: Fri, 13 Aug 2010 10:13:51 -0600
From: Eric Blake <eblake AT redhat DOT com>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.1.1
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: bash postinstall script returns an error
References: <4C648E6C DOT 5070705 AT ntlworld DOT com>
In-Reply-To: <4C648E6C.5070705@ntlworld.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--------------enig19BC618FE15F3A4E7245F436
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 08/12/2010 06:14 PM, cy DOT 20 DOT superconductor AT xoxy DOT net 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.
>=20
> When I run setup.exe I always get an error for the bash.sh postinstall
> script, it seems to be on the line of:
>=20
> /bin/test -e /dev/stdin  || ln -s /proc/self/fd/0 /dev/stdin  || result=
=3D1
>=20
> 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 $?
0
$ test -e /dev/stdin <&-; echo $?
1
$ test -h /dev/stdin; echo $?
0
$ test -h /dev/stdin <&-; echo $?
0

Thanks for insisting that I fix this.

--=20
Eric Blake   eblake AT redhat DOT com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


--------------enig19BC618FE15F3A4E7245F436
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJMZW9AAAoJEKeha0olJ0NqZxIIAIHxDb/vtqael40GtxF+gmsc
t5e5ukIpZ8ZFnAOFCdMRzyeoKWLn8QLO0ZYwaqedwg/quv+9OEFOhMqkKtVu0I05
ymVNwmq+Oxbp1dk7saVHHeCwwwybZyuMQigYMDd1Laa6CfGCXcf4Xrt+VhDvCQdz
iCzDvCHZAi7XwLbeVr/333VPOE38ZBM4jzgHat1UKbobE+wvKk7mcHte+d5w+EMJ
EpT1lQI4+suNE97sEyDY/EgGY6Zbu+vvwUUBZA4JmHMyDtrDh5d8Yft7EIMcozn6
dv9GK3MJb0TrPyMimnW3WJNC4imNN1gCaSfdDgqzhnZPbTj5S6jNtmC/MYnu45s=
=Z5Bq
-----END PGP SIGNATURE-----

--------------enig19BC618FE15F3A4E7245F436--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019