[Bug 16330] New: rm -rfv reports successfully removing parents of entries that were not removed
bugzilla at busybox.net
bugzilla at busybox.net
Mon Apr 7 17:33:44 UTC 2025
https://bugs.busybox.net/show_bug.cgi?id=16330
Bug ID: 16330
Summary: rm -rfv reports successfully removing parents of
entries that were not removed
Product: Busybox
Version: 1.37.x
Hardware: All
OS: Linux
Status: NEW
Severity: trivial
Priority: P5
Component: Standard Compliance
Assignee: unassigned at busybox.net
Reporter: anson.mansfield at gmail.com
CC: busybox-cvs at busybox.net
Target Milestone: ---
### Overview:
When running `rm -rfv /dir` on a directory containing mounted filesystems as
subdirectories, the stderr output includes a message that `/dir` was removed,
even though `/dir` was not removed.
### Steps to Reproduce:
```
user at host:~$ podman run -it --mount=type=tmpfs,dst=/dir/fs alpine
/ # rm -rfv /dir
rm: can't remove '/dir/fs': Resource busy
removed directory: '/dir'
/ # ls /dir
fs
/ #
```
### Actual Results:
The message `removed directory: '/dir'` emitted to stdout.
### Expected Results:
No messages emitted to stdout; and either an additional message `rm: can't
remove '/dir/fs': Resource busy` (or some other more useful diagnostic) emitted
to stderr.
Alternately, no additional message to stderr, e.g. as GNU coreutils 9.1 does in
this situation.
### Build Date & Hardware:
```
user at host:~$ podman run -it alpine rm --version
rm: unrecognized option: version
BusyBox v1.37.0 (2025-01-17 18:12:01 UTC) multi-call binary.
Usage: rm [-irf] FILE...
Remove (unlink) FILEs
-i Always prompt before removing
-f Never prompt
-R,-r Recurse
user at host:~$ podman image inspect alpine
[
{
"Id":
"aded1e1a5b3705116fa0a92ba074a5e0b0031647d9c315983ccba2ee5428ec8b",
"Digest":
"sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c",
"RepoTags": [
"docker.io/library/alpine:latest"
],
"RepoDigests": [
"docker.io/library/alpine at sha256:1c4eef651f65e2f7daee7ee785882ac164b02b78fb74503052a26dc061c90474",
"docker.io/library/alpine at sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c"
],
"Parent": "",
"Comment": "buildkit.dockerfile.v0",
"Created": "2025-02-14T03:28:36Z",
"Config": {
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/sh"
],
"WorkingDir": "/"
},
"Version": "",
"Author": "",
"Architecture": "amd64",
"Os": "linux",
"Size": 8132675,
"VirtualSize": 8132675,
"GraphDriver": {
"Name": "overlay",
"Data": {
"UpperDir":
"/home/anson/.local/share/containers/storage/overlay/08000c18d16dadf9553d747a58cf44023423a9ab010aab96cf263d2216b8b350/diff",
"WorkDir":
"/home/anson/.local/share/containers/storage/overlay/08000c18d16dadf9553d747a58cf44023423a9ab010aab96cf263d2216b8b350/work"
}
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:08000c18d16dadf9553d747a58cf44023423a9ab010aab96cf263d2216b8b350"
]
},
"Labels": null,
"Annotations": {
"com.docker.official-images.bashbrew.arch": "amd64",
"org.opencontainers.image.base.name": "scratch",
"org.opencontainers.image.created": "2025-02-14T03:28:36Z",
"org.opencontainers.image.revision":
"17fe3d1e2d2cbf54d745139eab749c252e35b883",
"org.opencontainers.image.source":
"https://github.com/alpinelinux/docker-alpine.git#17fe3d1e2d2cbf54d745139eab749c252e35b883:x86_64",
"org.opencontainers.image.url": "https://hub.docker.com/_/alpine",
"org.opencontainers.image.version": "3.21.3"
},
"ManifestType": "application/vnd.oci.image.manifest.v1+json",
"User": "",
"History": [
{
"created": "2025-02-14T03:28:36Z",
"created_by": "ADD alpine-minirootfs-3.21.3-x86_64.tar.gz / #
buildkit",
"comment": "buildkit.dockerfile.v0"
},
{
"created": "2025-02-14T03:28:36Z",
"created_by": "CMD [\"/bin/sh\"]",
"comment": "buildkit.dockerfile.v0",
"empty_layer": true
}
],
"NamesHistory": [
"docker.io/library/alpine:latest"
]
}
]
user at host:~$
```
### Additional Information:
Discovered while examining BusyBox as an informative reference for discussion
about Micropython MPRemote and the correct behavior of `rm` with regards to
similar situations. See https://github.com/micropython/micropython/pull/16994.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the busybox-cvs
mailing list