Skip to contentSkip to conversation

current Debian delta for 4.1.3

PATCH Arthur Korn 1 participant 1 message Sep 27, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi

In the hopes that some of these might be helpful (and I won't have to merge them for future releases *g*) here the commented patches I'm applying to the debian package. I think I posted some of them already, I hope you don't mind if I just post them again.

sorting was made locale-robust, showmount is located in sbin on debian, using a PATH would be preferable IMHO

samples/auto.net renamed from samples/auto.net~ +3 -3
@@ -9,7 +9,7 @@
 
 # add "nosymlink" here if you want to suppress symlinking local filesystems
 # add "nonstrict" to make it OK for some filesystems to not mount
-opts="-fstype=nfs,hard,intr,nodev,nosuid"
+opts="-fstype=nfs,hard,intr,nodev,nosuid,nonstrict,rsize=8192,wsize=8192,async"
 
 # Showmount comes in a number of names and varieties.  "showmount" is
 # typically an older version which accepts the '--no-headers' flag
@@ -19,9 +19,9 @@
 #SHOWMOUNT="showmount -e $key | tail +2"
 
 # Newer distributions get this right
-SHOWMOUNT="/usr/sbin/showmount --no-headers -e $key"
+SHOWMOUNT="/sbin/showmount --no-headers -e $key"
 
-$SHOWMOUNT | sort +0 | \
+$SHOWMOUNT | LC_ALL=C sort +0 | \
 	awk -v key="$key" -v opts="$opts" -- '
 	BEGIN		{ ORS=""; first=1 }
 			{ if (first) { print opts; first=0 }; print " \\\n\t" $1, key ":" $1 }

Document the +map syntax for file based auto.master (this is old style analoguous to what can be done in passwd instead of using nsswitch).

man/autofs.8.in +9 -6
diff -ruN -x Makefile.in -x configure autofs-3.1.7.orig/man/autofs.8.in autofs-3.1.7/man/autofs.8.in
@@ -31,13 +31,16 @@
 process is started with the appropriate parameters. You can check the
 active mount points for the automounter with the
 .B @@INIT.D@@/autofs status
-command. After the
+command. If the
 .I auto.master
-configuration file is processed the
-.B autofs
-script will check for an NIS map with the same name. If such a map exists
-then that map will be processed in the same way as the auto.master map. The
-NIS map will be processed last.
+configuration file contains a line of the form
+.P
+.I +map
+.B [options]
+.P
+then the script will check for an NIS map with the same name.  If such a
+map exists then that map will be processed in the same way as the
+auto.master map, with any optional arguments.
 .P
 .B @@INIT.D@@/autofs reload
 will check the current auto.master map against running daemons. It will kill

Document -D options

man/automount.8 +3 -0
diff -ruN -x Makefile.in -x configure autofs-4.0.0pre10.orig/man/automount.8 autofs-4.0.0pre10/man/automount.8
@@ -22,6 +22,9 @@
 The filesystems are then autounmounted after a period of inactivity.
 .SH OPTIONS
 .TP
+.I "\-Dvariable=value"
+Replace \fIvariable\fP with \fIvalue\fP in map substitutions.
+.TP
 .I "\-p, \-\-pid-file"
 Write the pid of the daemon to the specified file.
 .TP

remove trailing slash (http://bugs.debian.org/141775) in AFS mounts

modules/mount_afs.c renamed from modules/mount_afs.c.orig +4 -0
@@ -39,6 +39,10 @@
 	strncat(dest, "/", sizeof(dest));
 	strncat(dest, name, sizeof(dest));
 
+	/* remove trailing slash (http://bugs.debian.org/141775) */
+	if (dest[strlen(dest)-1] == '/')
+	    dest[strlen(dest)-1] = '\0';
+
 	debug(MODPREFIX "mounting AFS %s -> %s", dest, what);
 
 	return symlink(what, dest);	/* Try it.  If it fails, return the error. */

Crude support for hesiod priorities.

modules/lookup_hesiod.c renamed from modules/lookup_hesiod.c.orig +22 -3
@@ -9,6 +9,7 @@
 
 #include <sys/types.h>
 #include <ctype.h>
+#include <limits.h>
 #include <string.h>
 #include <syslog.h>
 #include <unistd.h>
@@ -70,6 +71,8 @@ int lookup_mount(const char *root, const
 	char **hes_result;
 	struct lookup_context *ctxt = (struct lookup_context *) context;
 	int rv;
+	char **record, *best_record = NULL, *p;
+	int priority, lowest_priority = INT_MAX;	
 
 	debug(MODPREFIX "looking up root=\"%s\", name=\"%s\"", root, name);
 
@@ -78,14 +81,30 @@ int lookup_mount(const char *root, const
 
 	hes_result = hes_resolve(name, "filsys");
 
-	if (!hes_result) {
+	if (!hes_result || !hes_result[0]) {
 		warn(MODPREFIX "entry \"%s\" not found in map\n", name);
 		return 1;
 	}
 
-	debug(MODPREFIX "lookup for \"%s\" gave \"%s\"", name, hes_result[0]);
+	/* autofs doesn't support falling back to alternate records, so just
+	   find the record with the lowest priority and hope it works.
+	   -- Aaron Ucko <[email protected]> 2002-03-11 */
+	for (record = hes_result; *record; ++record) {
+	    p = strrchr(*record, ' ');
+	    if ( p && isdigit(p[1]) ) {
+		priority = atoi(p+1);
+	    } else {
+		priority = INT_MAX - 1;
+	    }
+	    if (priority < lowest_priority) {
+		lowest_priority = priority;
+		best_record = *record;
+	    }
+	}
 
-	rv = ctxt->parser->parse_mount(root, name, name_len, hes_result[0],
+	debug(MODPREFIX "lookup for \"%s\" gave \"%s\"", name, best_record);
+
+	rv = ctxt->parser->parse_mount(root, name, name_len, best_record,
 				       ctxt->parser->context);
 	free(hes_result);
 	return rv;

Fix calls to mount without options.

modules/mount_changer.c renamed from modules/mount_changer.c.orig +1 -1
@@ -94,7 +94,7 @@
 	}
 
 	wait_for_lock();
-	if (options) {
+	if (options && options[0]) {
 		debug(MODPREFIX "calling mount -t %s " SLOPPY "-o %s %s %s",
 		    fstype, options, what, fullpath);
 
modules/mount_ext2.c renamed from modules/mount_ext2.c.orig +1 -1
@@ -73,7 +73,7 @@
 		return 0;
 	}
 
-	if (options) {
+	if (options && options[0]) {
 		for (p = options; (p1 = strchr(p, ',')); p = p1)
 			if (!strncmp(p, "ro", p1 - p) && ++p1 - p == sizeof("ro"))
 				ro = 1;
modules/mount_generic.c renamed from modules/mount_generic.c.orig +1 -1
@@ -72,7 +72,7 @@
 	}
 
 	wait_for_lock();
-	if (options) {
+	if (options && options[0]) {
 		debug(MODPREFIX "calling mount -t %s " SLOPPY "-o %s %s %s",
 		      fstype, options, what, fullpath);
 

Program mounts repeated last character of map output.

modules/lookup_program.c +1 -0
diff -ruN autofs-4.1.3.orig/modules/lookup_program.c autofs-4.1.3/modules/lookup_program.c
@@ -159,6 +159,7 @@
 			if (read(pipefd[0], &ch, 1) < 1) {
 				FD_CLR(pipefd[0], &ourfds);
 				files_left--;
+				state = st_done;
 			}
 
 			if (!quoted && ch == '\\') {

Make should fail if a child of it fails.

Makefile +6 -6
diff -ruN autofs-4.1.3.orig/Makefile autofs-4.1.3/Makefile
@@ -13,26 +13,26 @@
 all:	daemon samples
 
 daemon:
-	for i in $(SUBDIRS); do $(MAKE) -C $$i all; done 
+	set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i all; done 
 
 kernel:
-	if [ -d kernel ]; then $(MAKE) -C kernel all; fi
+	set -e; if [ -d kernel ]; then $(MAKE) -C kernel all; fi
 
 samples:
-	if [ -d samples ]; then $(MAKE) -C samples all; fi
+	set -e; if [ -d samples ]; then $(MAKE) -C samples all; fi
 
 clean:
 	for i in $(SUBDIRS) samples kernel; do \
 		if [ -d $$i ]; then $(MAKE) -C $$i clean; fi; done 	
 
 install:
-	for i in $(SUBDIRS); do $(MAKE) -C $$i install; done 	
+	set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i install; done 	
 
 install_kernel:
-	if [ -d kernel ]; then $(MAKE) -C kernel install; fi
+	set -e; if [ -d kernel ]; then $(MAKE) -C kernel install; fi
 
 install_samples:
-	if [ -d samples ]; then $(MAKE) -C samples install; fi
+	set -e; if [ -d samples ]; then $(MAKE) -C samples install; fi
 
 mrproper distclean: clean
 	find . -noleaf \( -name '*~' -o -name '#*' -o -name '*.orig' -o -name '*.rej' -o -name '*.old' \) -print0 | xargs -0 rm -f

This is a bit large now.
- load /etc/default/autofs on debian, allow it to override localoptions and daemonoptions (ie source it after setting them to default values). TIMEOUT is supported for compatibility with debian stable (it doesn't hurt to do it, so it's done).
- getschemes(): fall back on files if no automount entry is found in nsswitch.conf (backwards compatibility too).
- getmounts(): reorder handling of short-form map specifiers, check for file maps in /etc/ if no path specified, allow !program syntax. (backwards compatibility).
- make stop, restart and reload actions work again as they should. CRITICAL

As I proposed in other mail, I'd be interested in reducing rc.autofs to a script library with the generic stuff and leaving the actual init scripts to distributions and individuals. I will come up with something when the release is over and I got time.

samples/rc.autofs.in +104 -24

184 lines not on this page · raw message

Fix handling of --timeout: map options form master maps override $daemonoptions.

samples/rc.autofs.in +5 -8
@@ -187,14 +187,11 @@
 		# those particular options out.
 		: echo DAEMONOPTIONS OPTIONS $daemonoptions $options
 		startupoptions=
-		if echo "$daemonoptions" | grep -q -- '-t' ; then
-		    startupoptions="--timeout=$(echo $daemonoptions $options | \
-		      sed 's/.*--*t\(imeout\)*[ \t=]*\([0-9][0-9]*\).*$/\2/g')"
-		fi
-		# Override timeout in $daemonoptions with map $options
-		if echo "$options" | grep -q -- '-t' ; then
-		    startupoptions="--timeout=$(echo $daemonoptions $options | \
-		      sed 's/.*--*t\(imeout\)*[ \t=]*\([0-9][0-9]*\).*$/\2/g')"
+		if echo "$options $daemonoptions" | grep -q -- '-t' ; then
+		    # the first timout value in "$options $daemonoptions" is
+		    # the one that is taken.
+		    startupoptions="--timeout=$(echo $options $daemonoptions | \
+		      sed 's/^.?*--*t\(imeout\)*[ \t=]*\([0-9][0-9]*\).*$/\2/')"
 		fi
 		if echo "$daemonoptions $options" | grep -q -- '-g' ; then
 		    startupoptions="$startupoptions --ghost"

Fix reference to this mailinglist in manpage.

man/automount.8 +2 -2
diff -ruN autofs-4.1.3.orig/man/automount.8 autofs-4.1.3/man/automount.8
@@ -146,7 +146,7 @@
 The documentation leaves a lot to be desired.
 
 Please report other bugs along with a detailed description to
-<[email protected]>.  To join this mailing list, send a message
-with the line "subscribe autofs" to <[email protected]>.
+<[email protected]>. For instructions on how to join the list
+and for archives visit http://linux.kernel.org/mailman/listinfo/autofs
 .SH AUTHOR
 H. Peter Anvin <[email protected]>

HTH, 2ri

Signature · 5 lines
Secure email, spread GPG, clearsign all mail. http://www.gnupg.org
.
Nearly all men can stand adversity, but if you want to test a man's 
character, give him power.
 -- Abraham Lincoln

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs