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

Benno Schulenberg <[email protected]> Tue, 21 Oct 2025 15:49:01 +0200
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
Op 21-10-2025 om 12:00 schreef Karel Zak:
> Both issues should be fixed in the branch. I have changed how it uses
> --detach, --remove, and --set-capacity to assume the device name
> follows the options rather than requiring it as an option's argument.
> 
> It returns the mutually exclusive check to the game and avoids
> interpreting an option as a device name.

Nice.  Thanks.

>   # ./losetup --remove --detach loop0
>   losetup: mutually exclusive arguments: --detach-all --all --set-capacity --detach --find --associated --remove

Nnn...  My next report was going to be about this.  :)  About too verbose
and therefore confusing feedback.  The user did not specify --detach-all,
nor --all, nor --set-capacity, nor --find, nor --associated.  Thus it is
confusing to see them mentioned in the error message.

It would be much nicer if the routine that checks for conflicting options
would just print the first two incompatible ones of the options that were
actually given.  For example:

   # ./losetup --remove --find --all
   losetup: options --remove and --find cannot be combined


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

wsF5BAABCAAjFiEEFo5vQpe/16ea/USWUUu+Lrjhlh8FAmj3j04FAwAAAAAACgkQUUu+Lrjhlh+4
Kw/+NZGCYd5B2qRF+sgEOgslfJP9P/AOPpPXVn0vuo2LzXmVC4FAi4tDQWZjBeKwW1S4iZ45SwBL
PtcyQ6oZSP9zO7XNgX201TjroPxNE/9B72sT2bXArKJMJkvw28AX7lVIGoCSFfADSOX5UQVSjWGL
5DkpBZBcvE7j8VHM3grB1nraVUNkMTgXhPoLBsjCYEwAJ3gQh07iC6ib/UEiI/N65kf/mi8cmp/O
d9DHCY0LO3omw6VFaYyQpv2TKbl1zTUq+nH/v+CnnBAxu2Fffuf7t3IuZUp/u3A+y1FTmsslDkYJ
LTQXepka27b+xKvHEuE+GPrGgYr39hzoBT85JhGUkCR7F9OvGWj9eRSOfuANrGvybzm6Kvv6srII
fKQLKQJ3s82BxhlvWFkzvp7LveK2ifV8jPlIjhfLTB5uosWx8aOb4NcSRd//BOgdz2DNn+gnd63A
CvUXbDUq5Ss+raEoPnmrE6mnn8jj0UMUSbJYf3i+NHo1JpbuKSe5yjpN8zxL+k9tW49YC80sd0n3
epk00FU4b2FCH+tTyEXmHqdJSpr5IFiqWfBTmXYz8A7UXP5W1u9WR1OMMhesFzXPVWLCbcJlIUn3
WfQNRU/4qK4k+AMDhLNzzDP4nWxwHqlwJW76P2sJitHY0KmVKLA40c2VypkG3GPa/MVX+IS+dyra
r10=
=rNGj
-----END PGP SIGNATURE-----