linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.4.21] kernel fails to build in deeply nested directories
@ 2003-07-09  0:49 Bart Trojanowski
  0 siblings, 0 replies; only message in thread
From: Bart Trojanowski @ 2003-07-09  0:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitor-discuss, trivial

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

I ran into this when building the kernel in a directory whose path name
was quite long.  This is probably not a problem for most that build in
/usr/src/linux, but I was able to reproduce it when building a debian
kernel (that adds in about 40 characters on it's own) in my home
directory.

The error comes from bash telling me that ...

	scripts/mkdep -- `find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend

... generates a command line that exceeds bash's limit.

The fix is to allow mkdep to take the list of parameters on stdin and as
arguments.

The patch that follows, only changes the top level Makefile's dep-files
rule.

Regards,
Bart.


diff -ruN linux-2.4.21-org/Makefile linux-2.4.21/Makefile
--- linux-2.4.21-org/Makefile	2003-06-13 10:51:39.000000000 -0400
+++ linux-2.4.21/Makefile	2003-07-08 20:40:43.000000000 -0400
@@ -493,7 +493,7 @@
 ifdef CONFIG_MODVERSIONS
 	$(MAKE) update-modverfile
 endif
-	scripts/mkdep -- `find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend
+	find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print | scripts/mkdep --stdin > .hdepend
 	scripts/mkdep -- init/*.c > .depend
 
 ifdef CONFIG_MODVERSIONS
diff -ruN linux-2.4.21-org/scripts/mkdep.c linux-2.4.21/scripts/mkdep.c
--- linux-2.4.21-org/scripts/mkdep.c	2002-08-02 20:39:46.000000000 -0400
+++ linux-2.4.21/scripts/mkdep.c	2003-07-08 20:42:25.000000000 -0400
@@ -43,9 +43,9 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#define MAX_FILE_NAME_LEN 512
 
-
-char __depname[512] = "\n\t@touch ";
+char __depname[MAX_FILE_NAME_LEN] = "\n\t@touch ";
 #define depname (__depname+9)
 int hasdep;
 
@@ -531,6 +531,7 @@
 	fd = open(filename, O_RDONLY);
 	if (fd < 0) {
 		perror(filename);
+		exit(1);
 		return;
 	}
 
@@ -577,6 +578,7 @@
 {
 	int len;
 	const char *hpath;
+	int use_stdin = 0;
 
 	hpath = getenv("HPATH");
 	if (!hpath) {
@@ -598,6 +600,10 @@
 				add_path(*argv);
 			}
 		}
+		else if (strcmp(*argv, "--stdin") == 0) {
+			use_stdin = 1;
+			break;
+		}
 		else if (strcmp(*argv, "--") == 0) {
 			break;
 		}
@@ -605,24 +611,58 @@
 
 	add_path(hpath);	/* must be last entry, for config files */
 
-	while (--argc > 0) {
-		const char * filename = *++argv;
-		const char * command  = __depname;
-		g_filename = 0;
-		len = strlen(filename);
-		memcpy(depname, filename, len+1);
-		if (len > 2 && filename[len-2] == '.') {
-			if (filename[len-1] == 'c' || filename[len-1] == 'S') {
-			    depname[len-1] = 'o';
-			    g_filename = filename;
-			    command = "";
+	if (use_stdin) {
+		/* process entries passed in by stdin */
+
+		char buff[MAX_FILE_NAME_LEN];
+		char *line;
+
+		while ((line = fgets(buff, MAX_FILE_NAME_LEN, stdin))) {
+			char * filename = line;
+			const char * command  = __depname;
+			g_filename = 0;
+			len = strlen(filename);
+			while (isspace (filename[len-1])) {
+				len--;
+				filename[len]=0; 
+			}
+			memcpy(depname, filename, len+1);
+			if (len > 2 && filename[len-2] == '.') {
+				if (filename[len-1] == 'c' 
+						|| filename[len-1] == 'S') {
+				    depname[len-1] = 'o';
+				    g_filename = filename;
+				    command = "";
+				}
 			}
+			do_depend(filename, command);
+		}
+
+	} else {
+		/* process entries passed in by command line arguments */
+
+		while (--argc > 0) {
+			const char * filename = *++argv;
+			const char * command  = __depname;
+			g_filename = 0;
+			len = strlen(filename);
+			memcpy(depname, filename, len+1);
+			if (len > 2 && filename[len-2] == '.') {
+				if (filename[len-1] == 'c' 
+						|| filename[len-1] == 'S') {
+				    depname[len-1] = 'o';
+				    g_filename = filename;
+				    command = "";
+				}
+			}
+			do_depend(filename, command);
 		}
-		do_depend(filename, command);
 	}
+
 	if (len_precious) {
 		*(str_precious+len_precious) = '\0';
 		printf(".PRECIOUS:%s\n", str_precious);
 	}
 	return 0;
 }
+

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-07-09  0:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-09  0:49 [PATCH 2.4.21] kernel fails to build in deeply nested directories Bart Trojanowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).