public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* bash postinstall script returns an error
@ 2010-08-13  0:14 cy.20.superconductor
  2010-08-13 15:29 ` Jeremy Ramer
  2010-08-13 16:15 ` Eric Blake
  0 siblings, 2 replies; 3+ messages in thread
From: cy.20.superconductor @ 2010-08-13  0:14 UTC (permalink / raw)
  To: cygwin

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".

If I run the postinstall script manually, test gives a status of 0, 
stdin is left alone and the script runs to the end successfully - it 
only fails when run from inside the installer (2.712) for me. I've tried 
invoking bash for the script using the same switches as those reported 
in setup.log.full, but it still runs fine when done manually.

If I remove /dev/stdin /dev/stdout and /dev/stderr the installer runs 
through fine.

The result isn't a big problem since the files exist, but it does seem odd.

Paul




--
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bash postinstall script returns an error
  2010-08-13  0:14 bash postinstall script returns an error cy.20.superconductor
@ 2010-08-13 15:29 ` Jeremy Ramer
  2010-08-13 16:15 ` Eric Blake
  1 sibling, 0 replies; 3+ messages in thread
From: Jeremy Ramer @ 2010-08-13 15:29 UTC (permalink / raw)
  To: cygwin

On Thu, Aug 12, 2010 at 6:14 PM,  <cy.20.superconductor@xoxy.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.
>
> 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".
>
> If I run the postinstall script manually, test gives a status of 0, stdin is
> left alone and the script runs to the end successfully - it only fails when
> run from inside the installer (2.712) for me. I've tried invoking bash for
> the script using the same switches as those reported in setup.log.full, but
> it still runs fine when done manually.

I saw the exact same results. I didn't mention it in the other thread
because the error didn't occur on manual run.

--
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bash postinstall script returns an error
  2010-08-13  0:14 bash postinstall script returns an error cy.20.superconductor
  2010-08-13 15:29 ` Jeremy Ramer
@ 2010-08-13 16:15 ` Eric Blake
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2010-08-13 16:15 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1330 bytes --]

On 08/12/2010 06:14 PM, cy.20.superconductor@xoxy.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.
> 
> 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 $?
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.

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-13 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-13  0:14 bash postinstall script returns an error cy.20.superconductor
2010-08-13 15:29 ` Jeremy Ramer
2010-08-13 16:15 ` Eric Blake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).