Unexpected behavior of an uncommon use case:

$ uname -r
3.7.0-0.98.gb39b510c1ce6.x86_64

$ cygstart mintty - # Start second terminal

In second terminal:

$ echo $$; tty
1219
/dev/pty1

Back to first terminal:

$ dd of=/proc/1219/fd/1 <<<"Hello" # errno=EBADF
dd: error writing '/proc/1219/fd/1': Bad file descriptor
0+1 records in
0+0 records out
0 bytes copied, 8.22e-05 s, 0.0 kB/s

$ readlink /proc/1219/fd/1
/dev/pty1

$ dd of=/dev/pty1 <<<"Hello" # OK, text appears in 2nd terminal
0+1 records in
0+1 records out
6 bytes copied, 5.41e-05 s, 111 kB/s

$ dd of=/proc/$$/fd/1 <<<"Hello" # OK
Hello
0+1 records in
0+1 records out
6 bytes copied, 4.77e-05 s, 126 kB/s

The problem apparently only occurs if /proc/PID/fd/N points to a foreign pty. It works for own pty or regular files.

--
Regards,
Christian


--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to