Re: [PATCH v2] Ensure standard file descriptors are open on start

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-08-28, Paul Eggert <eggert@xxxxxxxxxxx> wrote:
> On 8/28/20 6:52 AM, Zack Weinberg wrote:
>> I think that for 2.70 we should make fd 0 read-only and 1,2
>> write-only here, and revisit this afterward -- when we're not in a
>> release freeze we can think about things like turning on set -e mode.
>
> Sounds good.
>
> In the longer term I doubt whether set -e is the way to go. I recall some
> old shells mishandling it (e.g., with 'set -e' the command 'A || B' would
> cause the shell to exit when A failed). And I suspect the use of 'set -e' to
> detect shell errors is problematic even today. 'set -e' is intended more as
> a debugging aid than as a programming facility.

Even if the shell implements POSIX requirements with no bugs, The semantics
for 'set -e' get so weird when complex commands are involved and that
weirdness propagates down into shell functions in very unintuitive ways.

Whether or not 'set -e' has any effect at all in a shell function body
depends on the specific shell syntax used at the point of the function
call!

It certainly should not be enabled at the top level of configure scripts
by Autoconf (or any nontrivial shell script, really) as that will just
lead everyone to madness.

Cheers,
  Nick




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux