Bug 909866 - The mount command badly handles = chars (even in /etc/fstab)
Summary: The mount command badly handles = chars (even in /etc/fstab)
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: util-linux
Version: 17
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-11 10:47 UTC by Roberto Ragusa
Modified: 2013-04-15 09:06 UTC (History)
3 users (show)

Fixed In Version: util-linux-2.23
Clone Of:
Environment:
Last Closed: 2013-04-15 09:06:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Roberto Ragusa 2013-02-11 10:47:28 UTC
Description of problem:

The mount command is too aggressive in interpreting "=" chars in device names and makes some operations impossibles, for example fuse.unionfs mounts or mounts with unusual device names.


Version-Release number of selected component (if applicable):

util-linux-2.21.2-3.fc17.x86_64


How reproducible:

Trivially, every time.


Steps to Reproduce:

1. make a few dirs
# mkdir /tmp/{a,b,a_on_b}

2. populate them
# touch a/aaa b/bbb

3. let's try to do a fuse.unionfs mount on fstab
/tmp/a=RW:/tmp/b=RO /tmp/a_on_b fuse.unionfs cow 0 0

4. mount it
# mount /tmp/a_on_b

Actual results:

mount: /tmp/a_on_b: mount failed: Invalid argument


Expected results:

A successful mount.

Additional info:

Trying manually does not solve the issue:
# mount /tmp/a\=RW:/tmp/b\=RO /tmp/a_on_b -t fuse.unionfs -o cow
mount: /tmp/a_on_b: mount failed: Invalid argument

Trying to escape the =
/tmp/a\075RW:/tmp/b\075RO /tmp/a_on_b fuse.unionfs cow 0 0
still does not work.

Please note that I'm using my own rpm derived from
http://podgorny.cz/moin/UnionFsFuse
but the issue is actually on the mount command.
If I recompile the /usr/bin/unionfs to accept "!" instead of "="
and modify my fstab, everything is ok, as mount is not confused anymore.


Another very simple test, non involving unionfs, also fails:

# mkdir /tmp/f=1 /tmp/f1
# mount --bind /tmp/f=1 /tmp/f1
mount: you must specify the filesystem type
# mkdir f-1
# mount --bind /tmp/f-1 /tmp/f1
#

because mount is confused by the "=".

And no luck with fstab too:
both
/tmp/f=1 /tmp/f1 bind bind 0 0
and
/tmp/f\0751 /tmp/f1 bind bind 0 0
fail.

Comment 1 Karel Zak 2013-02-11 15:58:00 UTC
Fixed by up[stream commit b8f2d06ed7695005b0f4a3376ce070cfc313e65b, Fedora package will be updated ASAP.

Anyway, it's pretty bad idea to use '=' in source paths, because supported scenario is NAME=value (e.g. LABEL=foo).

Comment 2 Roberto Ragusa 2013-02-11 19:31:40 UTC
The problem is that there is no usable escaping.
I think that \075 should not be turned into = before parsing LABEL, UUID etc.
It appears right to first check if a = is present and than unescape.

Comment 3 Karel Zak 2013-04-15 09:06:38 UTC
Implemented in Fedora 19.


Note You need to log in before you can comment on or make changes to this bug.