Skip to content

gh-154726: Fix shutil.copyfile() for device symlinks with follow_symlinks=False#154728

Open
lkk7 wants to merge 1 commit into
python:mainfrom
lkk7:fix-copyfile-device-symlink
Open

gh-154726: Fix shutil.copyfile() for device symlinks with follow_symlinks=False#154728
lkk7 wants to merge 1 commit into
python:mainfrom
lkk7:fix-copyfile-device-symlink

Conversation

@lkk7

@lkk7 lkk7 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Fixes #154726.

  • Avoid checking a source symlink's target when follow_symlinks=False
  • Add a regression test using a symlink to /dev/null.

@aisk

aisk commented Jul 26, 2026

Copy link
Copy Markdown
Member

fifo / socket have the same problem, and I think they are already fixed by this PR. We should update the PR's title to mention this, like using 'special file' in the news entry.

And maybe we can update the tests to test socket and fifo to ensure this and prevent future regressions. But it's up to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shutil.copyfile() rejects device symlinks with follow_symlinks=False

2 participants