All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuld: Implement oldmodconfig
@ 2012-04-24  0:59 ` Eric W. Biederman
  0 siblings, 0 replies; 10+ messages in thread
From: Eric W. Biederman @ 2012-04-24  0:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Arnaud Lacombe, Michal Marek, linux-kbuild, linux-kernel


While verifying that my user namespace patches are as complete as I
expect them to be I came a came across the need to build kernel
configurations with a few choice settings disabled and everything else
enabled.  Adding a make oldmodconfig made generating those
configurations straight forward, as now I can set the options I care
about and the oldmodconfig can answering everything else for me in a
consistent way.

Respond with mod/yes/default to every question for every unset symbol
depending if the symbol is tristate, boolean or something else.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 scripts/kconfig/Makefile |    5 +++--
 scripts/kconfig/conf.c   |    8 ++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 7966265..4de07d4 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -76,9 +76,9 @@ PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig
 allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf
 	$< --$@ $(Kconfig)
 
-PHONY += listnewconfig oldnoconfig savedefconfig defconfig
+PHONY += listnewconfig oldnoconfig oldmodconfig savedefconfig defconfig
 
-listnewconfig oldnoconfig: $(obj)/conf
+listnewconfig oldnoconfig oldmodconfig: $(obj)/conf
 	$< --$@ $(Kconfig)
 
 savedefconfig: $(obj)/conf
@@ -115,6 +115,7 @@ help:
 	@echo  '  randconfig	  - New config with random answer to all options'
 	@echo  '  listnewconfig   - List new options'
 	@echo  '  oldnoconfig     - Same as silentoldconfig but set new symbols to n (unset)'
+	@echo  '  oldmodconfig    - Same as silentoldconfig but set new symbols to m (module)'
 
 # lxdialog stuff
 check-lxdialog  := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index f208f90..28910ea 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -33,6 +33,7 @@ enum input_mode {
 	savedefconfig,
 	listnewconfig,
 	oldnoconfig,
+	oldmodconfig,
 } input_mode = oldaskconfig;
 
 static int indent = 1;
@@ -455,6 +456,7 @@ static struct option long_opts[] = {
 	{"randconfig",      no_argument,       NULL, randconfig},
 	{"listnewconfig",   no_argument,       NULL, listnewconfig},
 	{"oldnoconfig",     no_argument,       NULL, oldnoconfig},
+	{"oldmodconfig",    no_argument,       NULL, oldmodconfig},
 	{NULL, 0, NULL, 0}
 };
 
@@ -468,6 +470,7 @@ static void conf_usage(const char *progname)
 	printf("  --oldconfig             Update a configuration using a provided .config as base\n");
 	printf("  --silentoldconfig       Same as oldconfig, but quietly, additionally update deps\n");
 	printf("  --oldnoconfig           Same as silentoldconfig but set new symbols to no\n");
+	printf("  --oldmodconfig          Same as silentoldconfig but set new symbols to mod\n");
 	printf("  --defconfig <file>      New config with default defined in <file>\n");
 	printf("  --savedefconfig <file>  Save the minimal current configuration to <file>\n");
 	printf("  --allnoconfig           New config where all options are answered with no\n");
@@ -521,6 +524,7 @@ int main(int ac, char **av)
 		case alldefconfig:
 		case listnewconfig:
 		case oldnoconfig:
+		case oldmodconfig:
 			break;
 		case '?':
 			conf_usage(progname);
@@ -566,6 +570,7 @@ int main(int ac, char **av)
 	case oldconfig:
 	case listnewconfig:
 	case oldnoconfig:
+	case oldmodconfig:
 		conf_read(NULL);
 		break;
 	case allnoconfig:
@@ -626,6 +631,9 @@ int main(int ac, char **av)
 	case defconfig:
 		conf_set_all_new_symbols(def_default);
 		break;
+	case oldmodconfig:
+		conf_set_all_new_symbols(def_mod);
+		break;
 	case savedefconfig:
 		break;
 	case oldaskconfig:
-- 
1.7.2.5


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

* [PATCH] kbuld: Implement oldmodconfig
@ 2012-04-24  0:59 ` Eric W. Biederman
  0 siblings, 0 replies; 10+ messages in thread
From: Eric W. Biederman @ 2012-04-24  0:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Arnaud Lacombe, Michal Marek, linux-kbuild


While verifying that my user namespace patches are as complete as I
expect them to be I came a came across the need to build kernel
configurations with a few choice settings disabled and everything else
enabled.  Adding a make oldmodconfig made generating those
configurations straight forward, as now I can set the options I care
about and the oldmodconfig can answering everything else for me in a
consistent way.

Respond with mod/yes/default to every question for every unset symbol
depending if the symbol is tristate, boolean or something else.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 scripts/kconfig/Makefile |    5 +++--
 scripts/kconfig/conf.c   |    8 ++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 7966265..4de07d4 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -76,9 +76,9 @@ PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig
 allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf
 	$< --$@ $(Kconfig)
 
