[pkg-cryptsetup-devel] Bug#1033551: cryptsetup-bin: cryptsetup -v isLuks: doesn't work as documented

Guilhem Moulin guilhem at debian.org
Mon Mar 27 13:29:39 BST 2023


Control: tag -1 - moreinfo unreproducible
Control: tag -1 + upstream
Control: retitle -1 cryptsetup-bin: `cryptsetup -v isLuks` produces misleading output when the device isn't LUKS

On Mon, 27 Mar 2023 at 14:06:32 +0200, Alexis Huxley wrote:
> testaroli# cryptsetup isLuks /dev/loop0; echo "\`cryptsetup isLuks\` exited with status $?"
> `cryptsetup isLuks` exited with status 1
> testaroli# cryptsetup isLuks -v /dev/loop0
> Command failed with code -1 (wrong or missing parameters).
> testaroli#
>
> It should say "not Luks" or perhaps "invalid device", but
> "wrong or missing parameters" is wrong.

Ah I see, it works as documented then.  The error message could arguably
be improved, but I guess the return status can't be changed anymore, and
show_status() maps it as follows:

    if (errcode == 1)
        crypt_error = _("wrong or missing parameters");
    else if (errcode == 2)
        crypt_error = _("no permission or bad passphrase");
    else if (errcode == 3)
        crypt_error = _("out of memory");
    else if (errcode == 4)
        crypt_error = _("wrong device or file specified");
    else if (errcode == 5)
        crypt_error = _("device already exists or device is busy");
    else
        crypt_error = _("unknown error");

FWIW error code 1 (wrong or missing parameters) is also returned when
trying to format/open a device using an unsupported cipher.

-- 
Guilhem.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-cryptsetup-devel/attachments/20230327/28c22a1d/attachment.sig>


More information about the pkg-cryptsetup-devel mailing list