GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-154726: Fix `shutil.copyfile()` for symlinks to special files with `follow_symlinks=False` by lkk7 · Pull Request #154728 · python/cpython

Conversation

@lkk7

@lkk7 lkk7 commented Jul 26, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

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.
  • Issue: shutil.copyfile() rejects device symlinks with follow_symlinks=False #154726

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@lkk7
pythongh-154726: Fix shutil.copyfile() for device symlinks with `fo…
1451551
…llow_symlinks=False`
@lkk7
lkk7 requested a review from giampaolo as a code owner July 26, 2026 09:54
@bedevere-app bedevere-app Bot mentioned this pull request Jul 26, 2026
shutil.copyfile() rejects device symlinks with follow_symlinks=False #154726
Closed
@bedevere-app bedevere-app Bot added the awaiting review label Jul 26, 2026
@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lkk7
pythongh-154726: Test FIFO and socket symlinks in shutil.copyfile()
88fa4c7
@lkk7 lkk7 changed the title gh-154726: Fix shutil.copyfile() for device symlinks with follow_symlinks=False gh-154726: Fix shutil.copyfile() for symlinks to special files with follow_symlinks=False Jul 27, 2026
@lkk7

lkk7 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Hi @aisk, done.

I just noticed that one test is not grouped with the others, but maybe it's too cosmetic to run the whole CI again for that. If any other change is needed, then I'll push that too.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aisk
aisk reviewed Jul 27, 2026
View reviewed changes
Comment thread Lib/test/test_shutil.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

lkk7 added 2 commits July 27, 2026 16:46
@lkk7
pythongh-154726: Match socket bind error handling in shutil tests
2fb2134
@lkk7
pythongh-154726: Group shutil special-file symlink tests
bf7e3d2
aisk
aisk approved these changes Jul 27, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Jul 27, 2026
@encukou encukou added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 30, 2026
@bedevere-bot

bedevere-bot commented Jul 30, 2026

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @encukou for commit bf7e3d2 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F154728%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 30, 2026
@encukou
encukou merged commit f5afa89 into python:main Jul 31, 2026
129 of 141 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@encukou encukou added the needs backport to 3.15 bugs and security fixes label Jul 31, 2026
@miss-islington-app

miss-islington-app Bot commented Jul 31, 2026

Copy link
Copy Markdown

Thanks @lkk7 for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting core review label Jul 31, 2026
@miss-islington-app

miss-islington-app Bot commented Jul 31, 2026

Copy link
Copy Markdown

Thanks @lkk7 for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app

miss-islington-app Bot commented Jul 31, 2026

Copy link
Copy Markdown

Sorry, @lkk7 and @encukou, I could not cleanly backport this to 3.15 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker f5afa895ae322ea89c5942b0b21094c124293dd8 3.15
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app miss-islington-app Bot assigned encukou Jul 31, 2026
@miss-islington-app

miss-islington-app Bot commented Jul 31, 2026

Copy link
Copy Markdown

Sorry, @lkk7 and @encukou, I could not cleanly backport this to 3.15 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker f5afa895ae322ea89c5942b0b21094c124293dd8 3.15
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou

encukou commented Jul 31, 2026

Copy link
Copy Markdown
Member

Oh, #142693 is only in 3.16.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou encukou removed the needs backport to 3.15 bugs and security fixes label Jul 31, 2026
mbeijen pushed a commit to mbeijen/cpython that referenced this pull request Aug 14, 2026
@lkk7 @mbeijen
pythongh-154726: Fix shutil.copyfile() for symlinks to special file…
b2d4309
…s with `follow_symlinks=False` (pythonGH-154728)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@aisk aisk aisk approved these changes
@giampaolo giampaolo Awaiting requested review from giampaolo giampaolo is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@encukou encukou

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@lkk7 @aisk @bedevere-bot @encukou
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.