Skip to content

Make litebox_packager OCI mode work cross-platform#815

Open
wdcui wants to merge 4 commits intomainfrom
wdcui/pr5-packager-crossplatform
Open

Make litebox_packager OCI mode work cross-platform#815
wdcui wants to merge 4 commits intomainfrom
wdcui/pr5-packager-crossplatform

Conversation

@wdcui
Copy link
Copy Markdown
Member

@wdcui wdcui commented Apr 25, 2026

This PR makes the litebox packager's OCI mode work on Windows (and other non-Linux platforms) by removing Linux-specific assumptions from the OCI code path. Host mode (ldd-based dependency discovery) remains Linux-only.

wdcui added 4 commits April 25, 2026 15:30
- Remove crate-level #![cfg(target_os = "linux")] gate; gate only host-mode
  (ldd-based dependency discovery) behind #[cfg(target_os = "linux")]
- Split run() into OCI dispatch + run_host_mode() (Linux-only)
- Move --include handling into host-mode only (conflicts_with oci_image)
- ELF files from --include are automatically rewritten through the rewriter
- Track symlinks in-memory during OCI layer extraction instead of creating OS
  symlinks (Windows requires admin privileges for symlinks)
- Record Unix permission modes from tar headers in HashMap instead of querying
  filesystem metadata (Windows lacks Unix permission bits)
- Add OCI platform resolver to always pull linux/amd64 images regardless of host
- Add path normalization (strip ./, resolve ..) for tar entry paths
- Replace backslashes with forward slashes in tar paths for Windows compatibility
- Switch tar format from GNU to USTAR (required by no_std tar reader)
- Add whiteout pruning for in-memory symlink and permission maps
- Delete build.rs (removes rtld_audit.so injection from packager)
- Remove finalize_tar's rtld_audit injection and --include handling (moved to host-mode)
- Add resolve_symlink_in_rootfs for cross-platform symlink chain resolution
- Add materialize_symlinks to copy files/create dirs instead of OS symlinks
- Handle Bun executables as hard errors (UnsupportedExecutable)
- Update scan_rootfs to accept symlink_map and permissions parameters
- Normalize relative symlink targets in resolve_in_rootfs to prevent
  ../ components from escaping the rootfs boundary
- Gate set_preserve_permissions/set_unpack_xattrs behind #[cfg(unix)]
  since they are unsupported on Windows and permissions are already
  tracked in the HashMap from tar headers
@github-actions
Copy link
Copy Markdown

🤖 SemverChecks 🤖 ⚠️ Potential breaking API changes detected ⚠️

Click for details
--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field ExtractedImage.symlink_map in /home/runner/work/litebox/litebox/litebox_packager/src/oci.rs:42
  field ExtractedImage.permissions in /home/runner/work/litebox/litebox/litebox_packager/src/oci.rs:46

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/function_parameter_count_changed.ron

Failed in:
  litebox_packager::oci::scan_rootfs now takes 4 parameters instead of 2, in /home/runner/work/litebox/litebox/litebox_packager/src/oci.rs:770

@wdcui wdcui marked this pull request as ready for review April 26, 2026 00:38
@wdcui wdcui requested a review from sangho2 April 26, 2026 00:39
@wdcui
Copy link
Copy Markdown
Member Author

wdcui commented Apr 26, 2026

This PR is ready for review. Thanks!

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.

1 participant