lkml.org 
[lkml]   [2010]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/2] namespace.pl: fix source tree name mangling
On Wed, Sep 29, 2010 at 02:11:53PM +0900, Stephen Hemminger wrote:
>On Wed, 29 Sep 2010 12:31:12 +0800
>Américo Wang <xiyou.wangcong@gmail.com> wrote:
>
>> On Tue, Sep 28, 2010 at 05:44:02PM +0900, Stephen Hemminger wrote:
>> >The current namespace.pl script does not find source files correctly.
>> >The problem is that the current directory is not the base of the kernel
>> >tree at the point where it calls objdump.
>> >
>> >Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>> >
>> >--- a/scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900
>> >+++ b/scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900
>> >@@ -167,8 +167,10 @@ sub do_nm
>> > printf STDERR "$fullname is not an object file\n";
>> > return;
>> > }
>> >- ($source = $fullname) =~ s/\.o$//;
>> >- if (-e "$objtree$source.c" || -e "$objtree$source.S") {
>> >+ $fullname =~ s/\.o$//;
>> >+ $source = $basename;
>> >+ $source =~ s/\.o$//;
>>
>> With your patch applied, $source will be the basename of
>> an obj path with .o stripped.
>>
>> >+ if (-e "$objtree$fullname.c" || -e "$objtree$fullname.S") {
>> > $source = "$objtree$source";
>> > } else {
>> > $source = "$srctree$source";
>> >
>>
>> So here we will get a non-exist path stored in $source.
>>
>> Are you serious? What problem did you meet? I see no problem
>> with the original code here.
>
>The original script is broken, if you run it on a compiled
>kernel tree.
>
>No source file found for arch/x86/boot/a20.o
>No source file found for arch/x86/boot/bioscall.o
>No source file found for arch/x86/boot/cmdline.o
>No source file found for arch/x86/boot/copy.o
>No source file found for arch/x86/boot/cpucheck.o
>No source file found for arch/x86/boot/early_serial_console.o
>No source file found for arch/x86/boot/edd.o
>No source file found for arch/x86/boot/main.o
>No source file found for arch/x86/boot/mca.o
>No source file found for arch/x86/boot/memory.o
>No source file found for arch/x86/boot/pm.o
>No source file found for arch/x86/boot/pmjump.o
>No source file found for arch/x86/boot/printf.o
>
>...
>
>Running under perl debugger shows that the script has
>done chdir prior to the failing test:
>

I see, the docs of Find module said it will do chdir. :)
But I think your patch is still not right, how about the
one below?

------------------>

File::Find will do chdir, so using a relative patch is
not correct. Use an absolute patch instead.


Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>

diff --git a/scripts/namespace.pl b/scripts/namespace.pl
index 361d0f7..fb4e245 100755
--- a/scripts/namespace.pl
+++ b/scripts/namespace.pl
@@ -167,11 +167,11 @@ sub do_nm
printf STDERR "$fullname is not an object file\n";
return;
}
- ($source = $fullname) =~ s/\.o$//;
- if (-e "$objtree$source.c" || -e "$objtree$source.S") {
- $source = "$objtree$source";
+ ($source = $basename) =~ s/\.o$//;
+ if (-e "$source.c" || -e "$source.S") {
+ $source = "$objtree$File::Find::dir/$source";
} else {
- $source = "$srctree$source";
+ $source = "$srctree$File::Find::dir/$source";
}
if (! -e "$source.c" && ! -e "$source.S") {
# No obvious source, exclude the object if it is conglomerate
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-09-29 09:51    [W:0.097 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site