From: ebiederm@xmission.com (Eric W. Biederman)
To: Michal Marek <mmarek@suse.cz>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Arnaud Lacombe <lacombar@gmail.com>,
linux-kbuild@vger.kernel.org
Subject: [PATCH] kbuild: Add error handling to KCONFIG_ALL_CONFIG
Date: Thu, 26 Apr 2012 01:51:32 -0700 [thread overview]
Message-ID: <m1wr52dgff.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <4F96AC7F.6080603@suse.cz> (Michal Marek's message of "Tue, 24 Apr 2012 15:37:03 +0200")
- Only try to read the file specified if KCONFIG_ALL_CONFIG is set to
something other than the empty string or "1".
- Don't use stat to check the name passed to conf_read_simple so that
zconf_fopen can find the file in the current directory or in SRCTREE
removing a extremely source of confusing failure, where KCONFIG_ALL_CONFIG
was not interpreted with respect to the directory make was called in.
- If conf_read_simple fails complain clearly and stop processing.
Allowing the simple debugging of typos.
- Clearly document the behavior so it is clear to users which
values are treated as flags and which values are treated as
filenames.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
Documentation/kbuild/kconfig.txt | 18 +++++++++---------
scripts/kconfig/conf.c | 20 ++++++++++++++------
2 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/Documentation/kbuild/kconfig.txt b/Documentation/kbuild/kconfig.txt
index 9d5f2a9..a09f1a6 100644
--- a/Documentation/kbuild/kconfig.txt
+++ b/Documentation/kbuild/kconfig.txt
@@ -53,15 +53,15 @@ KCONFIG_ALLCONFIG
--------------------------------------------------
(partially based on lkml email from/by Rob Landley, re: miniconfig)
--------------------------------------------------
-The allyesconfig/allmodconfig/allnoconfig/randconfig variants can
-also use the environment variable KCONFIG_ALLCONFIG as a flag or a
-filename that contains config symbols that the user requires to be
-set to a specific value. If KCONFIG_ALLCONFIG is used without a
-filename, "make *config" checks for a file named
-"all{yes/mod/no/def/random}.config" (corresponding to the *config command
-that was used) for symbol values that are to be forced. If this file
-is not found, it checks for a file named "all.config" to contain forced
-values.
+The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also
+use the environment variable KCONFIG_ALLCONFIG as a flag or a filename
+that contains config symbols that the user requires to be set to a
+specific value. If KCONFIG_ALLCONFIG is used without a filename where
+KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", "make *config"
+checks for a file named "all{yes/mod/no/def/random}.config"
+(corresponding to the *config command that was used) for symbol values
+that are to be forced. If this file is not found, it checks for a
+file named "all.config" to contain forced values.
This enables you to create "miniature" config (miniconfig) or custom
config files containing just the config symbols that you are interested
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index f208f90..0fdda91 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -574,8 +574,13 @@ int main(int ac, char **av)
case alldefconfig:
case randconfig:
name = getenv("KCONFIG_ALLCONFIG");
- if (name && !stat(name, &tmpstat)) {
- conf_read_simple(name, S_DEF_USER);
+ if (name && (strcmp(name, "") != 0) && (strcmp(name, "1") != 0)) {
+ if (conf_read_simple(name, S_DEF_USER)) {
+ fprintf(stderr,
+ _("*** Can't read seed configuration \"%s\"!\n"),
+ name);
+ exit(1);
+ }
break;
}
switch (input_mode) {
@@ -586,10 +591,13 @@ int main(int ac, char **av)
case randconfig: name = "allrandom.config"; break;
default: break;
}
- if (!stat(name, &tmpstat))
- conf_read_simple(name, S_DEF_USER);
- else if (!stat("all.config", &tmpstat))
- conf_read_simple("all.config", S_DEF_USER);
+ if (conf_read_simple(name, S_DEF_USER) &&
+ conf_read_simple("all.config", S_DEF_USER)) {
+ fprintf(stderr,
+ _("*** KCONFIG_ALLCONFIG set, but no \"%s\" or \"all.config\" file found\n"),
+ name);
+ exit(1);
+ }
break;
default:
break;
--
1.7.2.5
next prev parent reply other threads:[~2012-04-26 8:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-24 0:59 [PATCH] kbuld: Implement oldmodconfig Eric W. Biederman
2012-04-24 0:59 ` Eric W. Biederman
2012-04-24 9:20 ` Michal Marek
2012-04-24 10:37 ` Eric W. Biederman
2012-04-24 11:57 ` [PATCH] kbuild: Add error handling to KCONFIG_ALL_CONFIG Eric W. Biederman
2012-04-24 12:33 ` Michal Marek
2012-04-24 12:54 ` Eric W. Biederman
2012-04-24 13:37 ` Michal Marek
2012-04-26 8:51 ` Eric W. Biederman [this message]
2012-05-04 22:24 ` Michal Marek
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=m1wr52dgff.fsf@fess.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=akpm@linux-foundation.org \
--cc=lacombar@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.cz \
/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.