-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
podman cp can overwrite existing files/directories #14420
Comments
It screams for regression tests. |
An option is fine for me but the default should be to not overwrite. |
SGTM |
@nalind, buildah's copy options |
It needs to be a separate option. This logic backends our handling of COPY and ADD instructions in Dockerfiles, and we definitely don't want to change how they behave. |
Correcting myself: we don't set the flag for ADD/COPY, so overloading it wouldn't break them. It's still my preference. |
Similar to the `NoOverwriteDirNonDir` one, add an option that disables non-directories from being overwritten by directories. Required-for: containers/podman/issues/14420 Signed-off-by: Valentin Rothberg <[email protected]>
Similar to the `NoOverwriteDirNonDir` one, add an option that disables non-directories from being overwritten by directories. Required-for: containers/podman/issues/14420 Signed-off-by: Valentin Rothberg <[email protected]>
Similar to the `NoOverwriteDirNonDir` one, add an option that disables non-directories from being overwritten by directories. Required-for: containers/podman/issues/14420 Signed-off-by: Valentin Rothberg <[email protected]>
Similar to the `NoOverwriteDirNonDir` one, add an option that disables non-directories from being overwritten by directories. Required-for: containers/podman/issues/14420 Signed-off-by: Valentin Rothberg <[email protected]>
-> #14526 |
Add a new `--overwrite` flag to `podman cp` to allow for overwriting in case existing users depend on the behavior; they will have a workaround. By default, the flag is turned off to be compatible with Docker and to have a more sane behavior. Fixes: containers#14420 Signed-off-by: Valentin Rothberg <[email protected]>
Similar to the `NoOverwriteDirNonDir` one, add an option that disables non-directories from being overwritten by directories. Required-for: containers/podman/issues/14420 Signed-off-by: Valentin Rothberg <[email protected]>
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
using podman cp incorrect can lead to very easy data loss.
Currently it is possible to overwrite an existing file/directory on the host without any warnings.
I noticed this while looking at #14393.
So my question is why is this an option, and why it is not the default? I cannot imagine that somebody actually would want this and if they do it is simple to just remove the file/directory beforehand.
Steps to reproduce the issue:
Describe the results you received:
The original file/directory is gone.
Describe the results you expected:
An error like the one from
cp
:cp: cannot overwrite non-directory './test1' with directory 'test/test1'
Additional information you deem important (e.g. issue happens only occasionally):
Looks like we regressed on this one, I already reported this a long time ago: #7790
Also I verified that
docker cp
works as I would expect and errors correctly in both cases.The text was updated successfully, but these errors were encountered: