[Interest] Possible bug: QStorageInfo does not show private mounts (Linux)

Marian Beermann public at enkore.de
Sat Oct 11 18:39:21 CEST 2014


On 10/11/2014 04:35 PM, Thiago Macieira wrote:
> On Saturday 11 October 2014 14:38:44 Marian Beermann wrote:
>> QStorageInfo::mountedVolumes does not return private mounts, which are
>> usually located under the /run tree (e.g.
>> /run/media/$USERNAME/$DEVICENAME/).
>>
>> Is this a bug or intended behaviour?
> 
> Do they show in /etc/mnttab? If they don't show up there, then it's intended 
> behaviour and your system is buggy.

I don't have an /etc/mnttab, I think that's not used by any Linux-based
OS. These mounts are however listed by both mount and findmnt commands.
They are not set up in the /etc/fstab, since they're mounted on demand.

> 
>> -- snip --
>>
>> static bool isPseudoFs(const QString &mountDir, const QByteArray &type)
>> {
>>     if (mountDir.startsWith(QLatin1String("/dev"))
>>
>>         || mountDir.startsWith(QLatin1String("/proc"))
>>         || mountDir.startsWith(QLatin1String("/run"))
>>         || mountDir.startsWith(QLatin1String("/sys"))
>>         || mountDir.startsWith(QLatin1String("/var/run"))
>>         || mountDir.startsWith(QLatin1String("/var/lock"))) {
>>
>>         return true;
>>     }
>> #if defined(Q_OS_LINUX)
>>     if (type == "rootfs")
>>         return true;
>> #else
>>     Q_UNUSED(type);
>> #endif
>>
>>     return false;
>> }
>>
>> -- snip --
>>
>> Maybe it would be better to have a blacklist of FS types. This would
>> work very well, especially when discarding volumes mounted under a
>> blacklisted FS ; e.g. when blacklisting sysfs one doesn't need to care
>> about all the different filesystems the kernel uses there. First few
>> things that come to mind when considering types for a blacklist: proc,
>> sysfs, devtmpfs, configfs, kernfs.
> 
> Right. /run or /var/run may be a tmpfs, but the filesystems mounted inside it 
> aren't. That's a bug.
> 

I wouldn't consider a tmpfs a pseudo filesystem (these files do exist -
at least in memory - in contrast to a procfs or a sysfs), but I don't
know if the term "pseudo-fs" is something that has a real definition. If
not it might be a good idea to clarify the docs in this regard.

Alternatively it might be less hassle to support this by changing the
behaviour of mountedVolumes slightly in the direction that it just
returns all mounted volumes, regardless of type.



More information about the Interest mailing list