fixes problems w/ duplicate maps in auto.master
PATCH 1/1 fixes problems w/ duplicate maps in auto.master
Ian,
This patch should replace the previous init-duplicate-map.patch I submitted last week.
The following patch contains fixes to prevent duplicate directories from being mapped on top of each other.
For example, if my auto.master looks like this.
/misc auto.misc
/misc/misc2 auto.misc2
The automounter will attempt to mount /misc/misc2 on top of the already mounted /misc and fail. There were also problems where the automounter thought that '/misc' was different than /misc/ which is also fixed.
Lastly, knownmaps is only added to if the map is not a duplicate. It wasn't being used anywhere else in the code and I don't think there is any reason to check new maps against maps that we know aren't valid.
Let me know if you don't agree or you thing something needs to be changed.
Thanks,
Chris
samples/rc.autofs.in renamed from samples/rc.autofs.in.init-duplicate-map2 +18 -2
@@ -159,12 +159,28 @@ # These checks screen out duplicates and skip over directories # where the map is '-'. # We can't do empty or direct host maps, so don't bother trying. + + # Strip trailing slashes from the dir line if it exists to aid + # in checking for duplicate maps + dir=`echo "$dir" | sed -e "s/\/*$//"` + if [ ! -z "$map" -a "$map" = "-hosts" ] ; then continue fi + + # Do not include a map if it is a duplicate, maps on top of + # another map or another map, maps on top of it. + for knownmap in $knownmaps + do + if [ "`echo $dir/ | grep ^$knownmap`" != "" \ + -o "`echo $knownmap | grep ^$dir/`" != "" \] + then + continue 2 + fi + done + if [ ! -z "$dir" -a ! -z "$map" \ -a x`echo "$map" | cut -c1` != 'x-' \ - -a "`echo "$knownmaps" | grep '\<'$dir/`" = "" ] then # If the options include a -t or --timeout, a -g or --ghost, # a -v or --verbose or a -d or --debug paramter, then pull
@@ -231,8 +247,8 @@ echo "$DAEMON $startupoptions $dir $maptype $map $mapoptions $localoptions" | sed -e 's/ / /g' -e 's/ */ /g' : echo ------------------------ - fi knownmaps=" $dir/ $knownmaps" + fi done ) }
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs
Ian Kent
maintainerQuoted 12 lines · Chris Feist
Ian,
This patch should replace the previous init-duplicate-map.patch I submitted last week.
The following patch contains fixes to prevent duplicate directories from being mapped on top of each other.
For example, if my auto.master looks like this.
/misc auto.misc
/misc/misc2 auto.misc2
Quoted 8 lines
The automounter will attempt to mount /misc/misc2 on top of the already mounted /misc and fail. There were also problems where the automounter thought that '/misc' was different than /misc/ which is also fixed.
Lastly, knownmaps is only added to if the map is not a duplicate. It wasn't being used anywhere else in the code and I don't think there is any reason to check new maps against maps that we know aren't valid.
Cool. I've known about this for ages but haven't tracked it down. I'll have a closer look at the patch and add it to the list as well.
Quoted 2 lines
Let me know if you don't agree or you thing something needs to be changed.
Will do.
Ian