#1108691 pmount silently skips fstype autodetect with blkid when ran not by root

Package:
pmount
Source:
pmount
Description:
mount removable devices as normal user
Submitter:
Nikolas Kyx
Date:
2025-07-04 07:47:01 UTC
Severity:
normal
#1108691#5
Date:
2025-07-03 07:11:03 UTC
From:
To:
1) Mount smth with command /usr/bin/pmount --debug PART
2) Look at pmount output and see no evidence of HAVE_BLKID code executed
3) Check ldd and package dependency and indeed there is libblkid
4) Look at the HAVE_BLKID code in src/pmount.c. Suspect that
tp = blkid_get_tag_value(c, "TYPE", device) is NULL.
pmount don't have a message for this case, sadly.
5) Now run (already SUID) /usr/bin/pmount --debug as root (e.g. with
sudo) and see that:

Interesting why tp is NULL in SUID case but not NULL when run as root.
Tried with ext4 and vfat/fat32 partitions.
lsblk -f detects fs types both without sudo and suid.

#1108691#10
Date:
2025-07-04 07:42:10 UTC
From:
To:
It looks like openat() syscall is failing with EACCESS somewhere in
the blkid_get_tag_value(). So get_root() is needed to run this
function. Not sure whether it's safe.

lsblk implements a whole internal library to gather info about block
devices, it supports multiple data gathering methods (e.g. from udev).
So lsblk-way is not applicable here :(