[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gawk] coprocess pseudo-tty bug
From: |
Andrew J. Schorr |
Subject: |
[bug-gawk] coprocess pseudo-tty bug |
Date: |
Wed, 3 Jan 2018 08:31:44 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi,
A discussion in comp.lang.awk about coprocess deadlock and pseudo-ttys has
revealed what appears to be a bug, although I do not yet understand what
is going wrong.
https://groups.google.com/forum/#!topic/comp.lang.awk/pz4gmSw0uas
bash-4.2$ cat /tmp/pty.awk
BEGIN {
cmd = "tr A-Z a-z"
PROCINFO[cmd, "pty"] = 1
input = "ABCD"
print input |& cmd
cmd |& getline x
print x
}
This works correctly in gawk 4.1.2:
bash-4.2$ ./gawk --version | head -1
GNU Awk 4.1.2, API: 1.1 (GNU MPFR 3.1.1, GNU MP 6.0.0)
bash-4.2$ ./gawk -f /tmp/pty.awk
abcd
bash-4.2$ ./gawk -f /tmp/pty.awk | od -c
0000000 a b c d \n
0000005
By 4.1.4, it is broken:
bash-4.2$ cd ../gawk-4.1.4
bash-4.2$ ./gawk --version | head -1
GNU Awk 4.1.4, API: 1.1 (GNU MPFR 3.1.1, GNU MP 6.0.0)
bash-4.2$ ./gawk -f /tmp/pty.awk
ABCD
bash-4.2$ ./gawk -f /tmp/pty.awk | od -c
0000000 A B C D \r \n
0000006
And it is still broken in the gawk-4.2-stable branch:
bash-4.2$ ./gawk --version | head -1
GNU Awk 4.2.0b, API: 2.0 (GNU MPFR 3.1.1, GNU MP 6.0.0)
bash-4.2$ ./gawk -f /tmp/pty.awk
ABCD
bash-4.2$ ./gawk -f /tmp/pty.awk | od -c
0000000 A B C D \r \n
0000006
I have not had a chance to chase this down yet. I guess "git bisect" is
the way to go.
Regards,
Andy
- [bug-gawk] coprocess pseudo-tty bug,
Andrew J. Schorr <=
- Re: [bug-gawk] coprocess pseudo-tty bug, arnold, 2018/01/03
- Re: [bug-gawk] coprocess pseudo-tty bug, Andrew J. Schorr, 2018/01/03
- Re: [bug-gawk] coprocess pseudo-tty bug, Andrew J. Schorr, 2018/01/03
- Re: [bug-gawk] coprocess pseudo-tty bug, Andrew J. Schorr, 2018/01/03
- Re: [bug-gawk] coprocess pseudo-tty bug, arnold, 2018/01/03
- Re: [bug-gawk] coprocess pseudo-tty bug, arnold, 2018/01/03
- Re: [bug-gawk] coprocess pseudo-tty bug, Andrew J. Schorr, 2018/01/03
- Re: [bug-gawk] coprocess pseudo-tty bug, arnold, 2018/01/03
- Re: [bug-gawk] coprocess pseudo-tty bug, arnold, 2018/01/04