Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
Running blkid against a device with multiple filesystems present shows the wrong return code. It returns BLKID_EXIT_NOTFOUND(2), when the return should be BLKID_EXIT_AMBIVAL(8).
Per the man page:
~~~
RETURN CODE
If the specified token was found, or if any tags were shown from (specified) devices, 0 is returned.
If the specified token was not found, or no (specified) devices could be identified, an exit code of 2 is returned.
For usage or other errors, an exit code of 4 is returned.
If an ambivalent low-level probing result was detected, an exit code of 8 is returned.
~~~
Additionally, the command fails silently and should not.
Version-Release number of selected component (if applicable):
util-linux-2.23.2-43.el7.x86_64
How reproducible:
[root@localhost ~]# wipefs /dev/sdd
offset type
----------------------------------------------------------------
0x3ffa9000 zfs_member [filesystem]
0x0 xfs [filesystem]
LABEL: f25
UUID: 08b51be7-10d9-4e69-b75c-ba4fd55a301a
[root@localhost ~]# blkid /dev/sdd
[root@localhost ~]# echo $?
2
#define BLKID_EXIT_NOTFOUND 2 /* token or device not found */
#define BLKID_EXIT_OTHER 4 /* bad usage or other error */
#define BLKID_EXIT_AMBIVAL 8 /* ambivalent low-level probing detected */
Actual results:
Command fails silently and returns 2.
Expected results:
The command should return as the probing option does, with an error that states there were likely ambivalent results, with a reference to wipefs, and with 8 as it's return code.
[root@localhost ~]# blkid -p /dev/sdd
/dev/sdd: ambivalent result (probably more filesystems on the device, use wipefs(8) to see more details)
[root@localhost ~]# echo $?
8
It's also problematic that when the blkid command is used with no arguments, it does not display anything for devices that have multiple labels. This is probably desirable, but is not informative at all. It's also the way most customers use the command.
Is it possible to get a mention in the man page of this behavior? Something like 'If ambivalent results are found when running blkid with no arguments, no results will be displayed for the device.'
man page:
-p Switch to low-level superblock probing mode (bypassing the cache).
...
If an ambivalent *low-level probing* result was detected, an exit code of 8 is returned.
--
If you don't use -p, then blkid reads cached information and has no clue about the ambivalent result. There is no way how to return 8 in this case.
It seems that all we can do is to add more information to the man page.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2018:0936
Description of problem: Running blkid against a device with multiple filesystems present shows the wrong return code. It returns BLKID_EXIT_NOTFOUND(2), when the return should be BLKID_EXIT_AMBIVAL(8). Per the man page: ~~~ RETURN CODE If the specified token was found, or if any tags were shown from (specified) devices, 0 is returned. If the specified token was not found, or no (specified) devices could be identified, an exit code of 2 is returned. For usage or other errors, an exit code of 4 is returned. If an ambivalent low-level probing result was detected, an exit code of 8 is returned. ~~~ Additionally, the command fails silently and should not. Version-Release number of selected component (if applicable): util-linux-2.23.2-43.el7.x86_64 How reproducible: [root@localhost ~]# wipefs /dev/sdd offset type ---------------------------------------------------------------- 0x3ffa9000 zfs_member [filesystem] 0x0 xfs [filesystem] LABEL: f25 UUID: 08b51be7-10d9-4e69-b75c-ba4fd55a301a [root@localhost ~]# blkid /dev/sdd [root@localhost ~]# echo $? 2 #define BLKID_EXIT_NOTFOUND 2 /* token or device not found */ #define BLKID_EXIT_OTHER 4 /* bad usage or other error */ #define BLKID_EXIT_AMBIVAL 8 /* ambivalent low-level probing detected */ Actual results: Command fails silently and returns 2. Expected results: The command should return as the probing option does, with an error that states there were likely ambivalent results, with a reference to wipefs, and with 8 as it's return code. [root@localhost ~]# blkid -p /dev/sdd /dev/sdd: ambivalent result (probably more filesystems on the device, use wipefs(8) to see more details) [root@localhost ~]# echo $? 8