Mailing List Archive

[Bug 856] scp hangs on FIFOs rather than erroring
http://bugzilla.mindrot.org/show_bug.cgi?id=856

Summary: scp hangs on FIFOs rather than erroring
Product: Portable OpenSSH
Version: 3.8p1
Platform: Other
URL: http://bugs.debian.org/246774
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: scp
AssignedTo: openssh-bugs@mindrot.org
ReportedBy: cjwatson@debian.org


scp hangs if you ask it to copy a named pipe whose other end is closed, rather
than printing the "not a regular file" error the way it's supposed to.

strace shows that this is because it does open() then fstat(), but doing open()
on a closed FIFO hangs. Perhaps it should open with O_NONBLOCK? My open(2)
manual page says: "When possible, the file is opened in non-blocking mode.
Neither the open nor any subsequent operations on the file descriptor which is
returned will cause the calling process to wait."

See http://www.opengroup.org/onlinepubs/009695399/functions/open.html for
SuSv3/POSIX's description of O_NONBLOCK, which explicitly mentions its behaviour
on FIFOs, block specials, and character specials.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 856] scp hangs on FIFOs rather than erroring [ In reply to ]
http://bugzilla.mindrot.org/show_bug.cgi?id=856





------- Additional Comments From dtucker@zip.com.au 2004-05-02 15:25 -------
The last bit of the description of O_NONBLOCK (after the description of the
behaviour with FIFOs and block/char specials) is:

"Otherwise, the behavior of O_NONBLOCK is unspecified."

Can we rely on all platforms to do something reasonable with O_NONBLOCK on
normal files? On the other hand, stat'ing it to find out if it's a FIFO or
device first is racy...



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.