Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add(): re-escape any globbed items that included escapes #5676

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

nalind
Copy link
Member

@nalind nalind commented Aug 8, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

When collecting items we matched using the passed-in globs during Add(), be sure that globbing performed by Get() will match the items exactly, by escaping special matching characters.

How to verify it

New conformance test!

Which issue(s) this PR fixes:

Fixes #5675.

Special notes for your reviewer:

Does this PR introduce a user-facing change?

COPY and ADD instructions being processed by `buildah build` will now be handled correctly if items matched by source location globs have names which include characters that are treated as special when globbing.

@openshift-ci openshift-ci bot added kind/bug Categorizes issue or PR as related to a bug. approved labels Aug 8, 2024
Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

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

Code LGTM maybe we can extend test to cover ? matching as well.

@nalind
Copy link
Member Author

nalind commented Aug 8, 2024

It looks like attempting to escape \ and * produces different results in classic docker build compared to BuildKit, so for now I'll aim for the way BuildKit does them.

Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

openshift-ci bot commented Aug 8, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc, nalind

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

The pull request process is described here

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

When collecting items we matched using the passed-in globs during Add(),
be sure that globbing performed by Get() will match the items exactly,
by escaping special matching characters.

Signed-off-by: Nalin Dahyabhai <[email protected]>
@rhatdan
Copy link
Member

rhatdan commented Aug 9, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Aug 9, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit f215679 into containers:main Aug 9, 2024
37 checks passed
@nalind nalind deleted the escape-globs branch August 9, 2024 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved kind/bug Categorizes issue or PR as related to a bug. lgtm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot escape square brackets in build of Dockerfile with COPY instruction
3 participants