diff mbox

[-v1.1] Kbuild: Ignore GREP_OPTIONS env variable

Message ID 20131111142743.GE28219@pd.tnic (mailing list archive)
State New, archived
Headers show

Commit Message

Borislav Petkov Nov. 11, 2013, 2:27 p.m. UTC
From: Borislav Petkov <bp@suse.de>
Subject: [PATCH] Kbuild: Ignore GREP_OPTIONS env variable

When building the kernel in a shell which defines GREP_OPTIONS so that
grep behavior is modified, we can break the generation of the syscalls
table like so:

__SYSCALL_COMMON(0, sys_read, sys_read)
__SYSCALL_COMMON(1, sys_write, sys_write)
__SYSCALL_COMMON(10, sys_mprotect, sys_mprotect) ...

This is just the initial breakage, later we barf when generating
modules.

In this case, GREP_OPTIONS contains "--color=always" which adds the shell
colors markup and completely fudges the headers under ...generated/asm/.

Fix that by unexporting the GREP_OPTIONS variable for the whole kernel
build as we tend to use grep at a bunch of places.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michal Marek Nov. 11, 2013, 5 p.m. UTC | #1
On Mon, Nov 11, 2013 at 03:27:43PM +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
> Subject: [PATCH] Kbuild: Ignore GREP_OPTIONS env variable
> 
> When building the kernel in a shell which defines GREP_OPTIONS so that
> grep behavior is modified, we can break the generation of the syscalls
> table like so:
> 
> __SYSCALL_COMMON(0, sys_read, sys_read)
> __SYSCALL_COMMON(1, sys_write, sys_write)
> __SYSCALL_COMMON(10, sys_mprotect, sys_mprotect) ...

The email had literal escape sequences and git am preserved them, so git
show displayed red zeros and onces. That was quite scary, so I replaced
the escape character with ^[.

Anyway, applied to kbuild.git#kbuild now.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ingo Molnar Nov. 11, 2013, 8:43 p.m. UTC | #2
* Michal Marek <mmarek@suse.cz> wrote:

> On Mon, Nov 11, 2013 at 03:27:43PM +0100, Borislav Petkov wrote:
> > From: Borislav Petkov <bp@suse.de>
> > Subject: [PATCH] Kbuild: Ignore GREP_OPTIONS env variable
> > 
> > When building the kernel in a shell which defines GREP_OPTIONS so that
> > grep behavior is modified, we can break the generation of the syscalls
> > table like so:
> > 
> > __SYSCALL_COMMON(0, sys_read, sys_read)
> > __SYSCALL_COMMON(1, sys_write, sys_write)
> > __SYSCALL_COMMON(10, sys_mprotect, sys_mprotect) ...
> 
> The email had literal escape sequences and git am preserved them, so git
> show displayed red zeros and onces. [..]

Neat trick if it was intentionally!

> [...] That was quite scary, [...]

Scary if it was unintentional ;-)

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Borislav Petkov Nov. 11, 2013, 8:58 p.m. UTC | #3
On Mon, Nov 11, 2013 at 09:43:30PM +0100, Ingo Molnar wrote:
> * Michal Marek <mmarek@suse.cz> wrote:
> > On Mon, Nov 11, 2013 at 03:27:43PM +0100, Borislav Petkov wrote:
> > > From: Borislav Petkov <bp@suse.de>
> > > Subject: [PATCH] Kbuild: Ignore GREP_OPTIONS env variable
> > > 
> > > When building the kernel in a shell which defines GREP_OPTIONS so that
> > > grep behavior is modified, we can break the generation of the syscalls
> > > table like so:
> > > 
> > > __SYSCALL_COMMON(0, sys_read, sys_read)
> > > __SYSCALL_COMMON(1, sys_write, sys_write)
> > > __SYSCALL_COMMON(10, sys_mprotect, sys_mprotect) ...
> > 
> > The email had literal escape sequences and git am preserved them, so git
> > show displayed red zeros and onces. [..]
> 
> Neat trick if it was intentionally!
> 
> > [...] That was quite scary, [...]
> 
> Scary if it was unintentional ;-)

Yeah, all our computers are bleeding :-) Well, I sent the first version
on the evening before Helloween...

<scary music playing, an old door is creaking...>
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 868c0eb67b08..73503a7755fd 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,9 @@  LC_COLLATE=C
 LC_NUMERIC=C
 export LC_COLLATE LC_NUMERIC
 
+# Avoid interference with shell env settings
+unexport GREP_OPTIONS
+
 # We are using a recursive build, so we need to do a little thinking
 # to get the ordering right.
 #