[Pkg-utopia-maintainers] Bug#827029: udisks2: machine-readable output for "udisksctl loop-setup" and "udisksctl mount"
Ian Bruce
ian_bruce at mail.ru
Sat Jun 11 11:01:54 UTC 2016
Package: udisks2
Version: 2.1.7-2
Severity: normal
Tags: upstream
Contrary to traditional expectations for UNIX command-line utilities
(but reminiscent of dumbed-down software systems such as MS-Windows),
/usr/bin/udisksctl produces non-informational output, which tells
a human user nothing they didn't already know, but makes it difficult
to use the results in a script.
$ udisksctl loop-setup --file ./linuxmint-17.3-xfce-64bit.iso
Mapped file ./linuxmint-17.3-xfce-64bit.iso as /dev/loop0.
$ udisksctl mount --block-device /dev/loop0p1
Mounted /dev/loop0p1 at /media/ian/Linux Mint 17.3 Xfce 64-bit.
These are not error messages; they are the normal output resulting from
successful command execution. Presumably, the output format strings are,
respectively:
"Mapped file %s as %s."
and
"Mounted %s at %s."
In each case, the first "%s" is simply the command-line argument, and the
rest of the text is literal-string boilerplate, so both are completely
non-informative. The only useful output is the second "%s", which is the
actual result of the command. This should be output by itself, followed
only by a newline, so that it can be read and used by a script:
LOOP_DEVICE=$(udisksctl loop-setup --file $LOOP_FILE)
# --> "/dev/loop0"
MOUNT_POINT=$(udisksctl mount --block-device $FILE_SYSTEM)
# --> "/media/ian/Linux Mint 17.3 Xfce 64-bit"
As it is, in order for these commands to be used in a script, the output
must be parsed by regular-expression pattern-matching, or something like that,
which is an unnecessary nuisance, and will break as soon as the format string
is changed, for any reason. (see below)
Please fix this.
Let me point out that the output of this program is apparently so unimportant
that it hasn't even been internationalized:
$ env | grep -e LANG -e LC
LC_MESSAGES=fr_CA.utf8
LANG=fr_CA.utf8
LANGUAGE=
$
$ pwdd
bash: pwdd : commande introuvable
$
$ ls foobar
ls: impossible d'accéder à 'foobar': Aucun fichier ou dossier de ce type
$
$ udisksctl loop-setup --file ./linuxmint-17.3-xfce-64bit.iso
Mapped file ./linuxmint-17.3-xfce-64bit.iso as /dev/loop0.
$
$ udisksctl mount --block-device /dev/loop0p1
Mounted /dev/loop0p1 at /media/ian/Linux Mint 17.3 Xfce 64-bit.
$
If this text isn't necessary for non-English speakers, then it clearly isn't
necessary for English speakers, either. PLEASE REMOVE IT.
-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'stable-updates'), (500, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.5.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_CA.utf8, LC_CTYPE=en_CA.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages udisks2 depends on:
ii dbus 1.10.8-1
ii libacl1 2.2.52-3
ii libatasmart4 0.19-4
ii libc6 2.22-11
ii libglib2.0-0 2.48.1-1
ii libgudev-1.0-0 230-3
ii libpam-systemd 230-2
ii libpolkit-agent-1-0 0.105-15
ii libpolkit-gobject-1-0 0.105-15
ii libsystemd0 230-2
ii libudisks2-0 2.1.7-2
ii parted 3.2-15
ii udev 230-2
Versions of packages udisks2 recommends:
ii dosfstools 4.0-2
ii eject 2.1.5+deb1+cvs20081104-13.1
ii gdisk 1.0.1-1
ii ntfs-3g 1:2016.2.22AR.1-3
ii policykit-1 0.105-15
Versions of packages udisks2 suggests:
pn btrfs-tools <none>
ii cryptsetup-bin 2:1.7.0-2
pn exfat-utils <none>
ii mdadm 3.4-1
pn reiserfsprogs <none>
pn xfsprogs <none>
-- no debconf information
More information about the Pkg-utopia-maintainers
mailing list