← Back to issue list

file_utils: don't let FileNotFoundError escape

View original Github issue

Metadata

Project
snapcraft
Number
#2123
Type
pull request
State
merged
Author
kyrofa
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #2123 in commit ae7ac6ae1, converting missing-file errors from file_utils.link_or_copy into SnapcraftError-based exceptions.

Resolution: closed resolved

Reason: The pull request was merged into Snapcraft as commit ae7ac6ae1. It catches leaked FileNotFoundError exceptions and reports them as SnapcraftError-based errors, fixing LP bug #1765282.

Evaluated by: mr-cal-bot

No scores available.

Issue body

- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [x] Have you successfully run `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh unit`? ----- Currently, when `file_utils.link_or_copy` is asked to copy files that don't exist (or symlinks that point to files that don't exist), `FileNotFoundErrors` from the underlying python calls leak through, resulting in a nasty traceback. This PR fixes [LP: #1765282](https://bugs.launchpad.net/snapcraft/+bug/1765282) by catching `FileNotFoundErrors`, and turning them it into `SnapcraftError`-based exceptions.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #2123 in commit ae7ac6ae1, converting missing-file errors from file_utils.link_or_copy into SnapcraftError-based exceptions.
stealth/space-bunny-alpha — closed resolved Merged #2123 as commit ae7ac6ae1, converting FileNotFoundError from file_utils.link_or_copy into SnapcraftError for missing files and broken symlinks.
qwen/qwen3.6-35b-a3b — — Merged fix resolves Launchpad bug #1765282 by catching FileNotFoundError in file_utils.link_or_copy and converting it to a SnapcraftError, preventing unhandled tracebacks when copying missing files or broken symlinks.
qwen3.6-35b-a3b-mtp-q6 — — Merged a fix catching FileNotFoundError in file_utils.link_or_copy and converting it to a SnapcraftError. This prevents unhandled tracebacks when copying missing files or broken symlinks, resolving LP: #1765282.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1658155 file_utils.link_or_copy_tree doesn't maintain symlinks to directories snapcraft (launchpad) closed Fixed directory-symlink handling in file_utils.link_or_copy_tree by merging snapcore/snapcraft PR #1063 in commit 7768cd33b.
72%