linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: Nicolas Porcel <nicolasporcel06@gmail.com>
Cc: Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>
Subject: Re: [PATCH 2/2] kconfig: support out of tree KCONFIG_CONFIG
Date: Sat, 2 Sep 2017 16:31:44 +0900	[thread overview]
Message-ID: <CAK7LNAQWFKFcm2PbOc-wc2bP1YmKBObhyyWr51mw6MCZRzVGOQ@mail.gmail.com> (raw)
In-Reply-To: <20170818222052.22375-3-nicolasporcel06@gmail.com>

2017-08-19 7:20 GMT+09:00 Nicolas Porcel <nicolasporcel06@gmail.com>:
> If KCONFIG_CONFIG is on a different file system than the kernel source,
> oldconfig/defconfig will fail due to the use of rename in conf_write. It
> will also fail if the kernel source directory is not writable.

If the kernel source is not writable, O= should be used.


> This patch changes the behavior of conf_write to be more intuitive.
>
> When no argument is passed to conf_write, KCONFIG_CONFIG is used instead
> for the config path. The consequence is that the .tmpconfig.%(pid) is
> written in the same directory as KCONFIG_CONFIG.
>
> Some defaulting logic has been added, allowing the use of a directory
> for KCONFIG_CONFIG. In that case, the .config file will be written in
> this directory.



I think KCONFIG_CONFIG only contains a file name
and this restriction is intentional
because conf_write() might be called with a directory path (for
example from gconf.c)


If we change the behavior,
I think conf_write() should just error-out
when directory path is given.



> Signed-off-by: Nicolas Porcel <nicolasporcel06@gmail.com>
> ---
>  scripts/kconfig/confdata.c | 35 ++++++++++++++++++++---------------
>  1 file changed, 20 insertions(+), 15 deletions(-)
>
> diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
> index 297b079ae4d9..3c2b7155a385 100644
> --- a/scripts/kconfig/confdata.c
> +++ b/scripts/kconfig/confdata.c
> @@ -743,32 +743,37 @@ int conf_write(const char *name)
>         FILE *out;
>         struct symbol *sym;
>         struct menu *menu;
> +       struct stat st;
>         const char *basename;
>         const char *str;
>         char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
>         char *env;
> +       char *slash;
> +
> +       const char *configname = conf_get_configname();
>
>         dirname[0] = 0;
> -       if (name && name[0]) {
> -               struct stat st;
> -               char *slash;
> -
> -               if (!stat(name, &st) && S_ISDIR(st.st_mode)) {
> -                       strcpy(dirname, name);
> -                       strcat(dirname, "/");
> -                       basename = conf_get_configname();
> -               } else if ((slash = strrchr(name, '/'))) {
> +       if (!name || !name[0])
> +               name = configname;
> +
> +       if (!stat(name, &st) && S_ISDIR(st.st_mode)) {
> +               strcpy(dirname, name);
> +               strcat(dirname, "/");
> +               if (name == configname || strchr(configname, '/'))
> +                       basename =  ".config";


Hmm, I think the intention of conf_get_configname() is
to avoid the bare use of ".config"






-- 
Best Regards
Masahiro Yamada

  reply	other threads:[~2017-09-02  7:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-18 22:20 [PATCH 0/2] Improve KCONFIG_CONFIG use in kconfig Nicolas Porcel
2017-08-18 22:20 ` [PATCH 1/2] kconfig: Use KCONFIG_CONFIG in buildtar Nicolas Porcel
2017-09-02  4:58   ` Masahiro Yamada
2017-08-18 22:20 ` [PATCH 2/2] kconfig: support out of tree KCONFIG_CONFIG Nicolas Porcel
2017-09-02  7:31   ` Masahiro Yamada [this message]
2017-09-02 22:21     ` Nicolas Porcel
2017-09-20  9:56       ` Masahiro Yamada
2017-09-21 23:41         ` Nicolas Porcel
2017-09-02  4:55 ` [PATCH 0/2] Improve KCONFIG_CONFIG use in kconfig Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK7LNAQWFKFcm2PbOc-wc2bP1YmKBObhyyWr51mw6MCZRzVGOQ@mail.gmail.com \
    --to=yamada.masahiro@socionext.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=nicolasporcel06@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).