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

support rootfs contains colon #11912

Merged

Conversation

chenk008
Copy link
Contributor

@chenk008 chenk008 commented Oct 11, 2021

What this PR does / why we need it:

For now, we can create a container with a readonly rootfs.
podman run --rootfs /some/readonly/path:O echo hello

The rootfs may contains colon podman run --rootfs /some/a:b/readonly/path:O echo hello
, it will failed to parse this directory, the error message is

Error: error running container create option: stat /some/a:b/readonly/path:O: no such file or directory

How to verify it

Run container with a readonly rootfs, and the rootfs path contains colon.

Which issue(s) this PR fixes:

Fixes #11913

Special notes for your reviewer:

@chenk008 chenk008 force-pushed the fix_roofs_path_contains_colon branch from 8dd7706 to e482216 Compare October 11, 2021 01:41
@chenk008
Copy link
Contributor Author

containers/buildah#3581 is required to support rootfs contains colon.

@flouthoc
Copy link
Collaborator

One doubt from original issue #11913 (comment)

parts := strings.SplitN(csc.Rootfs, ":", 2)
if len(parts) > 1 && parts[1] == "O" {
parts := strings.Split(csc.Rootfs, ":")
if len(parts) > 1 && parts[len(parts)-1] == "O" {
Copy link
Member

Choose a reason for hiding this comment

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

can we use strings.LastIndex(parts, ":") instead of strings.Split?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your suggestion. I use strings.LastIndex(parts, ":") instead of strings.Split. PTAL.

Fix: containers#11913

Signed-off-by: chenkang <kongchen28@gmail.com>
@chenk008 chenk008 force-pushed the fix_roofs_path_contains_colon branch from e482216 to dd5975f Compare October 11, 2021 09:26
Signed-off-by: chenkang <kongchen28@gmail.com>
@zhangguanzhang
Copy link
Collaborator

need rebase to one commit

@rhatdan
Copy link
Member

rhatdan commented Oct 11, 2021

LGTM
@giuseppe @flouthoc PTAL

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 openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 11, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 11, 2021

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Oct 11, 2021
@openshift-merge-robot openshift-merge-robot merged commit 00ebf3c into containers:main Oct 11, 2021
@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 Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed to start a readonly rootfs which contains colon
6 participants