ITADN

The `rm` and `rmi` commands exits with status 0 even after an error

#1731Openacinis 创建于 2025-12-01
1. Bug
A
aciniscommented
**Describe the bug** The `rm` and `rmi` commands exits with status 0 even after an error. **Steps how to reproduce the behaviour** 1. Run `toolbox list` to check if the container we're trying to remove **doesn't exist** (eg. `test`). 2. Try to remove it: `toolbox rm test`. 3. An error message appears: `Error: failed to inspect container test`. 4. Check the exit code `echo $?` and it will be `0`. **Expected behaviour** The `toolbox` should exit with non-zero status code. **Actual behaviour** The `toolbox` exits with a status code `0`. **Output of `toolbox --version` (v0.0.90+)** `toolbox version 0.3` **Toolbx package info (`rpm -q toolbox`)** `toolbox-0.3-1.fc43.x86_64` **Output of `podman version`** ``` Client: Podman Engine Version: 5.7.0 API Version: 5.7.0 Go Version: go1.25.4 X:nodwarf5 Git Commit: 0370128fc8dcae93533334324ef838db8f8da8cb Built: Tue Nov 11 01:00:00 2025 Build Origin: Fedora Project OS/Arch: linux/amd64 ``` **Podman package info (`rpm -q podman`)** `podman-5.7.0-1.fc43.x86_64` **Info about your OS** `Fedora Linux 43.20251129.0 (Silverblue) x86_64` **Additional context** On the following lines there are `fmt.Fprintf()` calls, followed by `continue`, so the error is reported, but given action continues. This is quite surprising when `toolbox` is used in scripts or chained commands such as `toolbox rm X && toolbox create X`. https://github.com/containers/toolbox/blob/e9ec7f150af4cb4b2c0be0735e99e26cd335bd49/src/cmd/rmi.go#L78-L79 https://github.com/containers/toolbox/blob/e9ec7f150af4cb4b2c0be0735e99e26cd335bd49/src/cmd/rmi.go#L94-L95 https://github.com/containers/toolbox/blob/e9ec7f150af4cb4b2c0be0735e99e26cd335bd49/src/cmd/rmi.go#L99-L100 https://github.com/containers/toolbox/blob/e9ec7f150af4cb4b2c0be0735e99e26cd335bd49/src/cmd/rm.go#L78-L79 https://github.com/containers/toolbox/blob/e9ec7f150af4cb4b2c0be0735e99e26cd335bd49/src/cmd/rm.go#L95-L96 https://github.com/containers/toolbox/blob/e9ec7f150af4cb4b2c0be0735e99e26cd335bd49/src/cmd/rm.go#L100-L101 https://github.com/containers/toolbox/blob/e9ec7f150af4cb4b2c0be0735e99e26cd335bd49/src/cmd/rm.go#L105-L106
1 条评论