Skip to contentSkip to conversation

Debian diff remaining in autofs 4.1.3

PATCH Arthur Korn 2 participants 3 messages Sep 4, 2004 – Sep 5, 2004

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

Hi

I'm the new Debian autofs Maintainer. As such, I had the privilege to merge 1092 lines of many small patches when updating to 4.1.3 ...

Here the updated patches that address issues that I couldn't see fixed otherwise.

Mount is called like this "mount -t fstype -o what fullpath" because options is allocated but empty.

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);
 

For program-maps, last character read from STDIN was being doubled (pretty strange experience).

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 == '\\') {

Add 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;

The comment says it.

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. */

Rather cosmetic: When there are errors in subdirectories on build, make will continue. I need this so build-daemons can't upload incomplete binary packages:

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

HTH, 2ri

Signature · 4 lines
Help securing email, spread GPG, clearsign all mail. http://www.gnupg.org
.
					/\ .__|_|_    ._ |/ _ ._._  
				       /--\|  |_| ||_||  |\(_)| | |

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

#1 lore raw
Quoted 5 lines · Arthur Korn

Hi

I'm the new Debian autofs Maintainer. As such, I had the privilege to merge 1092 lines of many small patches when updating to 4.1.3 ...

Ouch. I've worked on merging various Debian patches over time but haven't been very successful I'm afraid. So it`s great to have your help.

I've been considering changing from Gentoo to Debian on my Ultra 1 but have been dreading the packaging effort I'd have to do. While I like Gentoo the compiles I have to do to update just take to long.

Is there any way I can get hold of the soure package?

Are there any plans to add a kernel patch for 2.4 and possibly for early 2.6 kernels? Perhaps I could help with that.

Quoted 3 lines

Here the updated patches that address issues that I couldn't see fixed otherwise.

They look straight forward. I'll put them into 4.1.4.

Ian

#2 lore raw

Hi

Quoted 1 line · [email protected] schrieb:

Is there any way I can get hold of the soure package?

I've just uploaded it to experimental.

It is indeed experimental, since I didn't merge any init-script changes yet (I want to try to stick with your scripts as much as possible).

There are a couple of doc patches left too.

Quoted 2 lines

Are there any plans to add a kernel patch for 2.4 and possibly for early 2.6 kernels? Perhaps I could help with that.

Debian will ship recent 2.6 kernels in sarge (we can't change woody anymore).

Maybe the autofs4 patches have already been applied to our stock 2.4 kernels. If not, you could try to convince the kernel-image-2.4.27-i386 maintainers to integrate the patch in stock kernels, build a kernel-patch-autofs4 package (impractical, requires rebuild of entier kernel for this single module) or build your own autofs4-module(-source) kernel module package (which would be overkill IMHO).

HTH, 2ri

Signature · 8 lines
Help securing email, spread GPG, clearsign all mail. http://www.gnupg.org
.
The game was soon followed up by a round of "Alphabet Implementation" where
each employee took turns suggesting a different language, tool, methodology, or
approach to a new business requirement, vehemently disapproving of all other
ideas. This game awards double points for using an acronymn unknown by the rest
of the group, but imposes heavy penalties on making one up.
	    -- Bryan Douglas <[email protected]> on segfault.org

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