fix(images): handle tar extraction edge cases#199
fix(images): handle tar extraction edge cases#199DorianZheng merged 1 commit intoboxlite-ai:mainfrom
Conversation
|
Plz review @DorianZheng @shayne-snap |
boxlite/src/images/archive/tar.rs
Outdated
|
|
||
| match parent.symlink_metadata() { | ||
| Ok(m) => { | ||
| if !m.is_dir() { |
There was a problem hiding this comment.
what if parent is a symlink to another exist directory?
boxlite/src/images/archive/tar.rs
Outdated
| // Directory exists, no need to check further up | ||
| break; | ||
| } | ||
| // Remove non-directory (file, symlink, etc.) blocking directory creation |
There was a problem hiding this comment.
what if it's a symlink to another dir within the root path
There was a problem hiding this comment.
https://specs.opencontainers.org/image-spec/layer/#changeset-over-existing-files The documentation is not clear about it. So there is another discussion about this: opencontainers/image-spec#857. However, there doesn't seem to be a final conclusion yet.
symlink to a dir is common in pnpm's structure (https://pnpm.io/symlinked-node-modules-structure). So I think we need to support it.
1036905 to
3aba1a1
Compare
1bd239a to
5d035d8
Compare
Fixes multiple OCI layer tar extraction issues: Path handling: - Use entry.path() instead of entry.header().path() to support PAX extensions - Properly handle filenames >100 bytes (tar header limit) - PAX/GNU longname extensions now correctly applied to restore full paths - Fixes file truncation during extraction (e.g., discord-api-types package) Hardlinks: - Deferred hardlink mechanism for targets appearing later in tar - Fixes pnpm compatibility where hardlinks precede target files Directory handling: - File-to-directory replacements when creating parent dirs - Missing directories removed by whiteout processing Refactoring: - Introduces EntryMetadata with ownership/timestamps composition - Reduces apply_ownership parameters from 9 to 3 - Adds builder pattern to avoid clippy warnings - Improves memory efficiency (DirMeta only stores needed fields) Test coverage: - Comprehensive tests for deferred hardlinks - Parent directory replacement scenarios - pnpm structure validation Signed-off-by: Wenyu Huang <[email protected]>
|
Currently, running |
|
LGTM |
Fixes multiple OCI layer tar extraction issues:
Path handling:
Hardlinks:
Directory handling:
Refactoring:
Test coverage:
fix: #187