mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Marek <mmarek@suse.cz>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnaud Lacombe <lacombar@gmail.com>,
	linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] kbuild: Add error handling to KCONFIG_ALL_CONFIG
Date: Tue, 24 Apr 2012 14:33:05 +0200	[thread overview]
Message-ID: <20120424123305.GA30068@sepie.suse.cz> (raw)
In-Reply-To: <m1aa21nxzg.fsf_-_@fess.ebiederm.org>

On Tue, Apr 24, 2012 at 04:57:39AM -0700, Eric W. Biederman wrote:
>  		name = getenv("KCONFIG_ALLCONFIG");
> -		if (name && !stat(name, &tmpstat)) {
> -			conf_read_simple(name, S_DEF_USER);
> +		if (name && name[0] != '\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) {


Before this patch, the code would fall back to a file named
all{no,yes,mod,def,random}.config and then to all.config. Now you require
$KCONFIG_ALLCONFIG to always be a file. I suggest we keep the fallback at
least for KCONFIG_ALLCONFIG=1, like this:


diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index f208f90..36efc8f 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -574,9 +574,17 @@ 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);
-			break;
+		if (name && name[0] != '\0') {
+			if (conf_read_simple(name, S_DEF_USER)) {
+				if (strcmp(name, "1") != 0) {
+					fprintf(stderr,
+						_("*** Can't read seed configuration \"%s\"!\n"),
+						name);
+					exit(1);
+				}
+			} else {
+				break;
+			}
 		}
 		switch (input_mode) {
 		case allnoconfig:	name = "allno.config"; break;
@@ -586,10 +594,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=1 set, but no \"%s\" or \"all.config\" file found\n"),
+				name);
+			exit(1);
+		}
 		break;
 	default:
 		break;


And update Documentation/kbuild/kconfig.txt.

Michal

  reply	other threads:[~2012-04-24 12:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-24  0:59 [PATCH] kbuld: Implement oldmodconfig 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 [this message]
2012-04-24 12:54       ` Eric W. Biederman
2012-04-24 13:37         ` Michal Marek
2012-04-26  8:51           ` Eric W. Biederman
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=20120424123305.GA30068@sepie.suse.cz \
    --to=mmarek@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=lacombar@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®