Re: [REVIEW for merge] kbuild updates including silence of section mismatch check
On Tue, Feb 05, 2008 at 11:38:49AM +0100, Geert Uytterhoeven wrote: > On Sat, 2 Feb 2008, Sam Ravnborg wrote: > > The most visible change is that I have made all the section mismatch > > go away and in the end of the build modpost report the number > > of section mismatch warnings and how to see detail. > > > > The typical output is now: > > > > modpost: Found 35 section mismatch(es). > > To see full details build your kernel with: > > 'make CONFIG_DEBUG_SECTION_MISMATCH=y' > > Can we get a `warning' string literal in that message, so I notice it when > grepping for compiler warnings? > > ... Ah, there already exists a warn() routine, so let's use it. > > Subject: modpost: Use warn() for announcing section mismatches Fair enough. Applied. Sam -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [REVIEW for merge] kbuild updates including silence of section mismatch check
On Sat, 2 Feb 2008, Sam Ravnborg wrote: > The most visible change is that I have made all the section mismatch > go away and in the end of the build modpost report the number > of section mismatch warnings and how to see detail. > > The typical output is now: > > modpost: Found 35 section mismatch(es). > To see full details build your kernel with: > 'make CONFIG_DEBUG_SECTION_MISMATCH=y' Can we get a `warning' string literal in that message, so I notice it when grepping for compiler warnings? ... Ah, there already exists a warn() routine, so let's use it. Subject: modpost: Use warn() for announcing section mismatches From: Geert Uytterhoeven <[EMAIL PROTECTED]> modpost: Use warn() for announcing section mismatches, for easy grepping for warnings in build logs. Also change an existing call from fprintf() to warn() while we're at it. Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]> --- scripts/mod/modpost.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1129,10 +1129,10 @@ static void report_sec_mismatch(const ch if (!sec_mismatch_verbose) return; - fprintf(stderr, "WARNING: %s(%s+0x%llx): Section mismatch in" - " reference from the %s %s%s to the %s %s:%s%s\n", -modname, fromsec, fromaddr, from, fromsym, from_p, - to, tosec, tosym, to_p); + warn("%s(%s+0x%llx): Section mismatch in reference from the %s %s%s " +"to the %s %s:%s%s\n", +modname, fromsec, fromaddr, from, fromsym, from_p, to, tosec, +tosym, to_p); switch (mismatch) { case TEXT_TO_INIT: @@ -1938,10 +1938,10 @@ int main(int argc, char **argv) if (dump_write) write_dump(dump_write); if (sec_mismatch_count && !sec_mismatch_verbose) - fprintf(stderr, "modpost: Found %d section mismatch(es).\n" - "To see full details build your kernel with:\n" - "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", - sec_mismatch_count); + warn("modpost: Found %d section mismatch(es).\n" +"To see full details build your kernel with:\n" +"'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", +sec_mismatch_count); return err; } With kind regards, Geert Uytterhoeven Software Architect Sony Network and Software Technology Center Europe The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium Phone:+32 (0)2 700 8453 Fax: +32 (0)2 700 8622 E-mail: [EMAIL PROTECTED] Internet: http://www.sony-europe.com/ Sony Network and Software Technology Center Europe A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 0413.825.160 · RPR Brussels Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
Re: [REVIEW for merge] kbuild updates including silence of section mismatch check
On Sat, 2 Feb 2008, Sam Ravnborg wrote: The most visible change is that I have made all the section mismatch go away and in the end of the build modpost report the number of section mismatch warnings and how to see detail. The typical output is now: modpost: Found 35 section mismatch(es). To see full details build your kernel with: 'make CONFIG_DEBUG_SECTION_MISMATCH=y' Can we get a `warning' string literal in that message, so I notice it when grepping for compiler warnings? ... Ah, there already exists a warn() routine, so let's use it. Subject: modpost: Use warn() for announcing section mismatches From: Geert Uytterhoeven [EMAIL PROTECTED] modpost: Use warn() for announcing section mismatches, for easy grepping for warnings in build logs. Also change an existing call from fprintf() to warn() while we're at it. Signed-off-by: Geert Uytterhoeven [EMAIL PROTECTED] --- scripts/mod/modpost.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1129,10 +1129,10 @@ static void report_sec_mismatch(const ch if (!sec_mismatch_verbose) return; - fprintf(stderr, WARNING: %s(%s+0x%llx): Section mismatch in -reference from the %s %s%s to the %s %s:%s%s\n, -modname, fromsec, fromaddr, from, fromsym, from_p, - to, tosec, tosym, to_p); + warn(%s(%s+0x%llx): Section mismatch in reference from the %s %s%s +to the %s %s:%s%s\n, +modname, fromsec, fromaddr, from, fromsym, from_p, to, tosec, +tosym, to_p); switch (mismatch) { case TEXT_TO_INIT: @@ -1938,10 +1938,10 @@ int main(int argc, char **argv) if (dump_write) write_dump(dump_write); if (sec_mismatch_count !sec_mismatch_verbose) - fprintf(stderr, modpost: Found %d section mismatch(es).\n - To see full details build your kernel with:\n - 'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n, - sec_mismatch_count); + warn(modpost: Found %d section mismatch(es).\n +To see full details build your kernel with:\n +'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n, +sec_mismatch_count); return err; } With kind regards, Geert Uytterhoeven Software Architect Sony Network and Software Technology Center Europe The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium Phone:+32 (0)2 700 8453 Fax: +32 (0)2 700 8622 E-mail: [EMAIL PROTECTED] Internet: http://www.sony-europe.com/ Sony Network and Software Technology Center Europe A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 0413.825.160 · RPR Brussels Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
Re: [REVIEW for merge] kbuild updates including silence of section mismatch check
On Sat, 2008-02-02 at 22:30 +0100, Sam Ravnborg wrote: > Bryan this was from you - please comment/fix. > > Sam > > On Sat, Feb 02, 2008 at 10:25:51PM +0100, Frans Pop wrote: > > Sam Ravnborg wrote: > > > --- a/scripts/setlocalversion > > > +++ b/scripts/setlocalversion > > > @@ -45,3 +45,18 @@ if hgid=`hg id 2>/dev/null`; then > > > # All done with mercurial > > > exit > > > fi > > > + > > > +# Check for svn and a svn repo. > > > +if rev=`svn info 2>/dev/null | grep '^Revision' | awk '{print $NF}'` ; > > > then > > > + changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` > > > + > > > + # Are there uncommitted changes? > > > + if [ $changes != 0 ]; then > > > + printf -- '-svn%s%s%s' "$rev" -dirty "$changes" > > > + else > > > + printf -- '-svn%s' "$rev" > > > + fi > > > + > > > + # All done with svn > > > + exit > > > +fi > > > > This looks broken. Unless I'm very much mistaken the 'if' statement is > > always going to be true because the awk statement will always execute > > without error. Try: echo "" | awk '{print $NF}' || echo Error > > You are right, it will always plus a '-svn' string at the end of kernel version string even if it is not a svn repo. > > So, the code should probably be changed to: > > +if rev=`svn info 2>/dev/null | grep '^Revision' ; then > > + rev=`echo $rev | awk '{print $NF}'` > > + changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` > > I prefer to this one. A updated version will be sent out soon. > > or alternatively: > > +if rev=`svn info 2>/dev/null | grep '^Revision' | awk '{print $NF}'` && \ > > + [ -n "$rev" ] ; then > > + changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` > > > > Cheers, > > FJP > > > > P.S. Looks like the mercurial section is missing some indentation. I will fix this, too. Regards, -Bryan Wu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [REVIEW for merge] kbuild updates including silence of section mismatch check
Bryan this was from you - please comment/fix. Sam On Sat, Feb 02, 2008 at 10:25:51PM +0100, Frans Pop wrote: > Sam Ravnborg wrote: > > --- a/scripts/setlocalversion > > +++ b/scripts/setlocalversion > > @@ -45,3 +45,18 @@ if hgid=`hg id 2>/dev/null`; then > > # All done with mercurial > > exit > > fi > > + > > +# Check for svn and a svn repo. > > +if rev=`svn info 2>/dev/null | grep '^Revision' | awk '{print $NF}'` ; then > > + changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` > > + > > + # Are there uncommitted changes? > > + if [ $changes != 0 ]; then > > + printf -- '-svn%s%s%s' "$rev" -dirty "$changes" > > + else > > + printf -- '-svn%s' "$rev" > > + fi > > + > > + # All done with svn > > + exit > > +fi > > This looks broken. Unless I'm very much mistaken the 'if' statement is > always going to be true because the awk statement will always execute > without error. Try: echo "" | awk '{print $NF}' || echo Error > > So, the code should probably be changed to: > +if rev=`svn info 2>/dev/null | grep '^Revision' ; then > + rev=`echo $rev | awk '{print $NF}'` > + changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` > > or alternatively: > +if rev=`svn info 2>/dev/null | grep '^Revision' | awk '{print $NF}'` && \ > + [ -n "$rev" ] ; then > + changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` > > Cheers, > FJP > > P.S. Looks like the mercurial section is missing some indentation. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [REVIEW for merge] kbuild updates including silence of section mismatch check
Sam Ravnborg wrote: > --- a/scripts/setlocalversion > +++ b/scripts/setlocalversion > @@ -45,3 +45,18 @@ if hgid=`hg id 2>/dev/null`; then > # All done with mercurial > exit > fi > + > +# Check for svn and a svn repo. > +if rev=`svn info 2>/dev/null | grep '^Revision' | awk '{print $NF}'` ; then > + changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` > + > + # Are there uncommitted changes? > + if [ $changes != 0 ]; then > + printf -- '-svn%s%s%s' "$rev" -dirty "$changes" > + else > + printf -- '-svn%s' "$rev" > + fi > + > + # All done with svn > + exit > +fi This looks broken. Unless I'm very much mistaken the 'if' statement is always going to be true because the awk statement will always execute without error. Try: echo "" | awk '{print $NF}' || echo Error So, the code should probably be changed to: +if rev=`svn info 2>/dev/null | grep '^Revision' ; then + rev=`echo $rev | awk '{print $NF}'` + changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` or alternatively: +if rev=`svn info 2>/dev/null | grep '^Revision' | awk '{print $NF}'` && \ + [ -n "$rev" ] ; then + changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` Cheers, FJP P.S. Looks like the mercurial section is missing some indentation. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[REVIEW for merge] kbuild updates including silence of section mismatch check
I have queued up 10 patched for kbuild.git. As a few are new I post them for review here before pushing to Linus. The patchset from Mathieu causes the hing number of lines changed - the rest is smaller stuff. The most visible change is that I have made all the section mismatch go away and in the end of the build modpost report the number of section mismatch warnings and how to see detail. The typical output is now: modpost: Found 35 section mismatch(es). To see full details build your kernel with: 'make CONFIG_DEBUG_SECTION_MISMATCH=y' And CONFIG_DEBUG_SECTION_MISMATCH cannot be set from the config anymore so we are not noisy in typical allyesconfig builds. When we are down to an acceptable number of warnings modpost will start to be vocal again. The acceptable number is somewhere below 20 for an allyseconfig/allmodconfig build. All patches are pushed out to kbuild.git. See below for more details and a combined patch. Individual patches will be sent to kbuild only (and no cc:) Sam Bryan Wu (1): kbuild: add svn revision information to setlocalversion Geert Uytterhoeven (1): kbuild: Spelling/grammar fixes for config DEBUG_SECTION_MISMATCH Mathieu Desnoyers (5): Fix ARM to play nicely with generic Instrumentation menu Create arch/Kconfig Add HAVE_OPROFILE Add HAVE_KPROBES Move Kconfig.instrumentation to arch/Kconfig and init/Kconfig Ralf Baechle (1): Remove __INIT_REFOK and __INITDATA_REFOK Sam Ravnborg (3): kbuild: print only total number of section mismatces found kconfig: mark config as changed when loading an alternate config kconfig: ignore select of unknown symbol arch/Kconfig | 31 +++ arch/alpha/Kconfig |3 +- arch/arm/Kconfig | 21 +++- arch/arm/Kconfig.instrumentation | 62 -- arch/avr32/Kconfig |5 +-- arch/blackfin/Kconfig|3 +- arch/cris/Kconfig|2 - arch/frv/Kconfig |2 - arch/h8300/Kconfig |2 - arch/ia64/Kconfig|4 +- arch/m32r/Kconfig|3 +- arch/m68k/Kconfig|2 - arch/m68knommu/Kconfig |2 - arch/mips/Kconfig|3 +- arch/parisc/Kconfig |3 +- arch/powerpc/Kconfig |4 +- arch/ppc/Kconfig |4 +- arch/s390/Kconfig|4 +- arch/sh/Kconfig |3 +- arch/sparc/Kconfig |3 +- arch/sparc64/Kconfig |4 +- arch/um/Kconfig |2 - arch/v850/Kconfig|2 - arch/x86/Kconfig |8 + arch/xtensa/Kconfig |2 - include/linux/init.h |3 -- init/Kconfig | 14 kernel/Kconfig.instrumentation | 49 -- lib/Kconfig.debug| 14 scripts/kconfig/mconf.c |1 + scripts/kconfig/menu.c |9 ++ scripts/mod/modpost.c| 15 - scripts/setlocalversion | 15 + 33 files changed, 118 insertions(+), 186 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig new file mode 100644 index 000..3d72dc3 --- /dev/null +++ b/arch/Kconfig @@ -0,0 +1,31 @@ +# +# General architecture dependent options +# + +config OPROFILE + tristate "OProfile system profiling (EXPERIMENTAL)" + depends on PROFILING + depends on HAVE_OPROFILE + help + OProfile is a profiling system capable of profiling the + whole system, include the kernel, kernel modules, libraries, + and applications. + + If unsure, say N. + +config HAVE_OPROFILE + def_bool n + +config KPROBES + bool "Kprobes" + depends on KALLSYMS && MODULES + depends on HAVE_KPROBES + help + Kprobes allows you to trap at almost any kernel address and + execute a callback function. register_kprobe() establishes + a probepoint and specifies the callback. Kprobes is useful + for kernel debugging, non-intrusive instrumentation and testing. + If in doubt, say "N". + +config HAVE_KPROBES + def_bool n diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index c613d5f..9abcd5f 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig @@ -5,6 +5,7 @@ config ALPHA bool default y + select HAVE_OPROFILE help The Alpha is a 64-bit general-purpose processor designed and marketed by the Digital Equipment Corporation of blessed memory, @@ -649,8 +650,6 @@ source "drivers/Kconfig" source "fs/Kconfig" -source "kernel/Kconfig.instrumentation" - source "arch/alpha/Kconfig.debug" # DUMMY_CONSOLE may be defined in drivers/video/console/Kconfig diff --git a/arch/arm/Kconfig
[REVIEW for merge] kbuild updates including silence of section mismatch check
I have queued up 10 patched for kbuild.git. As a few are new I post them for review here before pushing to Linus. The patchset from Mathieu causes the hing number of lines changed - the rest is smaller stuff. The most visible change is that I have made all the section mismatch go away and in the end of the build modpost report the number of section mismatch warnings and how to see detail. The typical output is now: modpost: Found 35 section mismatch(es). To see full details build your kernel with: 'make CONFIG_DEBUG_SECTION_MISMATCH=y' And CONFIG_DEBUG_SECTION_MISMATCH cannot be set from the config anymore so we are not noisy in typical allyesconfig builds. When we are down to an acceptable number of warnings modpost will start to be vocal again. The acceptable number is somewhere below 20 for an allyseconfig/allmodconfig build. All patches are pushed out to kbuild.git. See below for more details and a combined patch. Individual patches will be sent to kbuild only (and no cc:) Sam Bryan Wu (1): kbuild: add svn revision information to setlocalversion Geert Uytterhoeven (1): kbuild: Spelling/grammar fixes for config DEBUG_SECTION_MISMATCH Mathieu Desnoyers (5): Fix ARM to play nicely with generic Instrumentation menu Create arch/Kconfig Add HAVE_OPROFILE Add HAVE_KPROBES Move Kconfig.instrumentation to arch/Kconfig and init/Kconfig Ralf Baechle (1): Remove __INIT_REFOK and __INITDATA_REFOK Sam Ravnborg (3): kbuild: print only total number of section mismatces found kconfig: mark config as changed when loading an alternate config kconfig: ignore select of unknown symbol arch/Kconfig | 31 +++ arch/alpha/Kconfig |3 +- arch/arm/Kconfig | 21 +++- arch/arm/Kconfig.instrumentation | 62 -- arch/avr32/Kconfig |5 +-- arch/blackfin/Kconfig|3 +- arch/cris/Kconfig|2 - arch/frv/Kconfig |2 - arch/h8300/Kconfig |2 - arch/ia64/Kconfig|4 +- arch/m32r/Kconfig|3 +- arch/m68k/Kconfig|2 - arch/m68knommu/Kconfig |2 - arch/mips/Kconfig|3 +- arch/parisc/Kconfig |3 +- arch/powerpc/Kconfig |4 +- arch/ppc/Kconfig |4 +- arch/s390/Kconfig|4 +- arch/sh/Kconfig |3 +- arch/sparc/Kconfig |3 +- arch/sparc64/Kconfig |4 +- arch/um/Kconfig |2 - arch/v850/Kconfig|2 - arch/x86/Kconfig |8 + arch/xtensa/Kconfig |2 - include/linux/init.h |3 -- init/Kconfig | 14 kernel/Kconfig.instrumentation | 49 -- lib/Kconfig.debug| 14 scripts/kconfig/mconf.c |1 + scripts/kconfig/menu.c |9 ++ scripts/mod/modpost.c| 15 - scripts/setlocalversion | 15 + 33 files changed, 118 insertions(+), 186 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig new file mode 100644 index 000..3d72dc3 --- /dev/null +++ b/arch/Kconfig @@ -0,0 +1,31 @@ +# +# General architecture dependent options +# + +config OPROFILE + tristate OProfile system profiling (EXPERIMENTAL) + depends on PROFILING + depends on HAVE_OPROFILE + help + OProfile is a profiling system capable of profiling the + whole system, include the kernel, kernel modules, libraries, + and applications. + + If unsure, say N. + +config HAVE_OPROFILE + def_bool n + +config KPROBES + bool Kprobes + depends on KALLSYMS MODULES + depends on HAVE_KPROBES + help + Kprobes allows you to trap at almost any kernel address and + execute a callback function. register_kprobe() establishes + a probepoint and specifies the callback. Kprobes is useful + for kernel debugging, non-intrusive instrumentation and testing. + If in doubt, say N. + +config HAVE_KPROBES + def_bool n diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index c613d5f..9abcd5f 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig @@ -5,6 +5,7 @@ config ALPHA bool default y + select HAVE_OPROFILE help The Alpha is a 64-bit general-purpose processor designed and marketed by the Digital Equipment Corporation of blessed memory, @@ -649,8 +650,6 @@ source drivers/Kconfig source fs/Kconfig -source kernel/Kconfig.instrumentation - source arch/alpha/Kconfig.debug # DUMMY_CONSOLE may be defined in drivers/video/console/Kconfig diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
Re: [REVIEW for merge] kbuild updates including silence of section mismatch check
Sam Ravnborg wrote: --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -45,3 +45,18 @@ if hgid=`hg id 2/dev/null`; then # All done with mercurial exit fi + +# Check for svn and a svn repo. +if rev=`svn info 2/dev/null | grep '^Revision' | awk '{print $NF}'` ; then + changes=`svn status 2/dev/null | grep '^[AMD]' | wc -l` + + # Are there uncommitted changes? + if [ $changes != 0 ]; then + printf -- '-svn%s%s%s' $rev -dirty $changes + else + printf -- '-svn%s' $rev + fi + + # All done with svn + exit +fi This looks broken. Unless I'm very much mistaken the 'if' statement is always going to be true because the awk statement will always execute without error. Try: echo | awk '{print $NF}' || echo Error So, the code should probably be changed to: +if rev=`svn info 2/dev/null | grep '^Revision' ; then + rev=`echo $rev | awk '{print $NF}'` + changes=`svn status 2/dev/null | grep '^[AMD]' | wc -l` or alternatively: +if rev=`svn info 2/dev/null | grep '^Revision' | awk '{print $NF}'` \ + [ -n $rev ] ; then + changes=`svn status 2/dev/null | grep '^[AMD]' | wc -l` Cheers, FJP P.S. Looks like the mercurial section is missing some indentation. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [REVIEW for merge] kbuild updates including silence of section mismatch check
Bryan this was from you - please comment/fix. Sam On Sat, Feb 02, 2008 at 10:25:51PM +0100, Frans Pop wrote: Sam Ravnborg wrote: --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -45,3 +45,18 @@ if hgid=`hg id 2/dev/null`; then # All done with mercurial exit fi + +# Check for svn and a svn repo. +if rev=`svn info 2/dev/null | grep '^Revision' | awk '{print $NF}'` ; then + changes=`svn status 2/dev/null | grep '^[AMD]' | wc -l` + + # Are there uncommitted changes? + if [ $changes != 0 ]; then + printf -- '-svn%s%s%s' $rev -dirty $changes + else + printf -- '-svn%s' $rev + fi + + # All done with svn + exit +fi This looks broken. Unless I'm very much mistaken the 'if' statement is always going to be true because the awk statement will always execute without error. Try: echo | awk '{print $NF}' || echo Error So, the code should probably be changed to: +if rev=`svn info 2/dev/null | grep '^Revision' ; then + rev=`echo $rev | awk '{print $NF}'` + changes=`svn status 2/dev/null | grep '^[AMD]' | wc -l` or alternatively: +if rev=`svn info 2/dev/null | grep '^Revision' | awk '{print $NF}'` \ + [ -n $rev ] ; then + changes=`svn status 2/dev/null | grep '^[AMD]' | wc -l` Cheers, FJP P.S. Looks like the mercurial section is missing some indentation. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [REVIEW for merge] kbuild updates including silence of section mismatch check
On Sat, 2008-02-02 at 22:30 +0100, Sam Ravnborg wrote: Bryan this was from you - please comment/fix. Sam On Sat, Feb 02, 2008 at 10:25:51PM +0100, Frans Pop wrote: Sam Ravnborg wrote: --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -45,3 +45,18 @@ if hgid=`hg id 2/dev/null`; then # All done with mercurial exit fi + +# Check for svn and a svn repo. +if rev=`svn info 2/dev/null | grep '^Revision' | awk '{print $NF}'` ; then + changes=`svn status 2/dev/null | grep '^[AMD]' | wc -l` + + # Are there uncommitted changes? + if [ $changes != 0 ]; then + printf -- '-svn%s%s%s' $rev -dirty $changes + else + printf -- '-svn%s' $rev + fi + + # All done with svn + exit +fi This looks broken. Unless I'm very much mistaken the 'if' statement is always going to be true because the awk statement will always execute without error. Try: echo | awk '{print $NF}' || echo Error You are right, it will always plus a '-svn' string at the end of kernel version string even if it is not a svn repo. So, the code should probably be changed to: +if rev=`svn info 2/dev/null | grep '^Revision' ; then + rev=`echo $rev | awk '{print $NF}'` + changes=`svn status 2/dev/null | grep '^[AMD]' | wc -l` I prefer to this one. A updated version will be sent out soon. or alternatively: +if rev=`svn info 2/dev/null | grep '^Revision' | awk '{print $NF}'` \ + [ -n $rev ] ; then + changes=`svn status 2/dev/null | grep '^[AMD]' | wc -l` Cheers, FJP P.S. Looks like the mercurial section is missing some indentation. I will fix this, too. Regards, -Bryan Wu -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/