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

"podman cp" copies directories with a name ending with a "." differently #16421

Closed
eriksjolund opened this issue Nov 6, 2022 · 3 comments · Fixed by #16498
Closed

"podman cp" copies directories with a name ending with a "." differently #16421

eriksjolund opened this issue Nov 6, 2022 · 3 comments · Fixed by #16498
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@eriksjolund
Copy link
Contributor

eriksjolund commented Nov 6, 2022

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

Steps to reproduce the issue:

On a Fedora 36 computer

  1. Create a new directory and cd into it
    $ mkdir src
    $ cd src
    
  2. In this directory create a file named Dockerfile with the file contents:
    FROM docker.io/library/alpine
    RUN mkdir -p /test/test1.
    RUN mkdir -p /test/test2
    RUN touch /test/test1./file1
    RUN touch /test/test2/file2
    
  3. Create a file named /tmp/cp_test.sh with the file contents:
    #!/bin/bash
    
    engine=$1
    path=$2
    
    img=$($engine build -q --no-cache .)
    ctr=$($engine run --rm -d $img sleep inf)
    tmpdir=$(mktemp -d)
    cd $tmpdir
    $engine cp $ctr:$path dest
    find .
    $engine container rm -f $ctr > /dev/null
    
  4. Run these commands
    $ bash /tmp/cp_test.sh podman /test/test1.
    .
    ./dest
    ./dest/test2
    ./dest/test2/file2
    ./dest/test1.
    ./dest/test1./file1
    WARN[0010] StopSignal SIGTERM failed to stop container eager_shockley in 10 seconds, resorting to SIGKILL 
    $ bash /tmp/cp_test.sh podman /test/test2
    .
    ./dest
    ./dest/file2
    WARN[0010] StopSignal SIGTERM failed to stop container quizzical_herschel in 10 seconds, resorting to SIGKILL
    $
    

On a macOS laptop having docker installed

  1. Same as above
  2. Same as above
  3. Same as above
  4. Run these commands
    $ bash /tmp/cp_test.sh docker /test/test1.
    .
    ./dest
    ./dest/file1
    $ bash /tmp/cp_test.sh docker /test/test2 
    .
    ./dest
    ./dest/file2
    $
    

Describe the results you received:

The commands

bash /tmp/cp_test.sh podman /test/test1.

and

bash /tmp/cp_test.sh docker /test/test1.

produce different output. I'm only referring to the paths being printed on the terminal as I guess this warning

    WARN[0010] StopSignal SIGTERM failed to stop container eager_shockley in 10 seconds, resorting to SIGKILL 

can be ignored.

Describe the results you expected:

The commands should produce identical output.

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

Client:       Podman Engine
Version:      4.2.1
API Version:  4.2.1
Go Version:   go1.18.5
Built:        Wed Sep  7 21:58:19 2022
OS/Arch:      linux/amd64

Output of podman info:

host:
  arch: amd64
  buildahVersion: 1.27.0
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.4-3.fc36.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.4, commit: '
  cpuUtilization:
    idlePercent: 99.95
    systemPercent: 0.03
    userPercent: 0.02
  cpus: 16
  distribution:
    distribution: fedora
    variant: workstation
    version: "36"
  eventLogger: journald
  hostname: asus
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 6.0.5-200.fc36.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 366977024
  memTotal: 7691595776
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.6-2.fc36.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.6
      commit: 18cf2efbb8feb2b2f20e316520e0fd0b6c41ef4d
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.0-0.2.beta.0.fc36.x86_64
    version: |-
      slirp4netns version 1.2.0-beta.0
      commit: 477db14a24ff1a3de3a705e51ca2c4c1fe3dda64
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 5284818944
  swapTotal: 7691300864
  uptime: 49h 40m 12.00s (Approximately 2.04 days)
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /home/esjolund/.config/containers/storage.conf
  containerStore:
    number: 30
    paused: 0
    running: 0
    stopped: 30
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/esjolund/.local/share/containers/storage
  graphRootAllocated: 407822663680
  graphRootUsed: 355461595136
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 147
  runRoot: /run/user/1000/containers
  volumePath: /home/esjolund/.local/share/containers/storage/volumes
version:
  APIVersion: 4.2.1
  Built: 1662580699
  BuiltTime: Wed Sep  7 21:58:19 2022
  GitCommit: ""
  GoVersion: go1.18.5
  Os: linux
  OsArch: linux/amd64
  Version: 4.2.1

Package info (e.g. output of rpm -q podman or apt list podman or brew info podman):

podman-4.2.1-2.fc36.x86_64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

Yes

Additional environment details (AWS, VirtualBox, physical, etc.):
The test with Podman was done on a x86_64 computer (Fedora 36).

The test with Docker was done on a macOS laptop with macOS Monterey 12.6.1
and the docker version:

$ docker --version
Docker version 20.10.17, build 100c701
@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Nov 6, 2022
@mheon
Copy link
Member

mheon commented Nov 7, 2022

@vrothberg PTAL

@vrothberg
Copy link
Member

I am flooded at the moment. If others have cycles, please take a look.

@vrothberg
Copy link
Member

Found some time and the bug. Will wrap up fixes. Thanks for the great reproducer, @eriksjolund !

@vrothberg vrothberg self-assigned this Nov 10, 2022
vrothberg added a commit to vrothberg/libpod that referenced this issue Nov 14, 2022
Fix a bug for special-casing "." where Podman has mistakenly been
looking for a "." suffix instead of interpreting it as a path.

Add regression tests for the host-to-container, container-to-host and
container-to-container use cases.  Have separate tests for each to
verify that previous Podman versions fail each case.

Fixes: containers#16421
Signed-off-by: Valentin Rothberg <[email protected]>
@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 10, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. 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 a pull request may close this issue.

3 participants