You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: hard links whose target is not in the manifest - #335
$ chisel cut --release ./ --arch amd64 --root $rootfs test-package_myslice
Extracting files from package "test-package"...
error: cannot extract from package "test-package": cannot add hard link /hardlink-to-file to report: target /file not previously added
the release validates but does not cut. same with the target covered by a glob with until: mutate.
repro using chisel-proxy, with a prebuilt deb (its directory packing does not keep hard links):
$ alias chisel-proxy='go run github.com/lczyk/chisel-proxy/cmd/chisel-proxy@v0.3.0'
$ chisel-proxy cut --arch amd64 ./test-package_0.0.0_amd64.deb ./test-package.yaml \
-- --root ./rootfs test-package_myslice
Extracting files from package "test-package"...
error: cannot extract from package "test-package": cannot add hard link /hardlink-to-file to report: target /file not previously added
fix
builds on #334: with the extraction on main a hard link can still be made against another package's file, and this fallback would then record that content. merge #334 first.
paths with until: mutate are kept out of the manifest, so the link's target is never there. hard link entries now carry the hash and size of their content (fsutil.Create hashes it from disk), and a link whose target is not in the report is recorded as a regular file with that content. links whose target is reported keep sharing an inode as before.
Adding a hard link to the report required its target to be there
already, so a hard link to a path listed with "until: mutate", directly
or through a glob, failed the cut with "cannot add hard link ... target
not previously added" although the release validates.
Hard link entries now carry the hash and size of their content, and a
link whose target is not reported is recorded as a regular file with
that content.
Fallback converts unreported symlink hard links into empty regular files
internal/manifestutil/report.go:80
This fallback misreports hard links to symlinks when the symlink target is omitted from the report (for example, until: mutate). fsutil.Create intentionally returns regular mode with an empty hash for that case, so clearing Link makes the manifest describe the actual symlink inode as an empty regular file. Preserve the symlink type/target or reject this unsupported case instead of converting every unreported hard link to a regular file.
A hard link to a symlink has no content of its own, so when its target
is not in the report the error stays instead of recording an empty
regular file. A link whose content cannot be read gets no hash either,
which only matters when its target is not reported.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
did some formal verification (fizzbee, my specs are here and here) of the
cutpath and found 7 minor bugs:preferignores x-arch paths #330mutable: true, until: mutate#331until: mutate#333test-packageships/fileand/hardlink-to-file. cut the following slice:the release validates but does not cut. same with the target covered by a glob with
until: mutate.repro using
chisel-proxy, with a prebuilt deb (its directory packing does not keep hard links):fix
builds on #334: with the extraction on main a hard link can still be made against another package's file, and this fallback would then record that content. merge #334 first.
paths with
until: mutateare kept out of the manifest, so the link's target is never there. hard link entries now carry the hash and size of their content (fsutil.Createhashes it from disk), and a link whose target is not in the report is recorded as a regular file with that content. links whose target is reported keep sharing an inode as before.