Skip to content

[bug] Cosmetic redir diagnostics batch: doubled filename, missing connect/servname lines, pipe interleave order #1237

Closed

Description

@caomengxuan666

niu 1.4.4, rubash 1b14a3d vs GNU bash 5.3. Repro: ~/niutest/agentFAv/cosmo.sh. All are message-text/ordering diffs only — exit codes and redirection targets match.

  1. <> file (O_RDWR open) failure doubles the filename; >/>> on the same target do not:
echo hi <> /data/data/com.termux/files/usr/tmp
# GNU: cosmo.sh: line 1: /data/.../tmp: Is a directory
# niu:  cosmo.sh: line 1: /data/.../tmp: /data/.../tmp: Is a directory
  1. /dev/tcp refused-connect drops GNU's bare first line:
(exec 3<>/dev/tcp/127.0.0.1/1)
# GNU prints BOTH:  cosmo.sh: connect: Connection refused
#                    cosmo.sh: line 2: /dev/tcp/127.0.0.1/1: Connection refused
# niu prints only the second line.
  1. /dev/tcp bad service name drops GNU's resolver first line:
(exec 3<>/dev/tcp/127.0.0.1/notaport)
# GNU prints BOTH:  cosmo.sh: line 3: notaport: servname not supported for ai_socktype
#                    cosmo.sh: line 3: /dev/tcp/127.0.0.1/notaport: Invalid argument
# niu prints only the second line.
  1. Write-error vs subsequent-output order through a pipe is swapped (deterministic, 3/3 runs each):
(echo hi >&-; echo "rc=0") 2>&1 | cat
# GNU: 'echo: write error: Bad file descriptor' THEN 'rc=1'
# niu:  'rc=1' THEN 'echo: write error: Bad file descriptor'

(stderr-to-file/devnull routing itself matches — verified separately — so this is interleave order only.)

Distinct from #1202 (test -v bypass), #1208 (mapfile markers), #1102 (exec-stdin-in-pipe).

Activity

  1. added
    bug
    gnu-baseline
    area:fd
    P2-medium
    P3-low
    and removed
    P2-medium
    on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P3-lowarea:fdbuggnu-baseline

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions