mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, Daniel Mack <daniel@zonque.org>
Subject: [PATCH] kbuild: fix usage with directories containing '.o'
Date: Fri, 5 Mar 2004 23:56:10 +0100	[thread overview]
Message-ID: <20040305225610.GA6644@mars.ravnborg.org> (raw)

From: Daniel Mack <daniel@zonque.org>, me

modpost unconditionally searched for ".o" assuming this is always
the suffix of the module. This fails in two cases:
a) when building external modules where any
   directory include ".o" in the name.
   One example is a directory named: .../cvs.alsa.org/...
b) when someone names a kernel directory so it contains ".o".
   One example is drivers/scsi/aic.ok/...

case b) was triggered by renaming the directory for aic7xxx, and
modifying Makefile and Kconfig. This caused make modules to fail.

	Sam

kbuild-fix-modpost.patch:
===== scripts/modpost.c 1.19 vs edited =====
--- 1.19/scripts/modpost.c	Fri Feb 27 06:33:07 2004
+++ edited/scripts/modpost.c	Fri Mar  5 23:42:26 2004
@@ -64,17 +64,20 @@
 {
 	struct module *mod;
 	char *p;
+	size_t len;
 	
 	mod = NOFAIL(malloc(sizeof(*mod)));
 	memset(mod, 0, sizeof(*mod));
-	mod->name = NOFAIL(strdup(modname));
+	p = NOFAIL(strdup(modname));
 
-	/* strip trailing .o */
-	p = strstr(mod->name, ".o");
-	if (p)
-		*p = 0;
+	len = strlen(p);
 
+	/* strip trailing .o */
+	if (len > 2 && p[len-2] == '.' && p[len-1] == 'o')
+		p[len -2] = '\0';
+	
 	/* add to list */
+	mod->name = NOFAIL(strdup(p));	
 	mod->next = modules;
 	modules = mod;
 

                 reply	other threads:[~2004-03-05 22:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20040305225610.GA6644@mars.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=akpm@osdl.org \
    --cc=daniel@zonque.org \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®