Re: RFC PATCH 1/2] AS_INIT: try to ensure fds 0, 1, 2 are open

2020-08-28 Thread Zack Weinberg
On Thu, Aug 27, 2020 at 6:49 PM Paul Eggert wrote: > > On 8/27/20 3:20 PM, Zack Weinberg wrote: > > On Thu, Aug 27, 2020 at 2:09 PM Paul Eggert wrote: > >> > >>> + if (exec 3>&0) 2>/dev/null; then :; else exec 0 >>> + if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi > >>> + if

Re: RFC PATCH 1/2] AS_INIT: try to ensure fds 0, 1, 2 are open

2020-08-27 Thread Paul Eggert
On 8/27/20 3:20 PM, Zack Weinberg wrote: On Thu, Aug 27, 2020 at 2:09 PM Paul Eggert wrote: + if (exec 3>&0) 2>/dev/null; then :; else exec 0&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

Re: RFC PATCH 1/2] AS_INIT: try to ensure fds 0, 1, 2 are open

2020-08-27 Thread Zack Weinberg
On Thu, Aug 27, 2020 at 2:09 PM Paul Eggert wrote: > > > + if (exec 3>&0) 2>/dev/null; then :; else exec 0 > + 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;

Re: RFC PATCH 1/2] AS_INIT: try to ensure fds 0, 1, 2 are open

2020-08-27 Thread Paul Eggert
+ if (exec 3>&0) 2>/dev/null; then :; else exec 0&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

[RFC PATCH 1/2] AS_INIT: try to ensure fds 0, 1, 2 are open

2020-08-27 Thread Zack Weinberg
A patch was recently proposed for GNU libc to make *all* processes start up with file descriptors 0, 1, and 2 guaranteed to be open. Part of the rationale for this patch was that configure scripts fail catastrophically if these fds are closed, even if you just want to run --help or --version, e.g.