bug-gawk
[Top][All Lists]
Advanced

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

Fix Gawk bug that puts stderr into O_APPEND mode


From: Paul Eggert
Subject: Fix Gawk bug that puts stderr into O_APPEND mode
Date: Fri, 14 Feb 2025 11:35:00 -0800
User-agent: Mozilla Thunderbird

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.

Attachment: 0001-Fix-bug-that-put-stderr-into-O_APPEND-mode.patch
Description: Text Data


reply via email to

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