first pass at handling usrmerge
Metadata
Current evaluation
Merged. Fixes rock packing breakage from usrmerge symlinks by redirecting files to their target directories. Updates oci.Image.add_layer() and lifecycle packing, adds a Jammy CI runner. Approved by three reviewers.
Suggested action: —
No scores available.
Issue body
This commit is a first step in gracefully handling existing layers when
packing the parts' contents. Specifically, it fixes the existing
breakage where priming a file in "/lib" will break a resulting
Ubuntu-based rock because on the base "/lib" is a symlink to "/usr/lib",
and if that link is broken everything breaks.
The updates to support this are:
- Enhance oci.Image.add_layer() to take the existing base into account,
via a parameter that points to the extracted base (see below);
- Update lifecycle code to pass the extracted base forward when packing;
- Add a jammy runner to CI, because the new integrated tests need umoci
which is only available on jammy.
The update to add_layer() is to look for a file's parent dir in the
existing base. If it *does* exist, and is a symlink to another dir, add
the file as belonging to the symlink target instead. For example:
- The prime dir contains "bin/file.txt";
- The base is ubuntu:22.04, which means that there "/bin/" is a symlink
to "/usr/bin";
- Instead of adding the file as "bin/file.txt", add it as
"usr/bin/file.txt".
Note that the original idea of just adding "bin/file.txt" but *not* adding
the "bin/" itself seems to be flaky; it works on *some* configurations of
the relevant tools but not others (more investigation necessary).
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged. Fixes rock packing breakage from usrmerge symlinks by redirecting files to their target directories. Updates oci.Image.add_layer() and lifecycle packing, adds a Jammy CI runner. Approved by three reviewers. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a fix for usrmerge handling that prevents /lib symlink breakage during rock packing. Updates oci.Image.add_layer() to redirect files to symlink targets, passes the extracted base forward, and adds a Jammy CI runner. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a fix for usrmerge handling during OCI image packing. Files are redirected to symlink targets like /usr/lib to prevent broken links. Updates oci.Image.add_layer(), passes the extracted base to lifecycle, and adds a Jammy CI runner. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1003 docs: add usrmerge explanation | rockcraft | merged | Merged documentation update explaining the usrmerge problem. Approved by two reviewers, passed CI checks, and added 102 lines across two files to resolve ROCKCRAFT-260. | |
| #204 oci: handle duplicate directories because of usrmerge | rockcraft | merged | Merged. Resolves CRAFT-1634 and issue #203 by handling usrmerge duplicate directories in OCI payloads. The fix verifies matching attributes before merging directories into a single layer entry and raises errors for conflicts. Approved, passed CI, and modified six files. | |
| #200 oci: fix handling of subdirs in usrmerge | rockcraft | merged | Merged fix for OCI payload handling where subdirectories were incorrectly placed in symlinked parent directories instead of their targets. Resolved plugin failures for directories like lib/. Approved by reviewers and passed CI checks. | |
| #1262 feat: allow creating usrmerged dirs by default | craft-parts | merged | Merged squashed PR adding usrmerged_by_default parameter and enable-usrmerge/disable-usrmerge build attributes to LifecycleManager. Enables default usr-merged directory structures with per-part control. Approved by four reviewers, passed all CI checks. |