-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shutil.copyfile blocks indefinitely on named pipes #47252
Comments
shutil.copytree() uses shutil.copyfile() to copy files recursively. If the file happens to be a named pipe rather than a normal file, Rather than opening the file for reading, the correct action would |
I am not sure if copyfile() should be trying to copy named pipes (or any |
I can confirm this issue on python 2.5. |
The open('fifo', 'rb') already blocks. One has to use os.fdopen with fd=os.open('fifo', os.O_RDONLY | os.O_NONBLOCK) and then use stat.S_ISFIFO(os.fstat(fd).st_mode) to check if this is a fifo. |
if the destination is a named pipe, it will also block (waiting for a |
Note that the 'cp' user command in Linux blocks also. Although this is |
I'm not sure the race condition possibility is important. Is (I'd argue this bug is less about potential DOS attacks than the simple |
Here is a patch, introducing a new exception named SpecialFileError |
I forgot the case where the /destination/ file is a named pipe. Here is |
Committed in r72178, r72179. Thanks! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: