Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qvm-volume list [--full] confusing behavior #8519

Open
aronowski opened this issue Sep 16, 2023 · 2 comments
Open

qvm-volume list [--full] confusing behavior #8519

aronowski opened this issue Sep 16, 2023 · 2 comments
Labels
affects-4.1 This issue affects Qubes OS 4.1. affects-4.2 This issue affects Qubes OS 4.2. C: core needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists. ux User experience

Comments

@aronowski
Copy link

How to file a helpful issue

Qubes OS release

4.1.2

Brief summary

The behavior and documentation of qvm-volume list seem confusing when considering its --full option.

The documentation says this:

List block devices. By default the internal devices are hidden. When the
stdout is connected to a TTY `qvm-volume list` will print a pretty table by
omitting redundant data. This behaviour is disabled when `--full` option is
passed or stdout is redirected to a pipe or file.

[...]

.. option:: --full

   print domain names

A comment in the qvm_volume.py script says:

If :program:`qvm-volume` is running in a TTY, it will ommit duplicate
        data.

[...]

        :param bool full:    If set to true duplicate data is printed even when
                             running from TTY.

So, as far as I understand, there's something that can be referred to as internal devices, redundant/duplicate data and domain names. Seems confusing to me, even though I spent some time to dig deep in this script as part of PR #259, but maybe it's just me, so let's compare the aforementioned default behavior with its disabled counterpart both by using the --full option and piping, using sys-net as VMNAME:

Steps to reproduce

[user@dom0 ~]$ diff --report-identical-files <(qvm-volume list sys-net) <(qvm-volume list --full sys-net)
Files /dev/fd/63 and /dev/fd/62 are identical
[user@dom0 ~]$ diff --report-identical-files <(qvm-volume list sys-net) <(qvm-volume list sys-net | cat)
Files /dev/fd/63 and /dev/fd/62 are identical

Apparently the logic does not work and it always seems to default to the non-default, A.K.A. the disabled behavior:

[user@dom0 ~]$ qvm-volume list sys-net
POOL:VOLUME                             VMNAME   VOLUME_NAME  REVERT_POSSIBLE
linux-kernel:6.1.42-1.fc32              sys-net  kernel       No
vm-pool:qubes_dom0/vm-sys-net-private   sys-net  private      Yes
vm-pool:qubes_dom0/vm-sys-net-root      sys-net  root         No
vm-pool:qubes_dom0/vm-sys-net-volatile  sys-net  volatile     No
[user@dom0 ~]$ qvm-volume list --full sys-net
POOL:VOLUME                             VMNAME   VOLUME_NAME  REVERT_POSSIBLE
linux-kernel:6.1.42-1.fc32              sys-net  kernel       No
vm-pool:qubes_dom0/vm-sys-net-private   sys-net  private      Yes
vm-pool:qubes_dom0/vm-sys-net-root      sys-net  root         No
vm-pool:qubes_dom0/vm-sys-net-volatile  sys-net  volatile     No
[user@dom0 ~]$ qvm-volume list sys-net | cat
POOL:VOLUME                             VMNAME   VOLUME_NAME  REVERT_POSSIBLE
linux-kernel:6.1.42-1.fc32              sys-net  kernel       No
vm-pool:qubes_dom0/vm-sys-net-private   sys-net  private      Yes
vm-pool:qubes_dom0/vm-sys-net-root      sys-net  root         No
vm-pool:qubes_dom0/vm-sys-net-volatile  sys-net  volatile     No

Expected behavior

I don't know. What's more confusing, the script says:

                if full or not sys.stdout.isatty():
                    output += [(str(volume), vmname, volume_name,
                            volume.revisions)]
                else:
                    output += [('', vmname, volume_name, volume.revisions)]

So the expected behavior might have been something like:

[user@dom0 ~]$ qvm-volume list sys-net
VMNAME   VOLUME_NAME  REVERT_POSSIBLE
sys-net  kernel       No
sys-net  private      Yes
sys-net  root         No
sys-net  volatile     No

where we would refer to the non-printed part (str(volume)) as internal devices. But this would contradict the documentation, which says:

.. option:: --full

   print domain names

So maybe the documentation is wrong too?

Actual behavior

See Steps to reproduce above.

@aronowski aronowski added P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists. labels Sep 16, 2023
@andrewdavidwong andrewdavidwong added C: core ux User experience needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. affects-4.1 This issue affects Qubes OS 4.1. labels Sep 17, 2023
@andrewdavidwong andrewdavidwong added eol-4.1 Closed because Qubes 4.1 has reached end-of-life (EOL) and removed needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. labels Dec 7, 2024

This comment was marked as outdated.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2024
@aronowski
Copy link
Author

aronowski commented Dec 8, 2024 via email

@andrewdavidwong andrewdavidwong added affects-4.2 This issue affects Qubes OS 4.2. needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. and removed eol-4.1 Closed because Qubes 4.1 has reached end-of-life (EOL) labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.1 This issue affects Qubes OS 4.1. affects-4.2 This issue affects Qubes OS 4.2. C: core needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists. ux User experience
Projects
None yet
Development

No branches or pull requests

2 participants