-PHONY += listnewconfig oldnoconfig savedefconfig defconfig
+PHONY += listnewconfig oldnoconfig oldmodconfig savedefconfig defconfig
 
-listnewconfig oldnoconfig: $(obj)/conf
+listnewconfig oldnoconfig oldmodconfig: $(obj)/conf
 	$< --$@ $(Kconfig)
 
 savedefconfig: $(obj)/conf
@@ -115,6 +115,7 @@ help:
 	@echo  '  randconfig	  - New config with random answer to all options'
 	@echo  '  listnewconfig   - List new options'
 	@echo  '  oldnoconfig     - Same as silentoldconfig but set new symbols to n (unset)'
+	@echo  '  oldmodconfig    - Same as silentoldconfig but set new symbols to m (module)'
 
 # lxdialog stuff
 check-lxdialog  := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index f208f90..28910ea 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -33,6 +33,7 @@ enum input_mode {
 	savedefconfig,
 	listnewconfig,
 	oldnoconfig,
+	oldmodconfig,
 } input_mode = oldaskconfig;
 
 static int indent = 1;
@@ -455,6 +456,7 @@ static struct option long_opts[] = {
 	{"randconfig",      no_argument,       NULL, randconfig},
 	{"listnewconfig",   no_argument,       NULL, listnewconfig},
 	{"oldnoconfig",     no_argument,       NULL, oldnoconfig},
+	{"oldmodconfig",    no_argument,       NULL, oldmodconfig},
 	{NULL, 0, NULL, 0}
 };
 
@@ -468,6 +470,7 @@ static void conf_usage(const char *progname)
 	printf("  --oldconfig             Update a configuration using a provided .config as base\n");
 	printf("  --silentoldconfig       Same as oldconfig, but quietly, additionally update deps\n");
 	printf("  --oldnoconfig           Same as silentoldconfig but set new symbols to no\n");
+	printf("  --oldmodconfig          Same as silentoldconfig but set new symbols to mod\n");
 	printf("  --defconfig <file>      New config with default defined in <file>\n");
 	printf("  --savedefconfig <file>  Save the minimal current configuration to <file>\n");
 	printf("  --allnoconfig           New config where all options are answered with no\n");
@@ -521,6 +524,7 @@ int main(int ac, char **av)
 		case alldefconfig:
 		case listnewconfig:
 		case oldnoconfig:
+		case oldmodconfig:
 			break;
 		case '?':
 			conf_usage(progname);
@@ -566,6 +570,7 @@ int main(int ac, char **av)
 	case oldconfig:
 	case listnewconfig:
 	case oldnoconfig:
+	case oldmodconfig:
 		conf_read(NULL);
 		break;
 	case allnoconfig:
@@ -626,6 +631,9 @@ int main(int ac, char **av)
 	case defconfig:
 		conf_set_all_new_symbols(def_default);
 		break;
+	case oldmodconfig:
+		conf_set_all_new_symbols(def_mod);
+		break;
 	case savedefconfig:
 		break;
 	case oldaskconfig:
-- 
1.7.2.5


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

* Re: [PATCH] kbuld: Implement oldmodconfig
  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
  -1 siblings, 2 replies; 10+ messages in thread
From: Michal Marek @ 2012-04-24  9:20 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-kernel, Andrew Morton, Arnaud Lacombe, linux-kbuild

Dne 24.4.2012 02:59, Eric W. Biederman napsal(a):
> 
> While verifying that my user namespace patches are as complete as I
> expect them to be I came a came across the need to build kernel
> configurations with a few choice settings disabled and everything else
> enabled.  Adding a make oldmodconfig made generating those
> configurations straight forward, as now I can set the options I care
> about and the oldmodconfig can answering everything else for me in a
> consistent way.

Doesn't

KCONFIG_ALLCONFIG=base.config make allmodconfig

do the same thing? If not, the difference should be explained in the
changelog.

Michal

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

* Re: [PATCH] kbuld: Implement oldmodconfig
  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
  1 sibling, 0 replies; 10+ messages in thread
From: Eric W. Biederman @ 2012-04-24 10:37 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kernel, Andrew Morton, Arnaud Lacombe, linux-kbuild

Michal Marek <mmarek@suse.cz> writes:

> Dne 24.4.2012 02:59, Eric W. Biederman napsal(a):
>> 
>> While verifying that my user namespace patches are as complete as I
>> expect them to be I came a came across the need to build kernel
>> configurations with a few choice settings disabled and everything else
>> enabled.  Adding a make oldmodconfig made generating those
>> configurations straight forward, as now I can set the options I care
>> about and the oldmodconfig can answering everything else for me in a
>> consistent way.
>
> Doesn't
>
> KCONFIG_ALLCONFIG=base.config make allmodconfig
>
> do the same thing? If not, the difference should be explained in the
> changelog.

The only difference apparently is that KCONFIG_ALLCONFIG... allmodconfig 
does not show up in the help and is rather unintuitively named so I
totally missed it's presence.

