← Back to issue list

repo: normalize if stage-packages and check types (CRAFT-222)

View original Github issue

Metadata

Project
snapcraft
Number
#3529
Type
pull request
State
merged
Author
sergiusens
Labels
—
Created
Updated
Closed

Current evaluation

Merged in #3529 as commit 58d50bf, fixing stage-packages normalization to check file types so directories such as snap.pc are not passed to fileinput.

Resolution: closed resolved

Reason: PR #3529 was merged as commit 58d50bf. It added file-type checks before normalization, preventing snap.pc directories from being treated as files by fileinput.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Normalization takes place across the entire working tree for a part. As a side effect, files that are not part of stage-packages are also normalized, for that matter, stage-snaps, as those are unpacked first. When considering the pc snap, Snapcraft creates a snap.pc to correctly namespace the snaps snap directory. The .pc artifact fixes does not filter on file type, fileinput is used for the fixup and internally creates a .bak file as a backup which fails as snap.pc is a directory and not a file. Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com> - [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [ ] Have you successfully run `./runtests.sh static`? - [ ] Have you successfully run `./runtests.sh tests/unit`? -----

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged in #3529 as commit 58d50bf, fixing stage-packages normalization to check file types so directories such as snap.pc are not passed to fileinput.
stealth/space-bunny-alpha — closed resolved Merged in commit 58d50bffc: normalization now checks file types, preventing the snap.pc directory from being passed to fileinput and causing backup failure.
stealth/space-bunny-alpha — closed resolved Merged in #3529 (58d50bf): stage-packages normalization now checks file types, preventing the snap.pc directory from being passed to fileinput as a file.
qwen/qwen3.6-35b-a3b — — Merged fix for CRAFT-222 preventing normalization failures on directories like snap.pc. The change restricts normalization to stage-packages and adds type checks to stop fileinput from creating backup files on directories. Approved and verified.
qwen3.6-35b-a3b-mtp-q6 — — Merged fix for CRAFT-222 that prevents normalization from incorrectly processing directories like snap.pc. The change restricts normalization to stage-packages and adds file type checks to avoid backup creation failures on directories. Verified by maintainer.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#76 packages: normalize unpacked stage packages (CRAFT-33) craft-parts merged Merged PR #76 (commit 486bc6b9) added craft_parts/packages/normalize.py, porting Snapcraft package normalization: shebang rewriting, relative symlinks, suid/gid cleanup, and pkg-config/xml2/xslt path fixes.
78%
#3534 repo: normalize only if there are packages to unpack snapcraft merged Merged PR #3534 in commit bd493eb8a, fixing pathlib.glob generator handling so staged package contents are normalized only when packages exist to unpack.
74%
#81 packages: add test to ensure unnecessary normalize not called (CRAFT-221) craft-parts merged Merged in canonical/craft-parts#81 (1c9dd125), adding a regression test verifying normalization is skipped when stage-package unpacking extracts no files.
74%