* Re: [PATCH] kconfig: fix failing to generate auto.conf [not found] <20220210062953.21285-1-3090101217@zju.edu.cn> @ 2022-02-11 4:27 ` Masahiro Yamada 2022-02-11 9:27 ` [PATCH v2] " 3090101217 0 siblings, 1 reply; 3+ messages in thread From: Masahiro Yamada @ 2022-02-11 4:27 UTC (permalink / raw) To: 3090101217 Cc: Linux Kbuild mailing list, Linux Kernel Mailing List, Jing Leng On Thu, Feb 10, 2022 at 3:40 PM <3090101217@zju.edu.cn> wrote: > > From: Jing Leng <jleng@ambarella.com> > > When the KCONFIG_AUTOCONFIG is specified (e.g. export \ > KCONFIG_AUTOCONFIG=output/config/auto.conf), the directory of > include/config/ will not be created, so kconfig can't create deps > files in it and auto.conf can't be generated. > > Signed-off-by: Jing Leng <jleng@ambarella.com> > --- > scripts/kconfig/confdata.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c > index 59717be31210..800ecf9934bc 100644 > --- a/scripts/kconfig/confdata.c > +++ b/scripts/kconfig/confdata.c > @@ -994,14 +994,15 @@ static int conf_write_autoconf_cmd(const char *autoconf_name) > > static int conf_touch_deps(void) > { > - const char *name; > + const char *name, *tmp; > struct symbol *sym; > int res, i; > > - strcpy(depfile_path, "include/config/"); > - depfile_prefix_len = strlen(depfile_path); > - > name = conf_get_autoconfig_name(); > + depfile_prefix_len = ((tmp = strrchr(name, '/'))) ? (tmp - name) + 1 : 0; > + strncpy(depfile_path, name, depfile_prefix_len); > + depfile_path[depfile_prefix_len] = 0; > + > conf_read_simple(name, S_DEF_AUTO); > sym_calc_value(modules_sym); > > -- > 2.17.1 > Thanks. I wanted to pick up this patch, but could not find it in the patchwork (https://patchwork.kernel.org/project/linux-kbuild/list/) despite you apparently CC'ed the kbuild ML. Do you know why? (I do not know if the kbuild/kernel ML requires subscription...) If you have a chance for re-submission, can you change the code like follows? depfile_prefix_len = ((tmp = strrchr(name, '/'))) ? (tmp - name) + 1 : 0; tmp = tmp = strrchr(name, '/'); depfile_prefix_len = tmp ? tmp - name + 1 : 0; Too many parentheses make the code unreadable. -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] kconfig: fix failing to generate auto.conf 2022-02-11 4:27 ` [PATCH] kconfig: fix failing to generate auto.conf Masahiro Yamada @ 2022-02-11 9:27 ` 3090101217 2022-02-12 16:15 ` Masahiro Yamada 0 siblings, 1 reply; 3+ messages in thread From: 3090101217 @ 2022-02-11 9:27 UTC (permalink / raw) To: masahiroy; +Cc: linux-kbuild, linux-kernel, Jing Leng From: Jing Leng <jleng@ambarella.com> When the KCONFIG_AUTOCONFIG is specified (e.g. export \ KCONFIG_AUTOCONFIG=output/config/auto.conf), the directory of include/config/ will not be created, so kconfig can't create deps files in it and auto.conf can't be generated. Signed-off-by: Jing Leng <jleng@ambarella.com> --- scripts/kconfig/confdata.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 59717be31210..974a079e8901 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -994,14 +994,19 @@ static int conf_write_autoconf_cmd(const char *autoconf_name) static int conf_touch_deps(void) { - const char *name; + const char *name, *tmp; struct symbol *sym; int res, i; - strcpy(depfile_path, "include/config/"); - depfile_prefix_len = strlen(depfile_path); - name = conf_get_autoconfig_name(); + tmp = strrchr(name, '/'); + depfile_prefix_len = tmp ? (tmp - name) + 1 : 0; + if (depfile_prefix_len + 1 > sizeof(depfile_path)) + return -1; + + strncpy(depfile_path, name, depfile_prefix_len); + depfile_path[depfile_prefix_len] = 0; + conf_read_simple(name, S_DEF_AUTO); sym_calc_value(modules_sym); -- 2.17.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] kconfig: fix failing to generate auto.conf 2022-02-11 9:27 ` [PATCH v2] " 3090101217 @ 2022-02-12 16:15 ` Masahiro Yamada 0 siblings, 0 replies; 3+ messages in thread From: Masahiro Yamada @ 2022-02-12 16:15 UTC (permalink / raw) To: 3090101217 Cc: Linux Kbuild mailing list, Linux Kernel Mailing List, Jing Leng On Fri, Feb 11, 2022 at 6:29 PM <3090101217@zju.edu.cn> wrote: > > From: Jing Leng <jleng@ambarella.com> > > When the KCONFIG_AUTOCONFIG is specified (e.g. export \ > KCONFIG_AUTOCONFIG=output/config/auto.conf), the directory of > include/config/ will not be created, so kconfig can't create deps > files in it and auto.conf can't be generated. > > Signed-off-by: Jing Leng <jleng@ambarella.com> Applied to linux-kbuild/fixes. Thanks. > --- > scripts/kconfig/confdata.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c > index 59717be31210..974a079e8901 100644 > --- a/scripts/kconfig/confdata.c > +++ b/scripts/kconfig/confdata.c > @@ -994,14 +994,19 @@ static int conf_write_autoconf_cmd(const char *autoconf_name) > > static int conf_touch_deps(void) > { > - const char *name; > + const char *name, *tmp; > struct symbol *sym; > int res, i; > > - strcpy(depfile_path, "include/config/"); > - depfile_prefix_len = strlen(depfile_path); > - > name = conf_get_autoconfig_name(); > + tmp = strrchr(name, '/'); > + depfile_prefix_len = tmp ? (tmp - name) + 1 : 0; > + if (depfile_prefix_len + 1 > sizeof(depfile_path)) > + return -1; > + > + strncpy(depfile_path, name, depfile_prefix_len); > + depfile_path[depfile_prefix_len] = 0; > + > conf_read_simple(name, S_DEF_AUTO); > sym_calc_value(modules_sym); > > -- > 2.17.1 > -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-12 16:16 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20220210062953.21285-1-3090101217@zju.edu.cn> 2022-02-11 4:27 ` [PATCH] kconfig: fix failing to generate auto.conf Masahiro Yamada 2022-02-11 9:27 ` [PATCH v2] " 3090101217 2022-02-12 16:15 ` Masahiro Yamada
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).