bugdavfs2 - Bugs: bug #41437, Always canonicalize mountpoint

 
 

bug #41437: Always canonicalize mountpoint

Submitter:  None
Submitted:  Sun 02 Feb 2014 05:40:31 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  _71007
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 13 Mar 2014 04:31:28 PM UTC, comment #16: 

Comment #13 refers to branches in CVS not releases.

Comment #15:
RFC 3986 does not require user interfaces to only deal with URLs in percent-encoded form. For human beeings representations that contain reserved characters or non-ascii characters are quite convenient. Your browser will allow you e.g. to enter URLs with spaces and will do the percent-encoding for you. You will also find URLs in not-encoded form in HTML-pages.

Concerning davfs2:
The path components of an URL are mapped to file names by davfs2. File names must not be percent-encoded, it would be a desaster. But path-components may also be part of the URL that represents the root of the file system. It would be rather confusing (and in early versions of davfs2 this confusion caused trouble) to have different rules for entering path-components. Additionally: 'man mount.davfs' is quite clear about this.

Werner

- <_71007>
Wed 12 Mar 2014 08:06:30 PM UTC, comment #15: 

In re comment #12, I'm not sure what you mean by "URLs ... must not be percent encoded."  If a construct like "%40" appears in a URL, the URL contains the characters "%", "4", and "0".  In may (in the interpretation by some server) represent "@", but that is another matter entirely.  Look at RFC 3986 carefully.

Dale Worley <worley>
Wed 12 Mar 2014 08:03:11 PM UTC, comment #14: 

I believe that there is a mistake in comment #13http://download.savannah.gnu.org/releases/davfs2/ lists release 1.4.6 as being made on 30-Apr-2010.

Dale Worley <worley>
Wed 12 Mar 2014 04:55:04 PM UTC, comment #13: 

Fixed in CVS branch MAIN and branch rel-1-4-6.

- <_71007>
Wed 12 Mar 2014 04:52:49 PM UTC, comment #12: 

It seems that only the space character needs to be escaped in fstab. I removed that misleading hint for the #-character from the man page.

Please note: for davfs2 URLs in fstab or on the commandline or in the config and secrets files must not be percent encoded. This is done by davfs2. So URLs may contain spaces and other problematic characters. If an URL contains the character sequence "\040" this may still cause trouble. But I don't worry about this case.

Werner

- <_71007>
Mon 10 Mar 2014 11:08:27 PM UTC, comment #11: 

The use of "\" in URLs is complicated.

The documentation for my fstab (Fedora 19) mentions only escaping space as "\040".

The documentation with davfs mentions escaping space as "\040" and escaping # as "\043".

This leads to the assumption that "\ooo" is a valid escape for any three octal digits ooo.  But that is not stated.

Given the use of \ to introduce escapes, one would expect that \ would have to be represented as \134, as otherwise using it directly in most contexts would be an invalid escape sequence and in some contexts would cause it to be incorrectly interpreted as an escape sequence.  So the only reliably safe rule is "if the fs_spec" value contains \, it should be represented with \134.

(Consider what would happen if the DAV URL was "http://example.com/\123x" -- where that \ represents \.)

It turns out that this entire discussion is moot in regard to davfs -- neither space nor \ are valid characters in URLs.  (You can see this by the fact that neither of the characters is mentioned in the URL syntax provided by RFC 3986, Appendix A.)  As a rule, when someone enters a space in a URL, it is translated into a "+", the character the URL contains is "+", which may then cause the server receiving the URL to access a file whose name contains a space.  Other characters which are not allowed within URLs are represented by "%hh" escape sequences, but in the same way, the "%", etc. are characters within the URL that may represent some other character in the server's mind.

'#' however is valid in URLs, however my fstab documentation says that '#' indicates a comment only at the beginning of a line, so '#' in a URL is not problematic.

Dale Worley <worley>
Mon 10 Mar 2014 10:48:37 PM UTC, comment #10: 

I have tested the code in CVS (as of 10 Mar 2014) and it fixes the problem I reported.

Dale Worley <worley>
Mon 10 Mar 2014 09:54:07 PM UTC, comment #9: 

