Re: [RFC] refactor mnt_fstype_is_pseudofs()?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Karel Zak wrote:
> On Fri, Feb 01, 2019 at 12:07:12AM +0100, Stanislav Brabec wrote:
>> Hi.
>>
>> I got a but report about a dumpfs FUSE filesystem reporting bad mount output.
>>
>> The same problem affects other pseudo file systems not listed in mnt_fstype_is_pseudofs():
>> # mount | grep encfs
>> encfs on /Encrypted type fuse.encfs (rw,nosuid,nodev,relatime,user_id=10027,group_id=100,default_permissions)
>> # mkdir encfs
>> # mount | grep encfs
>> /root/encfs on /Encrypted type fuse.encfs (rw,nosuid,nodev,relatime,user_id=10027,group_id=100,default_permissions)
>> ^^^^^^^^^^^
>>
>> Debugging shows two reasons why it happens:
>> 1) encfs is not listed in mnt_fstype_is_pseudofs()
>> 2) mnt_resolve_path() calls canonicalize_path_and_cache() on the kernel output, which makes only a little sense
> 
> Where? It should be easy to check by mnt_fs_is_kernel().

This canonicalize_path_and_cache() mangles the mount output.

If fs is not listed as a pseudofs, it tries to canonicalize the string, e. g. "encfs". If a directory called "encfs" exists in the current directory, it is expanded to path of $PWD/encfs.

char *mnt_resolve_path(const char *path, struct libmnt_cache *cache)
{
	char *p = NULL;

	/*DBG(CACHE, ul_debugobj(cache, "resolving path %s", path));*/

	if (!path)
		return NULL;
	if (cache)
		p = (char *) cache_find_path(cache, path);
	if (!p)
->		p = canonicalize_path_and_cache(path, cache);

	return p;
}

>> Currently I am aware of three file systems affected at least (i. e. not listed): gvfs (subtype was renamed from gvfs-fuse-daemon to gvfsd-fuse), encfs, dumpfs.
>>
>> Easy fix would be adding all of them to the list. But probably much more exists.
> 
> It would be nice to have such easy bugfix, so we can backport it to
> old version etc. :-)

OK, I will send it.

> If we will keep the fstype lists in the code than we can use it as
> the first attempt, if the name is not in the list than use your
> heuristic.

It makes sense.

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec@xxxxxxxx
Křižíkova 148/34 (Corso IIa)                    tel: +420 284 084 060
186 00 Praha 8-Karlín                          fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux