-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix windows path handling in podman cp
#25701
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 windows path handling in podman cp
#25701
Conversation
6a95cf4
to
a75e784
Compare
docker cp
podman cp
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
a75e784
to
d4bd413
Compare
I’d accidentally downgraded |
@danegsta thank you! I believe changes to |
@flouthoc new buildah tests seems broken when run with podman build, can you take a look? |
AFAICT this depends on the buildah bump due the bug fix in the copier package so the bump here should be fine. |
Yes, the bug fix in the copier package needs to be picked up via upgraded buildah version before the fixes to the cp command can be made (otherwise with the original version of buildah the command will get stuck in an infinite loop while trying to resolve the files to be copied). Would you prefer an entirely separate PR for the buildah version update or should I restructure this PR into two separate commits? |
@Luap99 The new test which I added at buildah containers/buildah#6087 expects I can add another hack in |
I don't think 128 is a particular great exit code. 125 seems to better for consistency with other errors so I would think this in buildah if that is easy. |
@flouthoc Note there is also a second issue:
|
@Luap99 it sounds like additional changes need to make it into buildah before it can be updated. Seems like it probably makes more sense to have a separate PR for updating buildah. I’ll break this PR up into separate commits for the podman and buildah changes (so that it can be reviewed in the meantime), but once buildah is updated independently I’ll undo my go.mod and vendor changes and rebase off of main. |
d4bd413
to
e22eb88
Compare
Sounds good. |
Created a PR for first one containers/buildah#6092 and for second test |
Looks like #14862 should be fixed by this PR. |
@flouthoc looks like containers/buildah#6092 was merged; I've opened #25756 to bump the vendored buildah version to the latest commit from main. I'll rebase this PR with only the |
c2e009d
to
30459f5
Compare
Rebased on main with just the |
30459f5
to
9db4139
Compare
9216c7f
to
da81e28
Compare
Rebased on latest main |
/retest |
@danegsta: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
@Luap99 did you have any other concerns with the PR? I wanted to make sure this doesn't fall off the radar. There's one failing test, but it seems like it should be a flaky test as I've rebased a couple times and it seems that a different random test fails each time the tests restart (also the current failing test doesn't look like it should be hitting any of the code changed in this PR). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments on the test, sorry I should have looked closer before.
Overall I don't use windows so I am not the best person to review/understand the code but it makes sense to me at least. @l0rd Can you do a review here?
da81e28
to
24d7eaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you
@l0rd PTAL
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danegsta, Luap99 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 |
@danegsta one test is failing on both WSL and Hyper-V:
I don't think this is a bug introduced by this PR though. You can either file a new issue and update this PR to skip that particular test on Windows or try to fix it in this PR. You can reproduce the error running the tests locally on Windows:
|
Yes this is annoying. I have been there too. Don't hesitate to ask us to re-run a specific test when it happens again. |
24d7eaf
to
313f5bb
Compare
This is what I get for updating my test cases for a Windows focused PR on a Mac. The new failing test was a pretty easy fix; Edit: just took a closer look and this seems to be a problem in a few other places in |
Fixes: containers#14862 Signed-off-by: David Negstad <[email protected]>
313f5bb
to
9a723ff
Compare
Tests are green. Great job, @danegsta. About your last change: it's usually preferable to use /lgtm |
/unhold |
This PR fixes a handful of Windows path bugs in
podman container cp
that prevented copying files from (or to) a Windows host.filepath.IsAbs
to determine if a given path is an absolute path on the system (on Windows, this is true for paths starting with a single drive letter and a colon)./
as the root folder path, even on Windows (should be<drive letter>:\
(i.e.C:\
), which causedcopier
to reject the given path. This was fixed by depending on the behavior offilepath.VolumeName
andos.PathSeparator
to build the correct root path for a given OS./
as the path separator rather thanos.PathSeparator
which caused path normalization to fail. Fixed by using the os specific separator.copier
package incontainers/buildah
that would cause an infinite loop when trying to process files from a Windows path. I updated the vendored dependency to the latest version ofbuildah
.cp.go
usedfilepath
for parsing paths within containers, which causes issues on Windows. Switched to usingpath
for processing paths within containers to force Linux style conventions.I also refactored the e2e test coverage that was added for
podman container cp
(moved the existing test frombasic_test.go
tocp_test.go
alongside thepodman machine cp
test coverage) and added a few new test cases.Does this PR introduce a user-facing change?