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

bin/docker: fix broken escaping and variable substitution #24793

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

lazka
Copy link
Contributor

@lazka lazka commented Dec 7, 2024

In #24034 more variables were added to the envsubst input, but there is no escaping with envsubst, so the resulting bash script never used XDG_CONFIG_HOME. Also it replaced HOME with the build time HOME env var breaking the runtime subsitution, resulting in something bogus like:

[ -e "\${XDG_CONFIG_HOME-\/home/build/.config}/containers/nodocker" ]

Fix by telling envsubst to just replace BINDIR and ETCDIR (double $$ for make escaping) and remove the broken escaping in the envsubst input.

Does this PR introduce a user-facing change?

The `bin/docker` check for `$XDG_CONFIG_HOME/containers/nodocker` was fixed.

@lazka lazka marked this pull request as draft December 7, 2024 14:08
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 7, 2024
In containers#24034 more variables were added to the envsubst input, but there is no
escaping with envsubst, so the resulting bash script never used
XDG_CONFIG_HOME. Also it replaced HOME with the build time HOME env
var breaking the runtime subsitution, resulting in something bogus like:

[ -e "\${XDG_CONFIG_HOME-\/home/build/.config}/containers/nodocker" ]

Fix by telling envsubst to just replace BINDIR and ETCDIR and remove
the broken escaping in the envsubst input.

Signed-off-by: Christoph Reiter <[email protected]>
@lazka lazka force-pushed the fix-docker-envsubst branch from 9e52dc0 to 9c14d15 Compare December 7, 2024 14:22
@lazka lazka marked this pull request as ready for review December 7, 2024 14:22
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 7, 2024
@lazka
Copy link
Contributor Author

lazka commented Dec 7, 2024

(I assume there is no way to test this in the test suite? regarding the CI/label etc.)

@giuseppe giuseppe added the No New Tests Allow PR to proceed without adding regression tests label Dec 9, 2024
Copy link
Member

@giuseppe giuseppe 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 Dec 9, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, lazka

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 9, 2024
@rhatdan
Copy link
Member

rhatdan commented Dec 9, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 9, 2024
@rhatdan
Copy link
Member

rhatdan commented Dec 9, 2024

Thanks @lazka

@openshift-merge-bot openshift-merge-bot bot merged commit 07dddeb into containers:main Dec 9, 2024
88 checks passed
@lazka
Copy link
Contributor Author

lazka commented Dec 9, 2024

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. No New Tests Allow PR to proceed without adding regression tests release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants