[Bug 224601] autofs: Make automount(8) call chdir("/") before create_directory()

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Dec 26 18:06:14 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224601

            Bug ID: 224601
           Summary: autofs: Make automount(8) call chdir("/") before
                    create_directory()
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: kusumi.tomohiro at gmail.com

Created attachment 189116
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=189116&action=edit
Fixes the issue.

Unlike automountd where the daemon is daemonized or lesser-daemonized,
an automount process isn't necessarily at /, and this results in
creating unneeded directories at the current directory.

In the example below, mounting autofs on /mnt/media fails because the
command mkdirs mnt/media instead of /mnt/media. If /mnt/media already
exists the command can mount autofs on /mnt/media, but it still mkdirs
unneeded directories mnt/media.

Calling chdir("/") before creation and restoring the directory after
creation avoids this.

--
[root@]~# automount -L
/mnt/media                -nosuid               -media               # indirect
map referenced at /etc/auto_master:8
[root@]~# ls mnt
ls: mnt: No such file or directory
[root@]~# automount
automount: cannot mount map -media on /mnt/media: No such file or directory
[root@]~# mount | grep autofs
[root@]~# ls mnt
media
[root@]~# tree mnt
mnt
`-- media

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list