All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: linux-kbuild@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>
Cc: x86-ml <x86@kernel.org>
Subject: Kbuild: Ignore GREP_OPTIONS env variable
Date: Wed, 30 Oct 2013 17:06:35 +0100	[thread overview]
Message-ID: <20131030160635.GE13290@pd.tnic> (raw)

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

             reply	other threads:[~2013-10-30 16:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-30 16:06 Borislav Petkov [this message]
2013-11-06 21:42 ` Kbuild: Ignore GREP_OPTIONS env variable 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

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=20131030160635.GE13290@pd.tnic \
    --to=bp@alien8.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@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 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.