Skip to content

Handle ValueError in filecmp.dircmp and filecmp.cmpfiles #122400

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

Closed
picnixz opened this issue Jul 29, 2024 · 0 comments
Closed

Handle ValueError in filecmp.dircmp and filecmp.cmpfiles #122400

picnixz opened this issue Jul 29, 2024 · 0 comments
Assignees
Labels
3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@picnixz
Copy link
Member

picnixz commented Jul 29, 2024

Bug report

Bug description:

In filecmp.cmpfiles, when the path is not stat-able, it will be put in the "fancy" files. This should include paths that would raise ValueError.

Note that filecmp.cmp should not be protected against that since it already ignores an OSError possibly raised by os.stat.

Similarly, filecmp.dircmp should not suppress OSError or ValueError when listing the directory contents. It should however silence ValueError when checking the common files since it already silence an OSError.

TL;DR: Only protect against ValueError if the current code is already protecting against OSError.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

@picnixz picnixz added the type-bug An unexpected behavior, bug, or error label Jul 29, 2024
@picnixz picnixz self-assigned this Jul 29, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 30, 2024
(cherry picked from commit 3a9b2aa)

Co-authored-by: Bénédikt Tran <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 30, 2024
(cherry picked from commit 3a9b2aa)

Co-authored-by: Bénédikt Tran <[email protected]>
@serhiy-storchaka serhiy-storchaka added stdlib Python modules in the Lib dir 3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes labels Jul 30, 2024
serhiy-storchaka pushed a commit that referenced this issue Jul 30, 2024
(cherry picked from commit 3a9b2aa)

Co-authored-by: Bénédikt Tran <[email protected]>
serhiy-storchaka pushed a commit that referenced this issue Jul 30, 2024
(cherry picked from commit 3a9b2aa)

Co-authored-by: Bénédikt Tran <[email protected]>
blhsing pushed a commit to blhsing/cpython that referenced this issue Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants