From patchwork Fri Jul 20 07:46:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 142442 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2650117ljj; Fri, 20 Jul 2018 00:48:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf5sE+5SZ+QI/LpGz7suwKcFIIIpcKyFMXy/ESLlLbbI6xUozuJqY07HNJxim89RZdbJGTg X-Received: by 2002:a62:15c8:: with SMTP id 191-v6mr1103341pfv.194.1532072914596; Fri, 20 Jul 2018 00:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532072914; cv=none; d=google.com; s=arc-20160816; b=GkilRSz/liU0ZxGDz9sQ40MxhYjUc8aX7Sa106f1UDwIZoRYRT1mqEfzGLTCSmtZTH k9z3OKRJVJcOQktfdTXm/76IqmkCr77x4/GLC66goNtAJOQLTLhbjHaAh7DTcnFQ0Uwq T7nY4rlcFaskvvAvbn1MnYn1PI975NCXTQjai8hhPJo/LFfyijYxS7ZuumwATCJ5a3kZ k7U4IglumtXbtPFa9RrL8Uf16B28BqjHvpD8SS4OKyfW1ujnCO1/YfhlEyGefuib78nT s62T8f96c/36S4ObDvxmw3z5qhkayH+46PKEM1P8GDmiXprMUBNLc1x6ysLZ5PngyTn4 NZLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=DL6rqdJcJnUdm3wir3gubx0P8b9ZdYaiRz2bsCRy3j8=; b=FFDc05AWpTOXaqAy/+RBnfFGRV+EuWbIOqtjAKon3rleMFXXsqlMXDtuoQwS40H37I qraiEYeQFz1vFdhrNghVrA9b09ZvO4cFZ8fdLq4f1eQaQRF8rbP7J8e1CkSeHmOMMqCP +yhLPgT1nU+cTumFIVfpvkU8ptzxc9ibichBnmEaXHXQrT/Eke5gtxqMw1n5EazEiLUt euN2NSd7sFKw4IyScK3je4es4JM4ghW+i9wDcwaJ5wV48uCtH52Hzj3FR8kJrHLsVKUf ZgzDI4E56UMCBF9wNxG8GwysZEA6HEVWKaC06k1QOK2kw5LwDd9QJYc48QUuGtFjvkBF xAIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=ds3jhj07; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p77-v6si1367630pfj.294.2018.07.20.00.48.34; Fri, 20 Jul 2018 00:48:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=ds3jhj07; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728183AbeGTIfb (ORCPT + 31 others); Fri, 20 Jul 2018 04:35:31 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:28745 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727205AbeGTIfJ (ORCPT ); Fri, 20 Jul 2018 04:35:09 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w6K7kdiv008048; Fri, 20 Jul 2018 16:46:42 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w6K7kdiv008048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532072802; bh=DL6rqdJcJnUdm3wir3gubx0P8b9ZdYaiRz2bsCRy3j8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ds3jhj07Vn1lHnauCVIt933fA5pnX9m6TvL4G/HaJ2liB+WID3NKc0j4Z/JsdXpBt Xk1NnReFUqFYFTzFQtf3aFGvHZbHrWUQfYmjxOXkhChGdw6k2ByIGPi7JuKCCKeXWn WnM0ozUOvgfAkJZTU4hxQ5svMFQMkh43Yq9Ullnnj2knjsWgmpmY0NTT8ZgN71dalI mzvJuTBoAYLOf6updg3rOyrWArx3coWT3zvVQ0Bf1IVZQBk1dQgaODStcyc9rlpDPN KMoY5pEqXWMAJs6uptcFxWT1ta1IEyN+lmQsVGXhj9YyS6ztXH2zMEsPubpAUwk3xp 6FX4hZNsNgGsQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v4 05/11] kconfig: make syncconfig update .config regardless of sym_change_count Date: Fri, 20 Jul 2018 16:46:30 +0900 Message-Id: <1532072796-7947-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> References: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org syncconfig updates the .config only when sym_change_count > 0, i.e. any change in config symbols has been detected. Not only symbols but also comments are contained in the .config file. If only comments are updated, they are not fed back to the .config, then the stale comments are left-over. Of course, this is just a matter of comments, but why not fix it. I see some scenarios where this happens. Scenario A: 1. You have a source tree that has already been configured. 2. Linus increments the version number in the top-level Makefile (i.e. he commits a new release) 3. You pull it, and run 'make' 4. syncconfig is invoked because the environment variable, KERNELVERSION is updated, but the .config is not updated since no config symbol is changed. 5. The .config file contains a kernel version in the top line: # Automatically generated file; DO NOT EDIT. # Linux/arm64 4.18.0-rc2 Kernel Configuration ... which points to a previous version. Scenario B: 1. You have a source tree that has already been configured. 2. You upgrade the compiler, but it still has the same version number. This may happen if you regularly build the latest compiler from the source code. 3. You run 'make' 4. syncconfig is invoked because the environment variable, CC_VERSION_TEXT is updated, but the .config is not updated since no config symbol is changed. 5. The .config file contains the version string of the compiler: # # Compiler: aarch64-linux-gcc (GCC) 9.0.0 20180628 (experimental) # ... which carries the information of the old compiler. If KCONFIG_NOSILENTUPDATE is set, syncconfig is not allowed to update the .config file. Otherwise, it is fine to update it regardless of sym_change_count. Signed-off-by: Masahiro Yamada --- Changes in v4: None scripts/kconfig/conf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 671ff53..5af8991 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -496,6 +496,7 @@ int main(int ac, char **av) int opt; const char *name, *defconfig_file = NULL /* gcc uninit */; struct stat tmpstat; + int no_conf_write = 0; tty_stdio = isatty(0) && isatty(1); @@ -633,13 +634,14 @@ int main(int ac, char **av) } if (sync_kconfig) { - if (conf_get_changed()) { - name = getenv("KCONFIG_NOSILENTUPDATE"); - if (name && *name) { + name = getenv("KCONFIG_NOSILENTUPDATE"); + if (name && *name) { + if (conf_get_changed()) { fprintf(stderr, "\n*** The configuration requires explicit update.\n\n"); return 1; } + no_conf_write = 1; } } @@ -688,7 +690,7 @@ int main(int ac, char **av) /* syncconfig is used during the build so we shall update autoconf. * All other commands are only used to generate a config. */ - if (conf_get_changed() && conf_write(NULL)) { + if (!no_conf_write && conf_write(NULL)) { fprintf(stderr, "\n*** Error during writing of the configuration.\n\n"); exit(1); }