If I get ambitious I might fix the bug that KCONFIG_ALLCONFIG uses some
other working directory when reading a file than the directory that make
was run in.  Which is compounded by the fact that if KCONFIG_ALLCONFIG
can't find your file it treats it as if you had not specified the file
and does this all silently making it just about impossible to debug
without instrumenting up conf.c and confdata.c

So please feel free to drop my patch.

Eric

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

* [PATCH] kbuild: Add error handling to KCONFIG_ALL_CONFIG
  2012-04-24  9:20 ` Michal Marek
  2012-04-24 10:37   ` Eric W. Biederman
@ 2012-04-24 11:57   ` Eric W. Biederman
  2012-04-24 12:33     ` Michal Marek
  1 sibling, 1 reply; 10+ messages in thread
From: Eric W. Biederman @ 2012-04-24 11:57 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kernel, Andrew Morton, Arnaud Lacombe, linux-kbuild


- Only try to read the file specified if KCONFIG_ALL_CONFIG is set to
  something other than the empty string.

- 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 confusing failure mode, 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 discovery and debugging of command line typos.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 scripts/kconfig/conf.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 28910ea..af6a2db 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -579,8 +579,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 && 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) {
-- 
1.7.2.5


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

* Re: [PATCH] kbuild: Add error handling to KCONFIG_ALL_CONFIG
  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
  0 siblings, 1 reply; 10+ messages in thread
From: Michal Marek @ 2012-04-24 12:33 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-kernel, Andrew Morton, Arnaud Lacombe, linux-kbuild

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

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

* Re: [PATCH] kbuild: Add error handling to KCONFIG_ALL_CONFIG
  2012-04-24 12:33     ` Michal Marek
@ 2012-04-24 12:54       ` Eric W. Biederman
  2012-04-24 13:37         ` Michal Marek
  0 siblings, 1 reply; 10+ messages in thread
From: Eric W. Biederman @ 2012-04-24 12:54 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kernel, Andrew Morton, Arnaud Lacombe, linux-kbuild

Michal Marek <mmarek@suse.cz> writes:

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

I don't require KCONFIG_ALLCONFIG to always be a file if it is an
empty string we continue to fallback to the predefined file names.
Which is the currently documented behavior.

As for KCONFIG_ALLCONFIG=1 if people are a actually doing that the
complexity seems worth it (to not break muscle memory and/or scripts).
I was just aiming for an absolutely trivial and simple implementation.

Why do you think people have been specifying KCONFIG_ALLCONFIG=1?
instead of simply exporting KCONFIG_ALLCONFIG with an empty string?

Eric


> 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

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

* Re: [PATCH] kbuild: Add error handling to KCONFIG_ALL_CONFIG
  2012-04-24 12:54       ` Eric W. Biederman
@ 2012-04-24 13:37         ` Michal Marek
  2012-04-26  8:51           ` Eric W. Biederman
  0 siblings, 1 reply; 10+ messages in thread
From: Michal Marek @ 2012-04-24 13:37 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-kernel, Andrew Morton, Arnaud Lacombe, linux-kbuild

Dne 24.4.2012 14:54, Eric W. Biederman napsal(a):
> Michal Marek <mmarek@suse.cz> writes:
> 
>> 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:
> 
> I don't require KCONFIG_ALLCONFIG to always be a file if it is an
> empty string we continue to fallback to the predefined file names.
> Which is the currently documented behavior.

Ah, right, it says "If KCONFIG_ALLCONFIG is used without a filename, ...".


> As for KCONFIG_ALLCONFIG=1 if people are a actually doing that the
> complexity seems worth it (to not break muscle memory and/or scripts).
> I was just aiming for an absolutely trivial and simple implementation.
> 
> Why do you think people have been specifying KCONFIG_ALLCONFIG=1?
> instead of simply exporting KCONFIG_ALLCONFIG with an empty string?

I have been using KCONFIG_ALLCONFIG=1 :). It's quite natural to set env
variables to "1" to enable something. But I don't insist that this is
retained.

Michal

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

* [PATCH] kbuild: Add error handling to KCONFIG_ALL_CONFIG
  2012-04-24 13:37         ` Michal Marek
@ 2012-04-26  8:51           ` Eric W. Biederman
  2012-05-04 22:24             ` Michal Marek
  0 siblings, 1 reply; 10+ messages in thread
From: Eric W. Biederman @ 2012-04-26  8:51 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kernel, Andrew Morton, Arnaud Lacombe, linux-kbuild


- 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


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

* Re: [PATCH] kbuild: Add error handling to KCONFIG_ALL_CONFIG
  2012-04-26  8:51           ` Eric W. Biederman
@ 2012-05-04 22:24             ` Michal Marek
  0 siblings, 0 replies; 10+ messages in thread
From: Michal Marek @ 2012-05-04 22:24 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-kernel, Andrew Morton, Arnaud Lacombe, linux-kbuild

On Thu, Apr 26, 2012 at 01:51:32AM -0700, Eric W. Biederman wrote:
> 
> - 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.

Thanks, applied to kbuild.git#kconfig.

Michal

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

end of thread, other threads:[~2012-05-04 22:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2012-05-04 22:24             ` Michal Marek

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.