I suspect that comment 8 in this issue should have been added to a different issue.

Dale Worley <worley>
Sun 09 Mar 2014 05:26:51 PM UTC, comment #8: 

As long as davfs2 is attached to the terminal it will use stout and stderr to report problems, no need to additionally write them to a log file.

davfs2 will write into log files

  • severe problems after it has been detached from the terminal
  • additional debug messages if option debug is given (they are additional and not be a replacement for error messages on stderr).


Werner

- <_71007>
Sun 09 Mar 2014 04:22:08 PM UTC, comment #7: 

This may well be not useful at this point, but since you've asked and I keep forgetting to answer:

In a failed davfs mount, the lines which appear in my journald are exactly two:

Mar 08 21:07:47 hobgoblin.ariadne.com mount.davfs[9026]: davfs2 1.4.7
Mar 08 21:07:47 hobgoblin.ariadne.com mount.davfs[9026]: /sbin/mount.davfs https://dav.box.com/dav /common/home/worley/box.com -o rw,noexec,nosuid,nodev,uid=1000,gid=1000,user

Dale Worley <worley>
Sun 09 Mar 2014 10:19:16 AM UTC, comment #6: 

Sorry for the double effort. I should have informed you about what I have already done about this issue in CVS some time ago. (Please always check CVS before doing any work.) I did not yet tag this bug as fixed because the fix is only in CVS but there is still no release of the fixed version.

Because davfs2 requires unique mount points anyway (the mount point identifies a mount in davfs2.conf) I search fstab for this unique mount point (applying canonicalize_file_name first) and then check the URL and the mount options.

Why do you think that "\" has to be octal encoded in fstab? On my system this is not necessary and 'man fstab' does not mention it.

Werner

- <_71007>
Sun 09 Mar 2014 02:26:26 AM UTC, comment #5: 

See the attachments "Suggested changes to mount_davfs.c to allow mountpoints to be specified by names with symlinks." for changes which allow alternative names for the mountpoint to be used in /etc/fstab.  I've tested them on my system, and they seem to work, but an expert needs to review it.

The primary complexity is that the same DAV URL might be used for multiple mounts.  E.g., box.com uses the same DAV URL for every user; it uses the credentials to determine which set of files are accessed.  (Yuck.)  So mount.davfs has to read all of /etc/fstab, looking for an entry with the right URL and also a matching mountpoint.  Nice error reporting is somewhat complicated:  If no lines match, that's easy to report, and if one line matches, you can report the mountpoint specified by the user vs. the mountpoint in /etc/fstab.  But if multiple lines match, you can't report "the mountpoint specified in /etc/fstab" because that's not unique.

I've added a sentence to the manual page to warn that "\" in the URL has to be escaped as "\134", which is implied but not stated in the previous version.  With the aid of Google Translate, I've attempted to render that change in the German manual page.

I've changed some of the error messages, and that may require updating of the error message translations, but I don't know how to do that.

Dale Worley <worley>
Fri 07 Mar 2014 11:01:10 PM UTC, comment #4: 

[Note:  This information is also provided in an attached file
"SCRIPT1.txt" to ensure that special characters are transmitted
unscathed.  In the version of this information that is an attached
file, all information between "-----" lines is copied directly from
the relevant files and is bytewise accurate, other than for any
transformation that savannah.nongnu.org applies to attached files.]

Using Fedora 19:
davfs2-1.4.7-3.fc19.x86_64
util-linux-2.23.2-5.fc19.x86_64 (for /usr/bin/mount)

I have an entry in /etc/fstab:

-----
https://dav.box.com/dav /home/worley/box.com    davfs   rw,user,noauto,uid=worley,gid=worley  0 0
-----

The entry in the davfs secrets file is:

/home/worley/.davfs2/secrets:
-----
https://dav.box.com/dav -email is unavailable- xxxxxxxx
-----
where the password has been changed to "xxxxxxxx".

I attempt to mount https://dav.box.com/dav while running as user 'worley':
$ mount /home/worley/box.com
/sbin/mount.davfs: no entry for https://dav.box.com/dav found in /etc/fstab
$

