Skip to content

Make rootfs absolute symlinks portable when exporting tar archives - #1

Merged
vcvkk merged 1 commit into
mainfrom
codex/find-out-model-details
Sep 5, 2026
Merged

vcvkk merged 1 commit into
mainfrom
codex/find-out-model-details

Conversation

@vcvkk

@vcvkk vcvkk commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Prevent absolute symlinks in a rootfs from baking host paths into an exported archive and from being rejected by Python's safe extraction filter.
  • Keep exported archives portable and restorable such that rootfs-local links still resolve correctly after extraction.

Description

  • Added a _portable_link filter that converts rootfs-local absolute symlink targets into relative targets using posixpath.relpath when creating tar members.
  • Use the filter by passing filter=_portable_link to tarfile.add so symlinks are stored as relative links while ordinary files and links are unchanged.
  • Imported posixpath and updated the archive docstring and a unit test expectation to reflect the new behavior.

Testing

  • Ran the rootfs export tests in tests/test_rootfs.py including test_the_archive_holds_the_container, test_a_symlink_is_stored_as_itself, test_the_archive_can_be_unpacked_back, and test_progress_is_reported_and_ends_at_one.
  • All tested cases passed (the symlink test now expects the stored linkname to be "busybox").

Codex Task

@vcvkk
vcvkk merged commit 0eafced into main Sep 5, 2026
3 checks passed
@vcvkk
vcvkk deleted the codex/find-out-model-details branch September 5, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant