Bug 2417885 - Regression: Bash command substitution (`$()`) running `gawk` permanently corrupts shell file descriptors (FD 0/1), even with explicit `< /dev/null` redirection.
Summary: Regression: Bash command substitution (`$()`) running `gawk` permanently corr...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gawk
Version: 42
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jakub Martisko
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-11-30 17:19 UTC by Tom R
Modified: 2026-06-10 15:10 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2026-06-10 15:10:28 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Tom R 2025-11-30 17:19:05 UTC
@@ Fedora AWK/Pipe Corruption Bug Report :2025-11-30_Sun:LxtAnx9c:  op{
# Fedora Bug Report: gawk/Pipe Corruption (Fedora 42)

1. TITLE (One-Line Summary)

Regression: Bash command substitution (`$()`) running `gawk` permanently corrupts shell file descriptors (FD 0/1), even with explicit `< /dev/null` redirection.


2. ENVIRONMENT DETAILS

• OS: Fedora 42 (x86_64)
• Kernel: `6.17.8-200.fc42.x86_64`
• Package: `gawk-5.3.1-1.fc42.x86_64`
• Shell: `bash` (version 5.2 or similar)

• Behavior: When `gawk` is executed in a command substitution (`$()`), the parent shell's I/O streams are permanently linked (`stdin` == `stdout`), causing safety checks in other programs like `cat` to fail.


3. STEPS TO REPRODUCE

	1. Start a fresh interactive terminal session.

	2. Create a simple configuration file: ```bash $ echo "key value" > test.cfg ```

	3. Run the command substitution using `awk`, explicitly redirecting its Standard Input (FD 0) to `/dev/null`: ```bash $ test_var=$(awk '/^key / {print $2}' test.cfg < /dev/null) ```

	4. Immediately try to run the standard, interactive `cat` command: ```bash $ cat ```

4. ACTUAL RESULTS

The `cat` command fails with the I/O safety error:


``` cat: -: input file is output file ```

5. EXPECTED RESULTS

The command substitution should run silently, and the `cat` command should wait for keyboard input (the standard interactive behavior).

6. CRITICAL DIAGNOSTIC INFORMATION

The bug is not an `awk` default behavior issue. The corruption occurs despite the explicit redirection of FD 0 using `< /dev/null`. This implies a deeper issue in how the Bash pipe mechanism interacts with the `gawk` executable in this specific Fedora environment.


A functionally similar command using `sed` does NOT cause the error, even when run inside the same command substitution:


```bash $ test_var=$(sed -n '/^key /p;q' test.cfg) $ cat  # This works fine and does not trigger the error. ```


This suggests an internal conflict within the `gawk` binary itself or how the operating system handles the file descriptors when `gawk` is initialized inside a pipeline. The bug is a regression because this behavior did not occur in previous Fedora versions.


Reproducible: Always

Steps to Reproduce:


3. STEPS TO REPRODUCE

	1. Start a fresh interactive terminal session.

	2. Create a simple configuration file: ```bash $ echo "key value" > test.cfg ```

	3. Run the command substitution using `awk`, explicitly redirecting its Standard Input (FD 0) to `/dev/null`: ```bash $ test_var=$(awk '/^key / {print $2}' test.cfg < /dev/null) ```

	4. Immediately try to run the standard, interactive `cat` command: ```bash $ cat ```

4. ACTUAL RESULTS

The `cat` command fails with the I/O safety error:


``` cat: -: input file is output file ```

5. EXPECTED RESULTS

The command substitution should run silently, and the `cat` command should wait for keyboard input (the standard interactive behavior).

6. CRITICAL DIAGNOSTIC INFORMATION

The bug is not an `awk` default behavior issue. The corruption occurs despite the explicit redirection of FD 0 using `< /dev/null`. This implies a deeper issue in how the Bash pipe mechanism interacts with the `gawk` executable in this specific Fedora environment.


A functionally similar command using `sed` does NOT cause the error, even when run inside the same command substitution:
3. STEPS TO REPRODUCE

	1. Start a fresh interactive terminal session.

	2. Create a simple configuration file: ```bash $ echo "key value" > test.cfg ```

	3. Run the command substitution using `awk`, explicitly redirecting its Standard Input (FD 0) to `/dev/null`: ```bash $ test_var=$(awk '/^key / {print $2}' test.cfg < /dev/null) ```

	4. Immediately try to run the standard, interactive `cat` command: ```bash $ cat ```

4. ACTUAL RESULTS

The `cat` command fails with the I/O safety error:


``` cat: -: input file is output file ```

5. EXPECTED RESULTS

The command substitution should run silently, and the `cat` command should wait for keyboard input (the standard interactive behavior).

6. CRITICAL DIAGNOSTIC INFORMATION

The bug is not an `awk` default behavior issue. The corruption occurs despite the explicit redirection of FD 0 using `< /dev/null`. This implies a deeper issue in how the Bash pipe mechanism interacts with the `gawk` executable in this specific Fedora environment.


A functionally similar command using `sed` does NOT cause the error, even when run inside the same command substitution:

Comment 1 Grisha Levit 2025-12-12 03:33:40 UTC
See coreutils cat [1] and gawk [2] bugs below.

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76255
[2] https://lists.gnu.org/r/bug-gawk/2025-02/msg00003.html

Comment 2 Andrew J. Schorr 2025-12-12 14:57:31 UTC
Thanks for chasing this down. I think then that the bug should be fixed in gawk-5.3.2, which was released in April.
So the question becomes why Fedora hasn't upgraded to gawk-5.3.2 yet...

Regards,
Andy

Comment 3 Jakub Martisko 2026-01-06 13:03:51 UTC
(In reply to Andrew J. Schorr from comment #2)
> Thanks for chasing this down. I think then that the bug should be fixed in
> gawk-5.3.2, which was released in April.
> So the question becomes why Fedora hasn't upgraded to gawk-5.3.2 yet...
> 
> Regards,
> Andy

It has, in F43: https://src.fedoraproject.org/rpms/gawk

Comment 4 Fedora Release Engineering 2026-05-06 15:24:49 UTC
This message is a reminder that Fedora Linux 42 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 42 on 2026-05-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '42'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 42 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 5 Aoife Moloney 2026-06-10 15:10:28 UTC
Fedora Linux 42 entered end-of-life (EOL) status on 2026-05-27.

Fedora Linux 42 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.