This message is particularly annoying because there obviously is an
entry for https://dav.box.com/dav in /etc/fstab.

The log lines (extracted with "journalctl | grep -E 'davfs|box\.com' >/tmp/g7")
are:
-----
Mar 07 17:19:23 hobgoblin.ariadne.com mount.davfs[15684]: davfs2 1.4.7
Mar 07 17:19:23 hobgoblin.ariadne.com mount.davfs[15684]: /sbin/mount.davfs https://dav.box.com/dav /common/home/worley/box.com -o rw,noexec,nosuid,nodev,uid=1000,gid=1000,user
-----

Please note that the mount point /home/worley/box.com listed in
/etc/fstab is a symbolic link to the real mount point,
/common/home/worley/box.com:
$ ll -d /home
lrwxrwxrwx. 1 root root 12 Aug 19  2013 /home -> /common/home
$

This symbolic link is critical to the error, because if I edit
/etc/fstab to specify /common/home/worley/box.com, davfs works
correctly.

This leads me to believe that the error process is that mount.davfs is
looking for /common/home/worley/box.com in /etc/fstab, but cannot find
it.  Unfortunately, the message it generates is incorrect; it should
say something like:
/sbin/mount.davfs: no entry for /common/home/worley/box.com found in /etc/fstab

But a better approach would be for mount.davfs to search /etc/fstab
for all entries containing the specified WebDAV URL, and then use
stat(2) to check if the mount point listed in the line is the same
directory (same st_dev and st_ino) as the mount point in the
mount.davfs command line.

Dale Worley <worley>
Sun 02 Feb 2014 05:40:31 PM UTC, comment #3: 

This item has been reassigned from the project davfs2 support tracker to your tracker.

The original report is still available at support #108377

Following are the information included in the original report:

