podman quadlet install -r doesnt crop shorter existing files
kind/bug
### Issue Description
When regenerating quadlets using podman quadlet install -r, if the destination already exists, only the applicable extent is replaced, if the original file is longer, its contents are kept, which can produce corrupt files.
### Steps to reproduce the issue
Steps to reproduce the issue
```
mkdir stuff
cat << EOF > stuff/minimal.container
[Container]
Image=quay.io/demo_quadlets/alpine:latest
Image=TROLLING YOU
EOF
podman quadlet install stuff/
cat << EOF > stuff/minimal.container
[Container]
Image=quay.io/demo_quadlets/alpine:latest
EOF
podman quadlet install -r stuff/
grep TROLL $(podman quadlet list --format '{{.Path}}' | tail -n 1)
```
### Describe the results you received
The installed quadlet shouldn't have the line with TROLL present, but it stayed there.
### Describe the results you expected
The installed file matches the `stuff/minimal.container`
### podman info output
```yaml
host:
arch: amd64
buildahVersion: 1.43.2
cgroupControllers:
- cpu
- io
- memory
- pids
cgroupManager: systemd
cgroupVersion: v2
conmon:
package: conmon-2.2.1-2.fc44.x86_64
path: /usr/bin/conmon
version: 'conmon version 2.2.1, commit: '
cpuUtilization:
idlePercent: 91.36
systemPercent: 1.52
userPercent: 7.12
cpus: 12
databaseBackend: sqlite
distribution:
distribution: fedora
variant: workstation
version: "44"
emulatedArchitectures:
- linux/arm
- linux/arm64
- linux/arm64be
- linux/loong64
- linux/mips
- linux/mips64
- linux/ppc
- linux/ppc64
- linux/ppc64le
- linux/riscv32
- linux/riscv64
- linux/s390x
eventLogger: journald
freeLocks: 2047
hostname: matyc-thinkpadt14gen4.tpbc.csb
idMappings:
gidmap:
- container_id: 0
host_id: 102264
size: 1
- container_id: 1
host_id: 165536
size: 165536
uidmap:
- container_id: 0
host_id: 102264
size: 1
- container_id: 1
host_id: 165536
size: 165536
kernel: 7.0.12-200.fc44.x86_64
linkmode: dynamic
logDriver: journald
memFree: 596623360
memTotal: 33270636544
networkBackend: netavark
networkBackendInfo:
backend: netavark
defaultNetwork: podman
dns:
package: aardvark-dns-1.17.1-1.fc44.x86_64
path: /usr/libexec/podman/aardvark-dns
version: aardvark-dns 1.17.1
package: netavark-1.17.2-1.fc44.x86_64
path: /usr/libexec/podman/netavark
version: netavark 1.17.2
ociRuntime:
name: crun
package: crun-1.28-1.fc44.x86_64
path: /usr/bin/crun
version: |-
crun version 1.28
commit: 54f16ffbefcd022bf032af768b5c5ce075c18bfc
rundir: /run/user/102264/crun
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +JSON_C
os: linux
pasta:
executable: /usr/bin/pasta
package: passt-0^20260526.g038c51e-1.fc44.x86_64
version: |
pasta 0^20260526.g038c51e-1.fc44.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: /run/user/102264/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: true
seccompEnabled: true
seccompProfilePath: /usr/share/containers/seccomp.json
selinuxEnabled: true
serviceIsRemote: false
slirp4netns:
executable: ""
package: ""
version: ""
swapFree: 3456417792
swapTotal: 8589930496
uptime: 173h 47m 58.00s (Approximately 7.21 days)
variant: ""
plugins:
authorization: null
log:
- k8s-file
- none
- passthrough
- journald
network:
- bridge
- macvlan
- ipvlan
volume:
- local
registries:
search:
- registry.fedoraproject.org
- registry.access.redhat.com
- docker.io
store:
configFile: /home/matyc/.config/containers/storage.conf
containerStore:
number: 1
paused: 0
running: 1
stopped: 0
graphDriverName: overlay
graphOptions: {}
graphRoot: /home/matyc/.local/share/containers/storage
graphRootAllocated: 510389125120
graphRootUsed: 55338700800
graphStatus:
Backing Filesystem: btrfs
Native Overlay Diff: "true"
Supports d_type: "true"
Supports shifting: "false"
Supports volatile: "true"
Using metacopy: "false"
imageCopyTmpDir: /var/tmp
imageStore:
number: 6
runRoot: /run/user/102264/containers
transientStore: false
volumePath: /home/matyc/.local/share/containers/storage/volumes
version:
APIVersion: 5.8.3
BuildOrigin: Fedora Project
Built: 1781222400
BuiltTime: Fri Jun 12 02:00:00 2026
GitCommit: 93dbfd0d86ee57f8f91801f61ce57dd880a4725f
GoVersion: go1.26.4-X:nodwarf5
Os: linux
OsArch: linux/amd64
Version: 5.8.3
```
### Podman in a container
No
### Privileged Or Rootless
Rootless
### Upstream Latest Release
Yes
### Additional environment details
Additional environment details
### Additional information
Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting
关闭于 2026-06-23 2 条评论