All of lore.kernel.org
 help / color / mirror / Atom feed
* Kbuild: Ignore GREP_OPTIONS env variable
@ 2013-10-30 16:06 Borislav Petkov
  2013-11-06 21:42 ` Michal Marek
  0 siblings, 1 reply; 6+ messages in thread
From: Borislav Petkov @ 2013-10-30 16:06 UTC (permalink / raw)
  To: linux-kbuild, lkml; +Cc: x86-ml

Hi,

this is just a general poll of what people think about the issue here,
just so that at least we've talked about it.

So I had defined GREP_OPTIONS=--color=always on one of my boxes and had
forgotten about it and the kernel build started failing because we use
grep quite a while in the tree and it started issuing shell color markup
which generated garbage files, like the syscall headers on x86, for
example.

I have a fix below which seems to take care of it but what is the
general opinion: Do we want to be more robust against the environment we
find on a machine before building the kernel or let the user figure it
out himself that he should be using

GREP_OPTIONS=--color=auto

in the first place and it is his own moronic fault if he does 'always'?

Opinions, comments?

Thanks.

--
From: Borislav Petkov <bp@suse.de>
Subject: [PATCH] Kbuild: Ignore GREP_OPTIONS env variable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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(^[[01;31m^[[K0^[[m^[[K, sys_read, sys_read)
__SYSCALL_COMMON(^[[01;31m^[[K1^[[m^[[K, sys_write, sys_write)
__SYSCALL_COMMON(^[[01;31m^[[K1^[[m^[[K0, 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 ignoring 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(+)

diff --git a/Makefile b/Makefile
index 868c0eb67b08..7a2acd9a5d1c 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,9 @@ NAME = One Giant Leap for Frogkind
 # o  print "Entering directory ...";
 MAKEFLAGS += -rR --no-print-directory
 
+GREP_OPTIONS=
+export GREP_OPTIONS
+
 # Avoid funny character set dependencies
 unexport LC_ALL
 LC_COLLATE=C
-- 
1.8.4

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Kbuild: Ignore GREP_OPTIONS env variable
  2013-10-30 16:06 Kbuild: Ignore GREP_OPTIONS env variable Borislav Petkov
@ 2013-11-06 21:42 ` Michal Marek
  2013-11-11 14:27   ` [PATCH -v1.1] " Borislav Petkov
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Marek @ 2013-11-06 21:42 UTC (permalink / raw)
  To: Borislav Petkov, linux-kbuild, lkml; +Cc: x86-ml

Dne 30.10.2013 17:06, Borislav Petkov napsal(a):
> So I had defined GREP_OPTIONS=--color=always on one of my boxes and had
> forgotten about it and the kernel build started failing because we use
> grep quite a while in the tree and it started issuing shell color markup
> which generated garbage files, like the syscall headers on x86, for
> example.
> 
> I have a fix below which seems to take care of it but what is the
> general opinion: Do we want to be more robust against the environment we
> find on a machine before building the kernel or let the user figure it
> out himself that he should be using
> 
> GREP_OPTIONS=--color=auto
> 
> in the first place and it is his own moronic fault if he does 'always'?

I think that on a scale from one to ten, building with
GREP_OPTIONS=--color=always and building with LC_COLLATE=<language with
non-ASCII sorting rules> score about the same. And are already
sanitizing the LC_* variables.


> +GREP_OPTIONS=
> +export GREP_OPTIONS

Just remove it from the enviromnet completely, like the next statement does:

> +
>  # Avoid funny character set dependencies
>  unexport LC_ALL
>  LC_COLLATE=C

Michal


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH -v1.1] Kbuild: Ignore GREP_OPTIONS env variable
  2013-11-06 21:42 ` Michal Marek
@ 2013-11-11 14:27   ` Borislav Petkov
  2013-11-11 17:00     ` Michal Marek
  0 siblings, 1 reply; 6+ messages in thread
From: Borislav Petkov @ 2013-11-11 14:27 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, lkml, x86-ml

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(^[[01;31m^[[K0^[[m^[[K, sys_read, sys_read)
__SYSCALL_COMMON(^[[01;31m^[[K1^[[m^[[K, sys_write, sys_write)
__SYSCALL_COMMON(^[[01;31m^[[K1^[[m^[[K0, 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(+)

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.
 #
-- 
1.8.4

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH -v1.1] Kbuild: Ignore GREP_OPTIONS env variable
  2013-11-11 14:27   ` [PATCH -v1.1] " Borislav Petkov
@ 2013-11-11 17:00     ` Michal Marek
  2013-11-11 20:43       ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Marek @ 2013-11-11 17:00 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: linux-kbuild, lkml, x86-ml

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(^[[01;31m^[[K0^[[m^[[K, sys_read, sys_read)
> __SYSCALL_COMMON(^[[01;31m^[[K1^[[m^[[K, sys_write, sys_write)
> __SYSCALL_COMMON(^[[01;31m^[[K1^[[m^[[K0, 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -v1.1] Kbuild: Ignore GREP_OPTIONS env variable
  2013-11-11 17:00     ` Michal Marek
@ 2013-11-11 20:43       ` Ingo Molnar
  2013-11-11 20:58         ` Borislav Petkov
  0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2013-11-11 20:43 UTC (permalink / raw)
  To: Michal Marek; +Cc: Borislav Petkov, linux-kbuild, lkml, x86-ml


* 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(^[[01;31m^[[K0^[[m^[[K, sys_read, sys_read)
> > __SYSCALL_COMMON(^[[01;31m^[[K1^[[m^[[K, sys_write, sys_write)
> > __SYSCALL_COMMON(^[[01;31m^[[K1^[[m^[[K0, 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -v1.1] Kbuild: Ignore GREP_OPTIONS env variable
  2013-11-11 20:43       ` Ingo Molnar
@ 2013-11-11 20:58         ` Borislav Petkov
  0 siblings, 0 replies; 6+ messages in thread
From: Borislav Petkov @ 2013-11-11 20:58 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Michal Marek, linux-kbuild, lkml, x86-ml

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(^[[01;31m^[[K0^[[m^[[K, sys_read, sys_read)
> > > __SYSCALL_COMMON(^[[01;31m^[[K1^[[m^[[K, sys_write, sys_write)
> > > __SYSCALL_COMMON(^[[01;31m^[[K1^[[m^[[K0, 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...>

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-11 20:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-30 16:06 Kbuild: Ignore GREP_OPTIONS env variable Borislav Petkov
2013-11-06 21:42 ` Michal Marek
2013-11-11 14:27   ` [PATCH -v1.1] " Borislav Petkov
2013-11-11 17:00     ` Michal Marek
2013-11-11 20:43       ` Ingo Molnar
2013-11-11 20:58         ` Borislav Petkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.