Skip to contentSkip to conversation

kconfig: list unknown symbols in the old .config

DISCUSSION Sergey Senozhatsky 2 participants 4 messages Aug 16, 2023 – Aug 20, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

We recently were hit (unnecessarily hard) when after kernel uprev we figured that something wasn't working. The root cause was a rename of the CONFIG_FOO option between kernel releases, which make oldconfig doesn't warn/notify about.

Would it be possible to add either a new --listunknown mode to conf or to somehow make it conf_warning("unknown symbol: %s\n", line) when it reads a line from oldconf that it cannot sym_find()?

That would save a ton of time.

#1 lore raw
Quoted 7 lines · Sergey Senozhatsky

Hi,

We recently were hit (unnecessarily hard) when after kernel uprev we figured that something wasn't working. The root cause was a rename of the CONFIG_FOO option between kernel releases, which make oldconfig doesn't warn/notify about.

Quoted 5 lines

Would it be possible to add either a new --listunknown mode to conf or to somehow make it conf_warning("unknown symbol: %s\n", line) when it reads a line from oldconf that it cannot sym_find()?

That would save a ton of time.

So I have this simple (quick-n-dirty) patch, that seem to be doing the trick. Just to show the idea.

Running make listunknown produces the following (on a hand-crafted .config):

.config:6:warning: unknown symbol: CONFIG_DISABLE_BUGS .config:7:warning: unknown symbol: CONFIG_COMPILE_GOOD_CODE_ONLY make[2]: *** [scripts/kconfig/Makefile:77: listunknown] Error 1
...

---

scripts/kconfig/conf.c +9 -0
index 33d19e419908..37b777a0848c 100644
@@ -36,6 +36,7 @@ enum input_mode {
 	yes2modconfig,
 	mod2yesconfig,
 	mod2noconfig,
+	listunknown,
 };
 static enum input_mode input_mode = oldaskconfig;
 static int input_mode_opt;
@@ -683,6 +684,7 @@ static const struct option long_opts[] = {
 	{"yes2modconfig", no_argument,       &input_mode_opt, yes2modconfig},
 	{"mod2yesconfig", no_argument,       &input_mode_opt, mod2yesconfig},
 	{"mod2noconfig",  no_argument,       &input_mode_opt, mod2noconfig},
+	{"listunknown",  no_argument,       &input_mode_opt, listunknown},
 	{NULL, 0, NULL, 0}
 };
 
@@ -712,6 +714,7 @@ static void conf_usage(const char *progname)
 	printf("  --yes2modconfig         Change answers from yes to mod if possible\n");
 	printf("  --mod2yesconfig         Change answers from mod to yes if possible\n");
 	printf("  --mod2noconfig          Change answers from mod to no if possible\n");
+	printf("  --listunknown           List symbols that are not recognized anymore\n");
 	printf("  (If none of the above is given, --oldaskconfig is the default)\n");
 }
 
@@ -823,6 +826,12 @@ int main(int ac, char **av)
 			exit(1);
 		}
 		break;
+	case listunknown:
+		if (conf_read_listunknown())
+			exit(1);
+		else
+			exit(0);
+		break;
 	default:
 		break;
 	}
scripts/kconfig/confdata.c +89 -40

153 lines not on this page · raw message

scripts/kconfig/lkc_proto.h +1 -0
index edd1e617b25c..d76faaec120a 100644
@@ -5,6 +5,7 @@
 void conf_parse(const char *name);
 int conf_read(const char *name);
 int conf_read_simple(const char *name, int);
+int conf_read_listunknown(void);
 int conf_write_defconfig(const char *name);
 int conf_write(const char *name);
 int conf_write_autoconf(int overwrite);
#2 lore raw
In reply to Sergey Senozhatsky
Quoted 11 lines · Sergey Senozhatsky

Hi,

We recently were hit (unnecessarily hard) when after kernel uprev we figured that something wasn't working. The root cause was a rename of the CONFIG_FOO option between kernel releases, which make oldconfig doesn't warn/notify about.

Would it be possible to add either a new --listunknown mode to conf or to somehow make it conf_warning("unknown symbol: %s\n", line) when it reads a line from oldconf that it cannot sym_find()?

This makes sense and I brought up this scenario a couple of days ago on a recent patch.
I can make a patch for this if needed.

Thanks,
Jesse Taube

Quoted 2 lines

That would save a ton of time.

#3 lore raw
Quoted 5 lines · Jesse T
Quoted 5 lines

We recently were hit (unnecessarily hard) when after kernel uprev we figured that something wasn't working. The root cause was a rename of the CONFIG_FOO option between kernel releases, which make oldconfig doesn't warn/notify about.

Quoted 7 lines
Quoted 3 lines

Would it be possible to add either a new --listunknown mode to conf or to somehow make it conf_warning("unknown symbol: %s\n", line) when it reads a line from oldconf that it cannot sym_find()?

This makes sense and I brought up this scenario a couple of days ago on a recent patch.
I can make a patch for this if needed.

I posted an RFC patch a couple of days ago
https://lore.kernel.org/all/[email protected]/T/#u