Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

shutil.rmtree() gets stuck on opening named pipe #116401

Closed
Assignees
serhiy-storchaka
Labels
3.11only security fixes3.12only security fixes3.13bugs and security fixestype-bugAn unexpected behavior, bug, or error
@Jwata

Description

@Jwata

Bug report

Bug description:

When the target is a named pipe, shutil.rmtree() gets stuck on opening it.

# Create a named pipeimportos,tempfilefilename=os.path.join(tempfile.mkdtemp())filename=os.path.join(tempfile.mkdtemp(),"namedpipe")os.mkfifo(filename)# Try to remove itimportshutilshutil.rmtree(filename)# <- This blocks indefinitely^CTraceback (mostrecentcalllast):File"<stdin>",line1,in<module>File"/usr/lib/python3.11/shutil.py",line725,inrmtreefd=os.open(path,os.O_RDONLY,dir_fd=dir_fd)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^KeyboardInterrupt

This seems to be caused byos.open() withos.O_RDONLY.

fd=os.open(path,os.O_RDONLY,dir_fd=dir_fd)

(This issue seems to exist on the main branch, IIUC)

Currently, it needs to check the file type and useos.remove() if it's a named pipe.
Should this be handled insideshutil.rmtree()?

CPython versions tested on:

3.11

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Labels

3.11only security fixes3.12only security fixes3.13bugs and security fixestype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp