All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gordon Lack" <gml4410@ggr.co.uk>
To: autofs@linux.kernel.org
Subject: Bug (and patch) in autofs init.d script (v4.1.4)
Date: Tue, 22 Aug 2006 15:03:11 +0100	[thread overview]
Message-ID: <44EB0E9E.1B101F71@ggr.co.uk> (raw)
In-Reply-To: 44AE7785.74E63D70@ggr.co.uk

[-- Attachment #1: Type: text/plain, Size: 866 bytes --]

    When comparing the running vs. expected commands for "autofs reload"
the autofs init.d script dosn't correctly handle changes to options. 
eg: If the LOCALOPTIONS have been extended it will not issue a Stop for
a running automount point, but will issue a Start for the new command
(which will fial, as the current process hasn't been stopped).  This is
because it is just doing a start-of-line anchored grep for a command.

    The attached patch fixes this by obtaining the full runnning command
for the particular mountpoint of interest and comparing this (verbatim)
against what it is expecting to see.  This allows for changes to the
options.

    It does assume that the automount point will be the second token
starting with a '/' in a full automount command line (the automount
command being the first such token).  I believe this will always be the
case.

[-- Attachment #2: bug.patch --]
[-- Type: text/plain, Size: 1281 bytes --]

--- autofs-4.1.4/samples/rc.autofs.in	2006-08-22 14:48:51.000000000 +0100
+++ autofs.bug	2006-08-22 14:52:02.000000000 +0100
@@ -562,7 +562,14 @@
 	ps axwww|grep "[0-9]:[0-9][0-9] $DAEMON " | (
 	    while read pid tt stat time command; do
 		echo "$command" >>$TMP2
-		if ! grep -q "^$command" $TMP1; then
+#   In order to check for changes we need to find the line, if any,
+# corresponding to this mountpoint with *any* options and see whether
+# it is what we want...this allows for changing options.
+# 
+#		if ! grep -q "^$command" $TMP1; then
+                mpoint=`get_fpath2 $command`
+                mpoint_com=`grep " $mpoint " $TMP1`
+                if [ "$command" !=  "$mpoint_com" ]; then
 		    if ! echo "$command" | grep -q -e --submount; then
 			kill -USR2 $pid 2> /dev/null
 			echo $"Stop $command"
@@ -574,7 +581,14 @@
 	    done
 	)
 	cat $TMP1 | ( while read x; do
-		if ! grep -q "^$x" $TMP2; then
+#   Again - we can't rely on the options being unchanged, so get the
+# command for this mountpoint and check it is there verbatim
+#
+#		if ! grep -q "^$x" $TMP2; then
+#
+                mpoint=`get_fpath2 $x`
+                mpoint_com=`grep " $mpoint " $TMP2`
+                if [ "$x" !=  "$mpoint_com" ]; then
 			$x
 			echo $"Start $x"
 		fi

[-- Attachment #3: Type: text/plain, Size: 140 bytes --]

_______________________________________________
autofs mailing list
autofs@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/autofs

  parent reply	other threads:[~2006-08-22 14:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-07 15:02 -hosts and -null enabling for autofs v4.1.x Gordon Lack
2006-07-13 13:10 ` Ian Kent
2006-07-13 13:42 ` Jeff Moyer
2006-07-14 11:33   ` Gordon Lack
2006-07-14 13:31     ` Jeff Moyer
2006-07-14 15:58       ` Gordon Lack
2006-08-07  6:56         ` Ian Kent
2006-08-22 14:03 ` Gordon Lack [this message]
2006-08-22 14:18 ` Enhancement patch for autofs v4.1.4 init.d script Gordon Lack
2006-09-08 11:31   ` Bug in autofs v4.1.4 init.d script (and fix) Gordon Lack
2006-09-12 12:58     ` Bug in autofs v4.1.4 init.d script for reload " Gordon Lack
2006-09-13  9:42       ` Gordon Lack
2006-11-10 11:58 ` autofsv5 bug. Non-existent dirs get "mounted"! Gordon Lack
2006-11-10 12:05   ` autofsv5 enhancement - map names in /proc/mounts Gordon Lack
2006-11-10 17:33     ` autofsv5 - mouting files (not dirs) Gordon Lack
2006-11-11  2:58       ` Ian Kent
2006-11-11  2:53     ` autofsv5 enhancement - map names in /proc/mounts Ian Kent
2006-11-13 10:09       ` Gordon Lack
2006-11-13 15:44         ` Ian Kent
2006-11-13 16:58           ` Gordon Lack
2006-11-14  2:00             ` Ian Kent
2006-11-14 10:00               ` Gordon Lack
2006-11-14 11:42                 ` Ian Kent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44EB0E9E.1B101F71@ggr.co.uk \
    --to=gml4410@ggr.co.uk \
    --cc=autofs@linux.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.