Subject: Re: cat: error without arguments
From: lilydjwg <[email-masked]>
To: [email-masked]
Date: Thu, 13 Feb 2025 15:13:58 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

On Thu, Feb 13, 2025 at 02:45:39PM +0800, lilydjwg wrote:
> In the past I can run `cat` without any arguments and it prints
> whatever I type at the terminal. However since 9.6, `cat` reports the
> following error:
> 
> cat: -: input file is output file

Ah, I find it's not always reproducible, and a strace reveals that the
stdout flags are different:

Erroring cat (in my existing shell session):

fcntl(1</dev/pts/5<char 136:5>>, F_GETFL) = 0x402 (flags O_RDWR|O_APPEND)

Working cat (in a new shell session):

fcntl(1</dev/pts/11<char 136:11>>, F_GETFL) = 0x2 (flags O_RDWR)

I'm using zsh, and this issue starts to occur after I do a tab
completion (in my case, type "cat" and then tab). Other users report
that some fish completion can also cause this issue.

The terminal in use itself seems to not matter. I'm using GNOME
Terminal, inside and outside tmux.

-- 
Best regards,
lilydjwg