Skip to content

fix: skip nonexistent paths from minimal base images - #1002

Open
tiffanny29631 wants to merge 1 commit into
kubernetes:masterfrom
tiffanny29631:fixlink
Open

tiffanny29631 wants to merge 1 commit into
kubernetes:masterfrom
tiffanny29631:fixlink

Conversation

@tiffanny29631

Copy link
Copy Markdown

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.

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>
@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 17, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Welcome @tiffanny29631!

It looks like this is your first PR to kubernetes/git-sync 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/git-sync has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@kubernetes-prow
kubernetes-prow Bot requested review from sdowell and stp-ip September 17, 2026 23:55
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tiffanny29631
Once this PR has been reviewed and has the lgtm label, please assign janetkuo for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 17, 2026
@tiffanny29631 tiffanny29631 changed the title stage_binaries.sh: skip nonexistent paths from minimal base images fix: skip nonexistent paths from minimal base images Sep 19, 2026
Comment thread stage_binaries.sh
for elem in "${elems[@]}"; do
path="${path}/${elem}"
if [[ ! -e "${staging}${path}" ]]; then
if [[ ! -e "${path}" && ! -L "${path}" ]]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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()?
  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants