Commit 5efe241e authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Michal Marek

kconfig: Add error handling to KCONFIG_ALLCONFIG

- 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: default avatarEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
parent dd775ae2
...@@ -53,15 +53,15 @@ KCONFIG_ALLCONFIG ...@@ -53,15 +53,15 @@ KCONFIG_ALLCONFIG
-------------------------------------------------- --------------------------------------------------
(partially based on lkml email from/by Rob Landley, re: miniconfig) (partially based on lkml email from/by Rob Landley, re: miniconfig)
-------------------------------------------------- --------------------------------------------------
The allyesconfig/allmodconfig/allnoconfig/randconfig variants can The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also
also use the environment variable KCONFIG_ALLCONFIG as a flag or a use the environment variable KCONFIG_ALLCONFIG as a flag or a filename
filename that contains config symbols that the user requires to be that contains config symbols that the user requires to be set to a
set to a specific value. If KCONFIG_ALLCONFIG is used without a specific value. If KCONFIG_ALLCONFIG is used without a filename where
filename, "make *config" checks for a file named KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", "make *config"
"all{yes/mod/no/def/random}.config" (corresponding to the *config command checks for a file named "all{yes/mod/no/def/random}.config"
that was used) for symbol values that are to be forced. If this file (corresponding to the *config command that was used) for symbol values
is not found, it checks for a file named "all.config" to contain forced that are to be forced. If this file is not found, it checks for a
values. file named "all.config" to contain forced values.
This enables you to create "miniature" config (miniconfig) or custom This enables you to create "miniature" config (miniconfig) or custom
config files containing just the config symbols that you are interested config files containing just the config symbols that you are interested
......
...@@ -574,8 +574,13 @@ int main(int ac, char **av) ...@@ -574,8 +574,13 @@ int main(int ac, char **av)
case alldefconfig: case alldefconfig:
case randconfig: case randconfig:
name = getenv("KCONFIG_ALLCONFIG"); name = getenv("KCONFIG_ALLCONFIG");
if (name && !stat(name, &tmpstat)) { if (name && (strcmp(name, "") != 0) && (strcmp(name, "1") != 0)) {
conf_read_simple(name, S_DEF_USER); if (conf_read_simple(name, S_DEF_USER)) {
fprintf(stderr,
_("*** Can't read seed configuration \"%s\"!\n"),
name);
exit(1);
}
break; break;
} }
switch (input_mode) { switch (input_mode) {
...@@ -586,10 +591,13 @@ int main(int ac, char **av) ...@@ -586,10 +591,13 @@ int main(int ac, char **av)
case randconfig: name = "allrandom.config"; break; case randconfig: name = "allrandom.config"; break;
default: break; default: break;
} }
if (!stat(name, &tmpstat)) if (conf_read_simple(name, S_DEF_USER) &&
conf_read_simple(name, S_DEF_USER); conf_read_simple("all.config", S_DEF_USER)) {
else if (!stat("all.config", &tmpstat)) fprintf(stderr,
conf_read_simple("all.config", S_DEF_USER); _("*** KCONFIG_ALLCONFIG set, but no \"%s\" or \"all.config\" file found\n"),
name);
exit(1);
}
break; break;
default: default:
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment