autofs cannot mount remote directory path with space

Bug #306369 reported by Mike
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
autofs (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

Binary package hint: autofs

System info:
Description: Ubuntu 8.04.1
Release: 8.04
autofs:
  Installed: 4.1.4+debian-2.1ubuntu1
  Candidate: 4.1.4+debian-2.1ubuntu1
  Version table:
 *** 4.1.4+debian-2.1ubuntu1 0
        500 http://us.archive.ubuntu.com hardy/main Packages
        100 /var/lib/dpkg/status

Autofs fails to mount a remote file system if the remote path contains a space. On the remote NFS server, syslog reports that it can't stat exported dir and then prints the requested remote path ending at (before) the space. There is no way to use autofs to mount a remote directory containing a space through any combination of quoting or escaping. Using command-line "mount" command works fine when the remote path is quoted. Autofs calls the "mount" command for the actual mounting operation, so the problem is in autofs's preparation of the remote path argument to "mount".

Cause: in autofs source file mount_nfs.c, in function get_best_mount(), remote path is copied until space or end of string. If the remote path contains a space, the string is terminated before the space. This shortened string is then passed to the "mount" program as the remote path to be mounted on the local mount point.

To duplicate:
1) Export a file system on the remote system, and make a directory underneath the top level of the exported file system that contains a space. Example:
remote% cat /etc/exports
/export

remote% mkdir "/export/data/path with space"

2) On the local system, set up an automount map that maps to the remote file system, and start autofs. Mount map example:

local% cat /etc/auto.master
/data /etc/auto.data defaults,intr

local%cat /etc/auto.data
* remote:/export/data/&

3) Attempt to access the local path:
local% ls "/data/path with space"
/bin/ls: cannot access /data/path with space: No such file or directory

On the remote machine's syslog:
Dec 8 16:25:24 remote nss_wins[801]: can't stat exported dir /export/data/path: No such file or directory

Revision history for this message
Chuck Short (zulcss) wrote :

Hi,

I was wondering if you were still having this problem?

Thanks
chuck

Changed in autofs (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
Mike (mike-kleinnet) wrote : Re: [Bug 306369] Re: autofs cannot mount remote directory path with space

Yes, I am still having the same problem. I just confirmed it, running
fully updated 8.04.3 on both NFS client and server. It's quite clear
from the source code what the problem is.

  -Mike

On Oct 13, 2009, at 11:00 AM, Chuck Short wrote:

> Hi,
>
> I was wondering if you were still having this problem?
>
> Thanks
> chuck
>
> ** Changed in: autofs (Ubuntu)
> Importance: Undecided => Low
>
> ** Changed in: autofs (Ubuntu)
> Status: New => Incomplete
>
> --
> autofs cannot mount remote directory path with space
> https://bugs.launchpad.net/bugs/306369
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “autofs” package in Ubuntu: Incomplete
>
> Bug description:
> Binary package hint: autofs
>
> System info:
> Description: Ubuntu 8.04.1
> Release: 8.04
> autofs:
> Installed: 4.1.4+debian-2.1ubuntu1
> Candidate: 4.1.4+debian-2.1ubuntu1
> Version table:
> *** 4.1.4+debian-2.1ubuntu1 0
> 500 http://us.archive.ubuntu.com hardy/main Packages
> 100 /var/lib/dpkg/status
>
>
> Autofs fails to mount a remote file system if the remote path
> contains a space. On the remote NFS server, syslog reports that it
> can't stat exported dir and then prints the requested remote path
> ending at (before) the space. There is no way to use autofs to
> mount a remote directory containing a space through any combination
> of quoting or escaping. Using command-line "mount" command works
> fine when the remote path is quoted. Autofs calls the "mount"
> command for the actual mounting operation, so the problem is in
> autofs's preparation of the remote path argument to "mount".
>
> Cause: in autofs source file mount_nfs.c, in function
> get_best_mount(), remote path is copied until space or end of
> string. If the remote path contains a space, the string is
> terminated before the space. This shortened string is then passed
> to the "mount" program as the remote path to be mounted on the local
> mount point.
>
> To duplicate:
> 1) Export a file system on the remote system, and make a directory
> underneath the top level of the exported file system that contains a
> space. Example:
> remote% cat /etc/exports
> /export
>
> remote% mkdir "/export/data/path with space"
>
> 2) On the local system, set up an automount map that maps to the
> remote file system, and start autofs. Mount map example:
>
> local% cat /etc/auto.master
> /data /etc/auto.data defaults,intr
>
> local%cat /etc/auto.data
> * remote:/export/data/&
>
> 3) Attempt to access the local path:
> local% ls "/data/path with space"
> /bin/ls: cannot access /data/path with space: No such file or
> directory
>
> On the remote machine's syslog:
> Dec 8 16:25:24 remote nss_wins[801]: can't stat exported dir /
> export/data/path: No such file or directory
>

Revision history for this message
Chuck Short (zulcss) wrote :

Hi Mike,

Patches are always welcome.

Thanks
chuck

Changed in autofs (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Mike (mike-kleinnet) wrote :

Hi Chuck, I am definitely not able write a patch in any sense.... I
can read the code but figuring out what to do to fix and test it in
the context of the whole program and OS is another issue entirely!

  -Mike

On Oct 13, 2009, at 11:38 AM, Chuck Short wrote:

> Hi Mike,
>
> Patches are always welcome.
>
> Thanks
> chuck
>
> ** Changed in: autofs (Ubuntu)
> Status: Incomplete => Confirmed
>
> --
> autofs cannot mount remote directory path with space
> https://bugs.launchpad.net/bugs/306369
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “autofs” package in Ubuntu: Confirmed
>
> Bug description:
> Binary package hint: autofs
>
> System info:
> Description: Ubuntu 8.04.1
> Release: 8.04
> autofs:
> Installed: 4.1.4+debian-2.1ubuntu1
> Candidate: 4.1.4+debian-2.1ubuntu1
> Version table:
> *** 4.1.4+debian-2.1ubuntu1 0
> 500 http://us.archive.ubuntu.com hardy/main Packages
> 100 /var/lib/dpkg/status
>
>
> Autofs fails to mount a remote file system if the remote path
> contains a space. On the remote NFS server, syslog reports that it
> can't stat exported dir and then prints the requested remote path
> ending at (before) the space. There is no way to use autofs to
> mount a remote directory containing a space through any combination
> of quoting or escaping. Using command-line "mount" command works
> fine when the remote path is quoted. Autofs calls the "mount"
> command for the actual mounting operation, so the problem is in
> autofs's preparation of the remote path argument to "mount".
>
> Cause: in autofs source file mount_nfs.c, in function
> get_best_mount(), remote path is copied until space or end of
> string. If the remote path contains a space, the string is
> terminated before the space. This shortened string is then passed
> to the "mount" program as the remote path to be mounted on the local
> mount point.
>
> To duplicate:
> 1) Export a file system on the remote system, and make a directory
> underneath the top level of the exported file system that contains a
> space. Example:
> remote% cat /etc/exports
> /export
>
> remote% mkdir "/export/data/path with space"
>
> 2) On the local system, set up an automount map that maps to the
> remote file system, and start autofs. Mount map example:
>
> local% cat /etc/auto.master
> /data /etc/auto.data defaults,intr
>
> local%cat /etc/auto.data
> * remote:/export/data/&
>
> 3) Attempt to access the local path:
> local% ls "/data/path with space"
> /bin/ls: cannot access /data/path with space: No such file or
> directory
>
> On the remote machine's syslog:
> Dec 8 16:25:24 remote nss_wins[801]: can't stat exported dir /
> export/data/path: No such file or directory
>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.