fix: skip nonexistent paths from minimal base images - #1002
tiffanny29631 wants to merge 1 commit into
Conversation
When building with minimal or slim base images, non-essential files (such as /usr/share/common-licenses) may be absent while still listed in dpkg manifests. In stage_one_file(), missing paths fail the directory check and fall through to `cp -lpP`, causing a fatal "No such file or directory" error. Check that the path exists before attempting to stage it. Signed-off-by: tiffanny29631 <peip@google.com>
|
Welcome @tiffanny29631! |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tiffanny29631 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| for elem in "${elems[@]}"; do | ||
| path="${path}/${elem}" | ||
| if [[ ! -e "${staging}${path}" ]]; then | ||
| if [[ ! -e "${path}" && ! -L "${path}" ]]; then |
There was a problem hiding this comment.
Discussion: stage_one_package() already filters the manifest:
dpkg -L "${pkg}" | grep_allow_nomatch -vE '(/\.|/usr/share/(man|doc|.*-completion))'Could the filter be updated to include the unnecessary files?
Otherwise:
- stage_one_file is also the path for user-requested -f files, so this makes -f /typo/path silently succeed instead of failing the build. Can we keep -f strict in stage_files()?
- Nits: return 0 rather than continue (deeper paths can't exist if the prefix doesn't exist), and a debug logging "skipping nonexistent path ..." so this isn't invisible.
When building with minimal or slim base images, non-essential files (such as /usr/share/common-licenses) may be absent while still listed in dpkg manifests.
In stage_one_file(), missing paths fail the directory check and fall through to
cp -lpP, causing a fatal "No such file or directory" error. Check that the path exists before attempting to stage it.