podman icon indicating copy to clipboard operation
podman copied to clipboard

bug: --volume src:dst:mode parser corrupts destination path when src == dst (6.0.2)

Open liamgelfand opened this issue 4 months ago • 4 comments

Issue Description

On Podman 6.0.2, --volume <src>:<dst>:<mode> corrupts the destination path when src and dst are identical: the mode's second character is appended to dst, and the intended destination ends up empty inside the container.

  • :ro → destination gets a trailing o
  • :rw → destination gets a trailing w

--mount type=bind,src=…,dst=…[,readonly] is not affected and can be used as a workaround. Bug appears specific to the --volume argument parser (likely pkg/specgen/volumes.go or an upstream caller in the CLI layer).

Steps to reproduce the issue

Verified on 3/3 attempts against a scratch directory that lives on the host bind-mount surface (/Users).

SCRATCH=/Users/$(whoami)/podman-repro-scratch
mkdir -p "$SCRATCH" && echo "canary" > "$SCRATCH/marker.txt"

podman run --rm --volume "$SCRATCH:$SCRATCH:ro" alpine:latest sh -c "
  echo '--- $SCRATCH (expected: contains marker.txt) ---'
  ls -la '$SCRATCH' 2>&1
  echo '--- ${SCRATCH}o (expected: does not exist) ---'
  ls -la '${SCRATCH}o' 2>&1
"

Substitute :rw for :ro to observe the same corruption with w in place of o.

Describe the results you received

--- /Users/liam/podman-repro-scratch (expected: contains marker.txt) ---
ls: /Users/liam/podman-repro-scratch: No such file or directory
--- /Users/liam/podman-repro-scratcho (expected: does not exist) ---
total 4
-rw-r--r--    1 root     root             7 Aug  3 19:06 marker.txt

The bind lands at /Users/liam/podman-repro-scratcho (mode's second char appended to dst). Intended destination does not exist inside the container.

Describe the results you expected

The mount should appear at /Users/liam/podman-repro-scratch inside the container, populated with marker.txt. /Users/liam/podman-repro-scratcho should not exist.

--mount syntax works correctly:

podman run --rm \
  --mount "type=bind,src=$SCRATCH,dst=$SCRATCH,readonly" \
  alpine:latest ls -la "$SCRATCH"

podman info output

Client:
  APIVersion: 6.0.2
  BuildOrigin: brew
  Built: 1784664683
  BuiltTime: Tue Jul 21 16:11:23 2026
  GoVersion: go1.26.5
  Os: darwin
  OsArch: darwin/arm64
  Version: 6.0.2
host:
  arch: arm64
  buildahVersion: 1.44.1
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.2.1-2.fc44.aarch64
    version: 'conmon version 2.2.1, commit: '
  cpus: 5
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: podman-machine-os
    version: "44"
  eventLogger: journald
  kernel: 7.1.3-200.fc44.aarch64
  logDriver: journald
  memTotal: 6178119680
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.28-1.fc44.aarch64
    version: |-
      crun version 1.28
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +JSON_C
  os: linux
  security:
    rootless: true
    seccompEnabled: true
    selinuxEnabled: true
  serviceIsRemote: true
  variant: v8
version:
  APIVersion: 6.0.2
  Built: 1784592000
  BuiltTime: Mon Jul 20 20:00:00 2026
  GitCommit: b28edb9ad70ce4317dc762ee9ce0a6d081d154e9
  GoVersion: go1.26.5-X:nodwarf5
  Os: linux
  OsArch: linux/arm64
  Version: 6.0.2

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

  • Host: macOS 26 (Darwin 25.5.0, arm64 / Apple Silicon MacBook Pro)
  • Provider: libkrun (also reproduced on applehv)
  • Installed via Homebrew (brew install podman + brew install --cask krunkit for libkrun)
  • Not fixed in v6.1.0-rc1 (checked release notes and diff of pkg/specgen/volumes.go between v6.0.2 and v6.1.0-rc1; no changes to that file).
  • Searched existing issues; no duplicate found.
  • Reproduces reliably (3/3 attempts). --mount syntax is unaffected.

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

liamgelfand avatar Aug 03 '26 21:08 liamgelfand

Hi, I would like to work on this issue. I’ll investigate the remote volume parsing and try to reproduce the problem. Could this issue be assigned to me?

badal-coder avatar Aug 06 '26 05:08 badal-coder

HI I would like to work on this issue

Srujansa avatar Aug 11 '26 17:08 Srujansa

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Sep 11 '26 01:09 github-actions[bot]

Could not reproduce on the reported versions. Tested on macOS arm64 (applehv, rootless) with the issue's reproducer verbatim:

  • client 6.1.2 + server 6.1.2 → mount correct
  • client 6.0.2 (built from v6.0.2 tag) + server 6.1.2 → correct
  • client 6.1.2 + server 6.0.2 (machine-os:6.0, commit b28edb9) → correct
  • client 6.0.2 + server 6.0.2 → correct

podman inspect shows a clean bind spec (Destination unmodified) in all cases. Could you share podman machine inspect, your containers.conf (any volumes= entries), and podman inspect of a corrupted container?

mdiniz97 avatar Sep 18 '26 10:09 mdiniz97