Bug 132459 - [PATCH] Minor bug in boot script for autofs
[PATCH] Minor bug in boot script for autofs
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: autofs (Show other bugs)
3.0
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Chris Feist
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-09-13 13:17 EDT by Paul Heffner
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version: 4.1.3-47
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-02-27 12:35:31 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patched autofs script (11.69 KB, text/plain)
2004-09-13 13:26 EDT, Paul Heffner
no flags Details

  None (edit)
Description Paul Heffner 2004-09-13 13:17:55 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616

Description of problem:
The boot script for autofs (/etc/rc.d/init.d/autofs) implements a
function, 'getmounts' which has code that is intended to screen
duplicate mount points to avoid spawning multiple autofs processes
for the same mount point. This code is broken. It is implemented with
the following code at line 161:
    -a "`echo "$knownmaps" | grep '\<'$dir/`" = "" ]

which looks for the directory in a saved vector of already found maps.
According to the man page for 'grep' the '\<' which is prepended to
the directory name is supposed to do the following:
"The symbols \< and \> respectively match the empty string at the
beginning and end of a word." This apparently doesn't work...
Evidently grep isn't working as advertised.

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

How reproducible:
Always

Steps to Reproduce:
1.Add mount points to /etc/auto.master which already exist in NIS.
2.Ensure the entry for automount in /etc/nsswitch says:
automount:  files nis
3.Start autofs 'service autofs start'

Actual Results:  # service autofs status
Configured Mount Points:
------------------------
/usr/sbin/automount --timeout=60 --ghost /home yp auto.home
rsize=8192,wsize=819 2,tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /devl yp auto.devl
rsize=8192,wsize=819 2,tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /build yp auto.build
rsize=8192,wsize=8 192,tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /group yp auto.group
rsize=8192,wsize=8 102,tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /mis yp auto.mis
rsize=8192,wsize=8102, tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /products yp auto.products
rsize=8192,w size=8102,tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /hardwire yp auto.hardwire
rsize=8192,w size=8102,tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /regres yp auto.regres
rsize=8192,wsize =8102,tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /public yp auto.public
rsize=8192,wsize =8102,tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /proj yp auto.proj
rsize=8192,wsize=810 2,tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /web yp auto.web
rsize=8192,wsize=8192, tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /wrk yp auto.wrk
rsize=8192,wsize=8192, tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /usr/local file
/etc/auto_usr_local rsi ze=8192,wsize=8192,tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /tools file /etc/auto.tools
rsize=8192, wsize=8192,tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /setup yp auto.setup
rsize=8192,wsize=8 192,tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /ev2 file /etc/auto.ev2
rsize=8192,wsiz e=8192,tcp -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /usr/local file
/etc/auto_usr_local -rw ,soft,intr -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /products yp auto.products
-rw,soft,int r -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /hardwire yp auto.hardwire
-rw,soft,int r -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /archive yp auto.archive
-rw,soft,intr -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /regres yp auto.regres
-rw,soft,intr -D OSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /public yp auto.public
-rw,soft,intr -D OSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /tools file /etc/auto.tools
-rw,soft,in tr -DOSREL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /setup yp auto.setup
-rw,soft,intr -DOS REL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /group yp auto.group
-rw,soft,intr -DOS REL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /build yp auto.build
-rw,soft,intr -DOS REL=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /proj yp auto.proj
-rw,soft,intr -DOSRE L=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /home yp auto.home
-rw,soft,intr -DOSRE L=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /devl yp auto.devl
-rw,soft,intr -DOSRE L=2.4_tls
/usr/sbin/automount --timeout=60 --ghost /wrk yp auto.wrk
-rw,soft,intr -DOSREL= 2.4_tls
/usr/sbin/automount --timeout=60 --ghost /web yp auto.web
-rw,soft,intr -DOSREL= 2.4_tls
/usr/sbin/automount --timeout=60 --ghost /mis yp auto.mis
-rw,soft,intr -DOSREL= 2.4_tls
 


Expected Results:  Since we're overriding most of the maps in NIS with
entries in
/etc/auto.master, we should only be seeing the mountpoints once,
instead we have two of each. 

Additional info:
Comment 1 Paul Heffner 2004-09-13 13:26:28 EDT
Created attachment 103794 [details]
Patched autofs script

File is patched autofs script, a context diff looks like:
144c144
<	knownmaps=( )
---
>	knownmaps=" "
159,162d158
<	     # screen dups by keeping an array
<	     tmpmaps=( ${knownmaps[@]/$dir/} ) # copy array, del $dir if there
<	     [ "${#tmpmaps[@]}" -lt "${#knownmaps[@]}" ] && continue
<
164c160,161
<			-a x`echo "$map" | cut -c1` != 'x-' ]
---
>			-a x`echo "$map" | cut -c1` != 'x-' \
>			-a "`echo "$knownmaps" | grep '\<'$dir/`" = "" ]
249c246
<	      knownmaps[${#knownmaps[@]}]=$dir;   # add dir to end of array
---
>	    knownmaps=" $dir/ $knownmaps"
Comment 2 Jeffrey Moyer 2004-09-20 15:38:20 EDT
Thanks for the bug report.  Please post patches in unified diff format
only, please.  Also post them as attachments, since I can't
cut-n-paste from the mangled bugzilla versions.

What version of grep are you using, and did you file a bug against it
as well?
Comment 3 Chris Feist 2004-11-01 18:58:10 EST
This bug has been fixed in autofs-4.1.3-26

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