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

Fix handling of .containenv on tmpfs #18535

Merged
merged 1 commit into from
May 14, 2023

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented May 10, 2023

Fixes: #18531

Does this PR introduce a user-facing change?

/run/.containerenv file is created even when a tmpfs is mounted on /run.

@openshift-ci openshift-ci bot added do-not-merge/release-note-label-needed Enforce release-note requirement, even if just None approved Indicates a PR has been approved by an approver from all required OWNERS files. release-note and removed do-not-merge/release-note-label-needed Enforce release-note requirement, even if just None labels May 10, 2023
Comment on lines 574 to 578
run_podman run --rm $IMAGE --tmpfs=/run stat -c '%s' /run/.containerenv
is "$output" "0" "file size of /run/.containerenv, --tmpfs mount"

run_podman run --rm $IMAGE --tmpfs=/run --init stat -c '%s' /run/.containerenv
is "$output" "0" "file size of /run/.containerenv, --tmpfs=/run --init mount"

run_podman run --rm $IMAGE --read-only stat -c '%s' /run/.containerenv
is "$output" "0" "file size of /run/.containerenv, --read-only"

run_podman run --rm $IMAGE --systemd-always stat -c '%s' /run/.containerenv
is "$output" "0" "file size of /run/.containerenv, --systemd-always"

run_podman 1 run --rm $IMAGE -v ${PODMAN_TMPDIR}:/run:Z stat -c '%s' /run/.containerenv
is "$output" "stat: can't stat '/run/.containerenv': No such file or directory" "do not create .containerenv on bind mounts"

Copy link
Member

Choose a reason for hiding this comment

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

broken, wrong option order. Gimme 5 minutes though for a suggestion.

Copy link
Member

Choose a reason for hiding this comment

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

    # Nonprivileged container: file exists, but must be empty
    for opt in "" "--tmpfs=/run" "--tmpfs=/run --init" "--read-only" "--systemd=always"; do
        run_podman run --rm $opt $IMAGE stat -c '%s' /run/.containerenv
        is "$output" "0" "/run/.containerenv exists and is empty: podman run ${opt}"
    done

    run_podman 1 run --rm -v ${PODMAN_TMPDIR}:/run:Z $IMAGE stat -c '%s' /run/.containerenv
    is "$output" "stat: can't stat '/run/.containerenv': No such file or directory" "do not create .containerenv on bind mounts"

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

@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 10, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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

case m.Destination == "/run/.containerenv":
hasRunContainerenv = true
break
case m.Destination == "/run" && m.Source != "tmpfs":
Copy link
Member

Choose a reason for hiding this comment

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

should this check for type tmpfs? The source could be anything when tmpfs is used.

Copy link
Member Author

Choose a reason for hiding this comment

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

yup

Copy link
Member

Choose a reason for hiding this comment

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

This was not addressed, please fix it!#

@rhatdan rhatdan force-pushed the mount branch 2 times, most recently from 1f784d8 to 457bef5 Compare May 10, 2023 17:39
@edsantiago
Copy link
Member

LGTM. Swagger test has actually completed, long ago, even though (as of this writing) github still has it spinning.

Comment on lines 570 to 573
# Nonprivileged container: file exists, but must be empty
run_podman run --rm $IMAGE stat -c '%s' /run/.containerenv
is "$output" "0" "file size of /run/.containerenv, nonprivileged"


# Nonprivileged container: file exists, but must be empty
Copy link
Member

Choose a reason for hiding this comment

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

nit, same comment twice and unnecessary newlines

@TomSweeneyRedHat
Copy link
Member

Other than the nit, LGTM

@TomSweeneyRedHat
Copy link
Member

Nasty red marks in the tests are still chasing after you @rhatdan

@rhatdan rhatdan added the lgtm Indicates that a PR is ready to be merged. label May 14, 2023
@openshift-merge-robot openshift-merge-robot merged commit 493aac6 into containers:main May 14, 2023
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Aug 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistencies when mounting /run
6 participants