[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC PATCH 1/2] AS_INIT: try to ensure fds 0, 1, 2 are open
From: |
Zack Weinberg |
Subject: |
Re: RFC PATCH 1/2] AS_INIT: try to ensure fds 0, 1, 2 are open |
Date: |
Thu, 27 Aug 2020 18:20:26 -0400 |
On Thu, Aug 27, 2020 at 2:09 PM Paul Eggert <eggert@cs.ucla.edu> wrote:
>
> > + if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi
> > + if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
> > + if (exec 3>&2) ; then :; else exec 2>/dev/null; fi
>
> This is all _AS_ENSURE_STANDARD_FDS needs to do; none of the other stuff is
> needed and I suggest omitting it as a maintenance time-sink.
I can definitely see how the rest of it could turn into a maintenance
time sink, but are you sure we don't need a workaround of any kind for
this construct succeeding even though the target fd is closed, in very
old shells? I wouldn't be concerned for almost anything else, but
this is the _generated configure scripts_ we're talking about here.
Coping with very old shells is a big part of why they exist still, and
are still shell scripts.
> not that 'read' from 0 or 'write' to 1 or 2 must succeed (there's never any
> guarantee of that).
I'm not 100% convinced by this argument but I don't have a real
counterargument either and in any case it's more on-topic for the
glibc thread, not here.
zw