Closed
Description
Issue Description
When trying to mount a volume which has a name which is a single character on windows, ( e.g. a
, b
, c
etc.) an error is throwed.
Deep dive
On windows, the parsing of the volume argument is a bit tricky.
- It starts here, in our example
volumeFlag = ["a:/mnt/home"]
podman/pkg/specgenutil/volumes.go
Line 46 in 806722b
- For each volume flag, we try to split it in 3 part
[[SOURCE-VOLUME|HOST-DIR:]CONTAINER-DIR[:OPTIONS]]
Line 208 in 693ae0e
- But windows... amazing windows, absolute path have a drive letter (E.g. C:/hello/world) and the following code is responsible of checking if it is an absolute path
Lines 220 to 224 in 693ae0e
- Deep dive into
hasWinDriveScheme
Lines 14 to 21 in a46f798
In our example, path = "a:/mnt/home", start = 0
.
len(path) < start+2 = false
path[start+1] != ':' = false
(problematic, it is confusing the colon separating the driver letter with the separator of the volume and container path
The last part is checking if the letter is a driver letter accepted value.
Steps to reproduce the issue
Run the following on windows
$: podman create volume a
a
$: podman run -v a:/mnt/ hello-world
Error: invalid container path "a:/mnt", must be an absolute path
Describe the results you received
On windows, I am getting the following error
Error: invalid container path "a:/mnt", must be an absolute path
Describe the results you expected
Volume to be mounted.
podman info output
host:
arch: amd64
buildahVersion: 1.38.0
cgroupControllers:
- cpuset
- cpu
- cpuacct
- blkio
- memory
- devices
- freezer
- net_cls
- perf_event
- net_prio
- hugetlb
- pids
- rdma
- misc
cgroupManager: cgroupfs
cgroupVersion: v1
conmon:
package: conmon-2.1.12-2.fc40.x86_64
path: /usr/bin/conmon
version: 'conmon version 2.1.12, commit: '
cpuUtilization:
idlePercent: 99.4
systemPercent: 0.39
userPercent: 0.21
cpus: 12
databaseBackend: sqlite
distribution:
distribution: fedora
variant: container
version: "40"
eventLogger: journald
freeLocks: 2034
hostname: Axel-Fix
idMappings:
gidmap: null
uidmap: null
kernel: 5.15.167.4-microsoft-standard-WSL2
linkmode: dynamic
logDriver: journald
memFree: 23875559424
memTotal: 25204797440
networkBackend: netavark
networkBackendInfo:
backend: netavark
dns:
package: aardvark-dns-1.13.1-1.fc40.x86_64
path: /usr/libexec/podman/aardvark-dns
version: aardvark-dns 1.13.1
package: netavark-1.13.1-1.fc40.x86_64
path: /usr/libexec/podman/netavark
version: netavark 1.13.1
ociRuntime:
name: crun
package: crun-1.19.1-1.fc40.x86_64
path: /usr/bin/crun
version: |-
crun version 1.19.1
commit: 3e32a70c93f5aa5fea69b50256cca7fd4aa23c80
rundir: /run/crun
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
os: linux
pasta:
executable: /usr/bin/pasta
package: passt-0^20241211.g09478d5-1.fc40.x86_64
version: |
pasta 0^20241211.g09478d5-1.fc40.x86_64
Copyright Red Hat
GNU General Public License, version 2 or later
<https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
remoteSocket:
exists: true
path: unix:///run/podman/podman.sock
rootlessNetworkCmd: pasta
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: false
seccompEnabled: true
seccompProfilePath: /usr/share/containers/seccomp.json
selinuxEnabled: false
serviceIsRemote: true
slirp4netns:
executable: ""
package: ""
version: ""
swapFree: 6442450944
swapTotal: 6442450944
uptime: 0h 9m 49.00s
variant: ""
plugins:
authorization: null
log:
- k8s-file
- none
- passthrough
- journald
network:
- bridge
- macvlan
- ipvlan
volume:
- local
registries:
search:
- docker.io
store:
configFile: /usr/share/containers/storage.conf
containerStore:
number: 5
paused: 0
running: 0
stopped: 5
graphDriverName: overlay
graphOptions:
overlay.imagestore: /usr/lib/containers/storage
overlay.mountopt: nodev,metacopy=on
graphRoot: /var/lib/containers/storage
graphRootAllocated: 1081101176832
graphRootUsed: 19998404608
graphStatus:
Backing Filesystem: extfs
Native Overlay Diff: "false"
Supports d_type: "true"
Supports shifting: "false"
Supports volatile: "true"
Using metacopy: "true"
imageCopyTmpDir: /var/tmp
imageStore:
number: 110
runRoot: /run/containers/storage
transientStore: false
volumePath: /var/lib/containers/storage/volumes
version:
APIVersion: 5.3.1
Built: 1732147200
BuiltTime: Thu Nov 21 01:00:00 2024
GitCommit: ""
GoVersion: go1.22.7
Os: linux
OsArch: linux/amd64
Version: 5.3.1
Podman in a container
No
Privileged Or Rootless
None
Upstream Latest Release
Yes
Additional environment details
N/A
Additional information
N/A