[New-bugs-announce] [issue3002] shutil.copyfile blocks indefinitely on named pipes

albert hofkamp report at bugs.python.org
Thu May 29 17:32:30 CEST 2008

New submission from albert hofkamp <a.t.hofkamp at tue.nl>:

shutil.copytree() uses shutil.copyfile() to copy files recursively.
shutil.copyfile() opens the source file for reading, and the destination
file for writing, followed by a call to shutil.copyfileobj().

If the file happens to be a named pipe rather than a normal file,
opening for read blocks the copying function, since the Unix OS needs a
writer process to attach to the same named pipe before the open-for-read

Rather than opening the file for reading, the correct action would
probably be to simply create a new named pipe with the same name at the
Looking at the Python2.3 code, the same type of problem seem to exist
for other non-normal file-types other than symlinks (eg device files,
sockets, and possibly a few others).

components: Library (Lib)
messages: 67498
nosy: aioryi
severity: normal
status: open
title: shutil.copyfile blocks indefinitely on named pipes
type: behavior
versions: Python 2.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list