Skip to content

composefs: Open deployments dir from physical root, not ambient path#2115

Open
cgwalters wants to merge 1 commit intobootc-dev:mainfrom
cgwalters:composefs-fix-ambient-path
Open

composefs: Open deployments dir from physical root, not ambient path#2115
cgwalters wants to merge 1 commit intobootc-dev:mainfrom
cgwalters:composefs-fix-ambient-path

Conversation

@cgwalters
Copy link
Copy Markdown
Collaborator

find_vmlinuz_initrd_duplicates() previously opened the absolute path /sysroot/state/deploy via STATE_DIR_ABS, which breaks in the case when we're doing an install outside of a container.

We hit this in #1911

Fix by passing a Dir opened relative to the target's physical_root. During fresh install the state dir naturally does not exist yet, so open_dir_optional returns None and the check is skipped -- no special-case guard needed.

Also plumb physical_root through the setup_composefs_bls_boot match arms, and replace the hardcoded "/sysroot" in the Upgrade arm with storage.physical_root_path.

Assisted-by: OpenCode (Claude Opus 4)

find_vmlinuz_initrd_duplicates() previously opened the absolute path
/sysroot/state/deploy via STATE_DIR_ABS, which breaks in the
case when we're doing an install outside of a container.

We hit this in bootc-dev#1911

Fix by passing a Dir opened relative to the target's physical_root.
During fresh install the state dir naturally does not exist yet, so
open_dir_optional returns None and the check is skipped -- no
special-case guard needed.

Also plumb physical_root through the setup_composefs_bls_boot match
arms, and replace the hardcoded "/sysroot" in the Upgrade arm with
storage.physical_root_path.

Assisted-by: OpenCode (Claude Opus 4)
Signed-off-by: Colin Walters <walters@verbum.org>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the boot setup logic to use relative paths instead of absolute ambient paths when searching for duplicate boot entries. Key changes include updating find_vmlinuz_initrd_duplicates to accept a directory handle and modifying setup_composefs_bls_boot to resolve the physical root and open the deployment directory relative to it, ensuring correct behavior during installation. I have no feedback to provide.

@Johan-Liebert1
Copy link
Copy Markdown
Collaborator

I think this is going to conflict with #2108

I believe this should be solved by cfe6941 which is included in #2108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants