bug-gawk
[Top][All Lists]
Advanced

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

Re: Fix Gawk bug that puts stderr into O_APPEND mode


From: arnold
Subject: Re: Fix Gawk bug that puts stderr into O_APPEND mode
Date: Tue, 18 Feb 2025 07:36:37 -0700
User-agent: Heirloom mailx 12.5 7/5/10

Thanks. This is now in Git.

Arnold

Paul Eggert <eggert@cs.ucla.edu> wrote:

> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -g -O2 -DNDEBUG
> uname output: Linux wing 6.11.0-14-generic #15-Ubuntu SMP 
> PREEMPT_DYNAMIC Fri Jan 10 23:48:25 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
> Machine Type: x86_64-pc-linux-gnu
>
> Gawk Version: 5.3.60
>
> Attestation 1:
>       I have read 
> https://www.gnu.org/software/gawk/manual/html_node/Bugs.html.
>       Yes
>
> Attestation 2:
>       I have not modified the sources before building gawk.
>       True
>
> Description:
>       'gawk' puts stderr into O_APPEND mode to work around BSD
>       glitches.  Unfortunately this can cause other programs to
>       misbehave.  Also, this behavior doesn't conform to POSIX.
>
>       I ran into this issue when someone reported that Gawk put
>       /dev/tty into O_APPEND mode, which messed up GNU 'cat'.
>       Although this is a bug in GNU 'cat', it's also a bug in Gawk.
>
> Repeat-By:
>       Run the following shell commands:
>         echo abcdefgh >foo
>            (gawk 'BEGIN{}'; echo ouch >&2) 2<>foo
>         cat foo
>
>       The output is:
>         abcdefgh
>         ouch
>
>       The output should be:
>         ouch
>         fgh
>
>
> Fix:
>       Attached.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]