Re: [DKIM] Re: `losetup --remove` is confusing, and misuse silently fails

Benno Schulenberg <[email protected]> Sat, 11 Oct 2025 14:47:22 +0200
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
Op 11-10-2025 om 12:16 schreef Nuno Silva:
> For all commands after this one in your message, where there was no
> output, what was the exit status?

The answer is below.

>>    # ./losetup -d -R loop4
>>    losetup: /dev/-R: detach failed: No such file or directory
>>
>> Huh?  Why does it try to interpret an option as a loop device name?
> 
> The online manual here says that -d takes one argument, so my
> understanding is that that is expected?

Agreed.  (It's just that I expected the tool to be cleverer.)

>>    # ./losetup -d loop4 -R loop4

   # echo $?
   1

So it didn't actually work.  It only works (and has exit status 0)
when having a done a plain `./losetup -d loop4` beforehand.

Seeing that four options (-d, -D, -c, -R) are more like commands,
maybe those should be made mutually exclusive?  Meaning that
losetup` should barf when more than one of them is given?


Benno
OpenPGP_signature.asc (application/pgp-signature, 840 B)
-----BEGIN PGP SIGNATURE-----

wsF5BAABCAAjFiEEFo5vQpe/16ea/USWUUu+Lrjhlh8FAmjqUdoFAwAAAAAACgkQUUu+Lrjhlh8T
1RAAqOVUlNLltSNch+a1Jy0SIt4cgAe2LUD+jncnGgWXNgLkm8iM5RDFDnLb7JOpqg977dvL1Qgq
CM+1viSTnh8E0W7k+8r/cZCdVftSQ6jxQTlvsQP381brTRA2bGeHl3FR1m+oQS3FdtGcvSZjgZBi
NXxa1fucjz9ZGGv/IMzeWHOseX+5to3Fxa+mSlVJNEHgpz24imLUDZRChY3El9FBn3T2CSJV4Vop
Gxl6WTF0BNmRSOiTzmyFvD+nYV+9hPwE2PBXtcmL3pEdiMYFIuth9LMHVmjB8sBEbc5UgWSILs4I
sg+PvFTGk+H/JLkp/Wf0XHlM4hVYopa/nIl1r5sy5AlUOyKQa6fFK0zSBSMCvV2ME+9UIWE+oQvh
CGV/psLj6gcPyZpjb0VKvoMac69OhmDl5f0+Cm4GGlQNA2X9DtDYJ2qnuEoKjhFuoNZbWIXPDhds
HNxWXzHnpheCiUHIi1jkOluL7n0jcmCazXmGA4cPb1NQU9wZNsGBoNJwmf7B78Rul9/ibxX2pqSZ
+/Ju+Lg9eM4dUUiP6YRQY2Bsaz5ZhpWv6CvGKeQo8CenoNuAqWMsICPO6BConi2/ZALf5/kk5gFS
40NWGECktmplVGHLZ8SNrFQFrPtFT8Wzx+E/GX04WIlgKZkFk9rdrsSW9sxQlRA0pCy2RoMUlpSU
wJE=
=aQ6V
-----END PGP SIGNATURE-----