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

Thiago Macieira thiago.macieira at intel.com
Sat Oct 11 16:35:17 CEST 2014


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.

> -- 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.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list