The PART_ENTRY_* has nothing to do with the _contents_ of the block
device. So if the device is empty these values should not be printed
and blkid(8) has to return 2.
The PART_ENTRY_* for empty devices should be printed for "-o udev"
output only.
Reported-by: Thomas Bächler <thomas@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
if (!rc)
nvals = blkid_probe_numof_values(pr);
+ if (nvals &&
+ !(output & OUTPUT_UDEV_LIST) &&
+ !blkid_probe_has_value(pr, "TYPE") &&
+ !blkid_probe_has_value(pr, "PTTYPE"))
+ /*
+ * Ignore probing result if there is not any filesystem or
+ * partition table on the device and udev output is not
+ * requested.
+ *
+ * The udev db stores information about partitions, so
+ * PART_ENTRY_* values are alway important.
+ */
+ nvals = 0;
+
if (nvals && !first && output & (OUTPUT_UDEV_LIST | OUTPUT_EXPORT_LIST))
/* add extra line between output from devices */
fputc('\n', stdout);