Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kconfig: fix silentoldconfig

Recent changes to oldconfig have mixed up the silentoldconfig handling,
so this fixes that by clearly separating that special mode, e.g.
KCONFIG_NOSILENTUPDATE is only relevant here, the .config is written as
needed.

This will also properly close Bug 11230.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

zippel@linux-m68k.org and committed by
Linus Torvalds
204c96f6 d0185c08

+57 -66
+57 -66
scripts/kconfig/conf.c
··· 32 32 33 33 static int indent = 1; 34 34 static int valid_stdin = 1; 35 + static int sync_kconfig; 35 36 static int conf_cnt; 36 37 static char line[128]; 37 38 static struct menu *rootEntry; ··· 66 65 67 66 static void check_stdin(void) 68 67 { 69 - if (!valid_stdin && input_mode == ask_silent) { 68 + if (!valid_stdin) { 70 69 printf(_("aborted!\n\n")); 71 70 printf(_("Console input/output is redirected. ")); 72 71 printf(_("Run 'make oldconfig' to update configuration.\n\n")); ··· 428 427 check_conf(child); 429 428 } 430 429 431 - static void conf_do_update(void) 432 - { 433 - /* Update until a loop caused no more changes */ 434 - do { 435 - conf_cnt = 0; 436 - check_conf(&rootmenu); 437 - } while (conf_cnt); 438 - } 439 - 440 - static int conf_silent_update(void) 441 - { 442 - const char *name; 443 - 444 - if (conf_get_changed()) { 445 - name = getenv("KCONFIG_NOSILENTUPDATE"); 446 - if (name && *name) { 447 - fprintf(stderr, 448 - _("\n*** Kernel configuration requires explicit update.\n\n")); 449 - return 1; 450 - } 451 - conf_do_update(); 452 - } 453 - return 0; 454 - } 455 - 456 - static int conf_update(void) 457 - { 458 - rootEntry = &rootmenu; 459 - conf(&rootmenu); 460 - if (input_mode == ask_all) { 461 - input_mode = ask_silent; 462 - valid_stdin = 1; 463 - } 464 - conf_do_update(); 465 - return 0; 466 - } 467 - 468 430 int main(int ac, char **av) 469 431 { 470 432 int opt; ··· 441 477 while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) { 442 478 switch (opt) { 443 479 case 'o': 444 - input_mode = ask_new; 480 + input_mode = ask_silent; 445 481 break; 446 482 case 's': 447 483 input_mode = ask_silent; 448 - valid_stdin = isatty(0) && isatty(1) && isatty(2); 484 + sync_kconfig = 1; 449 485 break; 450 486 case 'd': 451 487 input_mode = set_default; ··· 483 519 name = av[optind]; 484 520 conf_parse(name); 485 521 //zconfdump(stdout); 522 + if (sync_kconfig) { 523 + if (stat(".config", &tmpstat)) { 524 + fprintf(stderr, _("***\n" 525 + "*** You have not yet configured your kernel!\n" 526 + "*** (missing kernel .config file)\n" 527 + "***\n" 528 + "*** Please run some configurator (e.g. \"make oldconfig\" or\n" 529 + "*** \"make menuconfig\" or \"make xconfig\").\n" 530 + "***\n")); 531 + exit(1); 532 + } 533 + } 534 + 486 535 switch (input_mode) { 487 536 case set_default: 488 537 if (!defconfig_file) ··· 508 531 } 509 532 break; 510 533 case ask_silent: 511 - if (stat(".config", &tmpstat)) { 512 - printf(_("***\n" 513 - "*** You have not yet configured your kernel!\n" 514 - "*** (missing kernel .config file)\n" 515 - "***\n" 516 - "*** Please run some configurator (e.g. \"make oldconfig\" or\n" 517 - "*** \"make menuconfig\" or \"make xconfig\").\n" 518 - "***\n")); 519 - exit(1); 520 - } 521 534 case ask_all: 522 535 case ask_new: 523 536 conf_read(NULL); ··· 536 569 default: 537 570 break; 538 571 } 572 + 573 + if (sync_kconfig) { 574 + if (conf_get_changed()) { 575 + name = getenv("KCONFIG_NOSILENTUPDATE"); 576 + if (name && *name) { 577 + fprintf(stderr, 578 + _("\n*** Kernel configuration requires explicit update.\n\n")); 579 + return 1; 580 + } 581 + } 582 + valid_stdin = isatty(0) && isatty(1) && isatty(2); 583 + } 584 + 539 585 switch (input_mode) { 540 586 case set_no: 541 587 conf_set_all_new_symbols(def_no); ··· 565 585 case set_default: 566 586 conf_set_all_new_symbols(def_default); 567 587 break; 568 - case ask_silent: 569 588 case ask_new: 570 - if (conf_silent_update()) 571 - exit(1); 572 - break; 573 589 case ask_all: 574 - if (conf_update()) 575 - exit(1); 590 + rootEntry = &rootmenu; 591 + conf(&rootmenu); 592 + input_mode = ask_silent; 593 + /* fall through */ 594 + case ask_silent: 595 + /* Update until a loop caused no more changes */ 596 + do { 597 + conf_cnt = 0; 598 + check_conf(&rootmenu); 599 + } while (conf_cnt); 576 600 break; 577 601 } 578 602 579 - if (conf_write(NULL)) { 580 - fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 581 - exit(1); 582 - } 583 - /* ask_silent is used during the build so we shall update autoconf. 584 - * All other commands are only used to generate a config. 585 - */ 586 - if (input_mode == ask_silent && conf_write_autoconf()) { 587 - fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 588 - return 1; 603 + if (sync_kconfig) { 604 + /* silentoldconfig is used during the build so we shall update autoconf. 605 + * All other commands are only used to generate a config. 606 + */ 607 + if (conf_get_changed() && conf_write(NULL)) { 608 + fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 609 + exit(1); 610 + } 611 + if (conf_write_autoconf()) { 612 + fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n")); 613 + return 1; 614 + } 615 + } else { 616 + if (conf_write(NULL)) { 617 + fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 618 + exit(1); 619 + } 589 620 } 590 621 return 0; 591 622 }