Bug 192947 - automountd(8) browsing a special map shows garbage on special characters
Summary: automountd(8) browsing a special map shows garbage on special characters
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Edward Tomasz Napierala
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-23 15:35 UTC by Jan Beich
Modified: 2014-09-02 17:10 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2014-08-23 15:35:52 UTC
automounted enforces indirect map syntax for a newline-based format of browse items. However, depending on filesystem media names may have whitespace or #-character embedded in them.

$ cat /etc/auto_master
/foo    -foo

$ cat /etc/autofs/special_foo
#! /bin/sh
if [ $# -eq 0 ]; then
  echo "Long Name foo#bar"
else
  case $1 in
    Long\ Name|foo#bar)
        echo "/ -fstype=nullfs :/bin"
    ;;
  esac
fi

$ ls -FR /foo
Long/ Name/ foo/

/foo/Long:

/foo/Name:

/foo/foo:

$ ls -1 /foo/Long\ Name
[
cat
chflags
chio
...

or a more real example in attachment 146087 [details]:

$ simple-mtpfs -l
1: VendorMyPhone XYZ (MTP)
2: AB-123 Another Phone L MTP+ADB

$ ls -FR /mtp
VendorMyPhone/ XYZ/ (MTP)/ AB-123/ Another/ Phone/ L/ MTP+ADB/

/foo/VendorMyPhone:

/foo/XYZ:
...
Comment 1 Jan Beich freebsd_committer freebsd_triage 2014-08-23 15:37:45 UTC
(In reply to Jan Beich from comment #0)
> if [ $# -eq 0 ]; then
>   echo "Long Name foo#bar"

Oops, this should be

if [ $# -eq 0 ]; then
  echo "Long Name"
  echo "foo#bar"
Comment 2 commit-hook freebsd_committer freebsd_triage 2014-08-24 12:32:45 UTC
A commit references this bug:

Author: trasz
Date: Sun Aug 24 12:32:27 UTC 2014
New revision: 270454
URL: http://svnweb.freebsd.org/changeset/base/270454

Log:
  Fix handling of keys in executable maps.  Previously it was broken for keys
  containing whitespace.

  PR:		192947
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/usr.sbin/autofs/common.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2014-08-31 21:57:09 UTC
A commit references this bug:

Author: trasz
Date: Sun Aug 31 21:56:42 UTC 2014
New revision: 270903
URL: http://svnweb.freebsd.org/changeset/base/270903

Log:
  MFC r270454:

  Fix handling of keys in executable maps.  Previously it was broken for keys
  containing whitespace.

  PR:		192947
  Sponsored by:	The FreeBSD Foundation

Changes:
_U  stable/10/
  stable/10/usr.sbin/autofs/common.c