[field #0]                  Item ID: 108377
[field #1]                 Group ID: 10199
[field #2]              Open/Closed: Open
[field #3]                 Severity: 3 - Normal
[field #4]                  Privacy: Public
[field #7]                         : Unknown support Field Display Type
[field #8]                         : Unknown support Field Display Type
[field #9]                 Category: None
[field #10]             Submitted by: None
[field #11]              Assigned to: wbaumann
[field #12]             Submitted on: Do 29 Aug 2013 03:00:38 GMT
[field #13]                  Summary: User mount is rejected with "/sbin/mount.davfs: no entry for https://www.box.com/dav found in /etc/fstab"
[field #14]      Original Submission: Using davfs2-1.4.7-1.fc19.x86_64 under Fedora 19, I have an entry in /etc/fstab:

https://www.box.com/dav /home/worley/box.com    davfs   rw,user,noauto,uid=worley,gid=worley  0 0

When attempting to mount this as user worley, I get this error:

$ mount /home/worley/box.com
/sbin/mount.davfs: no entry for https://www.box.com/dav found in /etc/fstab
$

This message is particularly annoying because there obviously is an entry for https://www.box.com/dav in /etc/fstab.

[field #16]               Item Group: None
[field #17]                   Status: In Progress
[field #18]        Component Version: None
[field #19]         Operating System: GNU/Linux
[field #20]          Reproducibility: None
[field #21]               Size (loc): None
[field #22]            Fixed Release: None
[field #23]          Planned Release: None
[field #24]                   Effort: 0.00
[field #28]                 Priority: 5 - Normal
[field #31]         Percent Complete: 0%
[field #33]                  Release: None
[field #36]         Originator Email: worley@alum.mit.edu
[field #58]     Custom Select Box #1: None
[field #59]     Custom Select Box #2: None
[field #60]     Custom Select Box #3: None
[field #61]     Custom Select Box #4: None
[field #62]     Custom Select Box #5: None
[field #63]     Custom Select Box #6: None
[field #64]     Custom Select Box #7: None
[field #65]     Custom Select Box #8: None
[field #66]     Custom Select Box #9: None
[field #67]    Custom Select Box #10: None

- <_71007>
Thu 29 Aug 2013 08:32:12 PM UTC, comment #2: 

The /etc/fstab is attached as "fstab".  The lines from the systemd journal that contain "davfs" are attached as "journal.davfs".

The line from /etc/fstab is:
https://www.box.com/dav /home/worley/box.com    davfs   rw,user,noauto,uid=worley,gid=worley  0 0

The mount.davfs command is:
/sbin/mount.davfs https://www.box.com/dav /common/home/worley/box.com -o rw,noexec,nosuid,nodev,uid=1000,gid=1000,user

This reminds me to mention that on this system, /home is a symbolic link to /common/home, even though ~worley is /home/worley.  So it appears that "mount" is canonicalizing the mount directory to /common/home/worley, and giving that to mount.davfs, and mount.davfs is discovering that /etc/fstab does not list https://www.box.com/dav as mounted on /home/worley/box.com.

I have retried the command after editing /etc/fstab to give the mount point as /common/home/box.com, and that works.

This suggests to me the following ideas:

- The error message ("no entry for https://www.box.com/dav found in /etc/fstab") is not correct; what it should say is something like "no entry to mount https://www.box.com/dav on /common/home/worley found in /etc/fstab".

- There is a design question regarding mount point directories that can be named in several ways.  It appears that a previous version of "mount" did not canonicalize the mount point, because the scenario in the original submission worked with it.  The current (Fedora 19) "mount" appears to canonicalize the mount point.  /etc/fstab must name the mount point in the way that mount.davfs will receive it.

Perhaps a better approach would be for mount.davfs to search /etc/fstab for all entries containing the specified WebDAV URL, and then using stat(2) to check if the mount point listed in the line is the same directory (same st_dev and st_ino) as the mount point in the mount.davfs command line.


(file #28955, file #28956)

Anonymous
Thu 29 Aug 2013 07:14:17 PM UTC, comment #1: 

I can't reproduce this here.

There are two possible reasons:

  • The mounting user can't read /etc/fstab. Please check the access bits.


  • There is something in /etc/fstab that confuses davfs2. Please check your log files. There should be an entry starting with "mount.davfs:" that shows the command line (probably beginning wiith "/sbin/mount.davfs ..."). I would need an exact copy of this entry as well as an exact copy of the fstab-entry. Without any character conversion or any other changes.


Werner

- <_71007>
Sun 02 Feb 2014 05:40:31 PM UTC, original submission:  

Using davfs2-1.4.7-1.fc19.x86_64 under Fedora 19, I have an entry in /etc/fstab:

https://www.box.com/dav /home/worley/box.com    davfs   rw,user,noauto,uid=worley,gid=worley  0 0

When attempting to mount this as user worley, I get this error:

$ mount /home/worley/box.com
/sbin/mount.davfs: no entry for https://www.box.com/dav found in /etc/fstab
$

This message is particularly annoying because there obviously is an entry for https://www.box.com/dav in /etc/fstab.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #30831:  diff added by worley (5KiB - application/octet-stream - Suggested changes to mount_davfs.c to allow mountpoints to be specified by names with symlinks.)
file #30832:  mount_davfs.c added by worley (85KiB - text/x-csrc - Suggested changes to mount_davfs.c to allow mountpoints to be specified by names with symlinks.)
file #30826:  SCRIPT1.txt added by worley (5KiB - text/plain - File version of comment #4.)
file #28955:  fstab added by None (2KiB - application/octet-stream)
file #28956:  journal.davfs added by None (1KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by worley (Posted a comment)
  • -email is unavailable- added by _71007 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-04-22 _71007 Open/ClosedOpen Closed
    2014-03-12 _71007 StatusConfirmed Fixed
    2014-03-09 worley Attached File- Added diff, #30831
        Attached File- Added mount_davfs.c, #30832
    2014-03-07 worley Attached File- Added SCRIPT1.txt, #30826
    2014-02-02 _71007 StatusNone Confirmed
        Assigned toNone _71007
        SummaryUser mount is rejected with &quot;/sbin/mount.davfs: no entry for https://www.box.com/dav found in /etc/fstab&quot; Always canonicalize mountpoint
    2014-02-02 _71007 Reassign itemdavfs2, sr #108377 davfs2, bug #41437

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code