Message ID | 20221229074310.906556-2-masahiroy@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2281168wrt; Wed, 28 Dec 2022 23:48:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXsGwhx5sPg714Fqou0vEp0mYsd1jFHqdeKWJnu5pjDt9jXgMyvaVQgwAdxaSBgb7xvhMU9w X-Received: by 2002:a05:6402:345a:b0:484:e097:7ac1 with SMTP id l26-20020a056402345a00b00484e0977ac1mr10935864edc.22.1672300091344; Wed, 28 Dec 2022 23:48:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672300091; cv=none; d=google.com; s=arc-20160816; b=Hgjs47/N2blLrSavDIdFYDHYXDyRt0ZbgNpr9d3H0XY6AobEHuHAb78AWg32qbK1v4 38+zpqjVXQxwSL1SnDtKKbnR7cmPuNe2OaSLI0sF9L63sxm01ub6Yx+yk/o9oVV+3Key b9sj03zXyFQojauvw4oL+YNvN9O6lx8F6r9gcxYs8QLgKbuzwCmHQmFB7unQEPlFhdRv /8tE9XEQZgLeuu46caBGpOWOtn3jdUf6jOLRfVreTdYHwJVsGdH9zVdvFURdjdXqJJef Xfe63lXbkaTb21+LD8spd4gkyTmvegxoav1lN0Pcc94ac8CkPYU2INjcRxJHCm19giwX 2Rvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jH1WjkbpOWSa/LTJu7eVhImOfW9ALbhNQduACCpnYnY=; b=eZpObghiCkQCrru7cGHFmIayW9e0l31avpgpT1gSqsAVDi4K0J4zMsY1Wzurlv/nNG E2b2l56Fikb5wdwfTKP9j/xgD1cyTXW5XJ3CWSX8qrofIoWOBBi0BI/a+2YoSYrZAZFf EcMXB45B92FurAzQk+qvbzjcKyMG2uelBRBtl0LY884OeE4aOB9ujIMF0OJbf078jTL0 N6JznIiKR9CDdZy6+STls4t/OW+OKqAPjvAwICtg4O8+eoIzfc37XIkJ5A9uzf0iVDdb 7IZNkvzRfaKEM6mrF+jVJdocFnC0apxtelt1/pGvGAqxVEjBd+5YnWXXQuiLttae0CIP NPpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FlqslimJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb25-20020a170907961900b007c195fb9e24si16915419ejc.42.2022.12.28.23.47.47; Wed, 28 Dec 2022 23:48:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FlqslimJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233002AbiL2HoB (ORCPT <rfc822;eddaouddi.ayoub@gmail.com> + 99 others); Thu, 29 Dec 2022 02:44:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232996AbiL2Hnc (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 29 Dec 2022 02:43:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73D89FD3; Wed, 28 Dec 2022 23:43:31 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E65386170C; Thu, 29 Dec 2022 07:43:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E3E0C433D2; Thu, 29 Dec 2022 07:43:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672299810; bh=/mTmrBpGVR4tHpil4FIqdwtv6srLo9Xnga3QkS7c6QQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FlqslimJZoIeBn+FrqTdBOBuFMPmaZN6s2NfM7h++iksFK0Zp4luuvQTCKa6Zwosm ShF07zAQsN11sK8jNuRVcc7h73IWcywsc3r0QfCpQmqoXyNQuz9ilOMyZGozbcPJkY 3XGLTedCy75KtsFWb1/GOLhjRLPR1OlmoHNy0FInREsa9z6RBDn9roy3lSCtl8NnZs 63M28ALmLFceylC+ruLSsaWEwAjZMLUnA14zDMIMjHrcthe4z+FvLOz/UKrSmhn29s hUoiHRZHZSIudNBpW4zDT9eFyU0LPMvuRpRAjS8Aba92jtdlbDU0T+lomB0OrpxGcm D2GkXunoyzudg== From: Masahiro Yamada <masahiroy@kernel.org> To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada <masahiroy@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Nicolas Schier <nicolas@fjasle.eu>, Nick Desaulniers <ndesaulniers@google.com> Subject: [PATCH v3 2/2] kbuild: make W=1 warn files that are tracked but ignored by git Date: Thu, 29 Dec 2022 16:43:10 +0900 Message-Id: <20221229074310.906556-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221229074310.906556-1-masahiroy@kernel.org> References: <20221229074310.906556-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753533740099054405?= X-GMAIL-MSGID: =?utf-8?q?1753533740099054405?= |
Series |
[v3,1/2] .gitignore: update the command to check tracked files being ignored
|
|
Commit Message
Masahiro Yamada
Dec. 29, 2022, 7:43 a.m. UTC
The top .gitignore comments about how to detect files breaking .gitignore rules, but people rarely care about it. Add a new W=1 warning to detect files that are tracked but ignored by git. If git is not installed or the source tree is not tracked by git at all, this script does not print anything. Running it on v6.2-rc1 detected the following: $ make W=1 misc-check Documentation/devicetree/bindings/.yamllint: warning: ignored by one of the .gitignore files drivers/clk/.kunitconfig: warning: ignored by one of the .gitignore files drivers/gpu/drm/tests/.kunitconfig: warning: ignored by one of the .gitignore files drivers/hid/.kunitconfig: warning: ignored by one of the .gitignore files fs/ext4/.kunitconfig: warning: ignored by one of the .gitignore files fs/fat/.kunitconfig: warning: ignored by one of the .gitignore files kernel/kcsan/.kunitconfig: warning: ignored by one of the .gitignore files lib/kunit/.kunitconfig: warning: ignored by one of the .gitignore files mm/kfence/.kunitconfig: warning: ignored by one of the .gitignore files tools/testing/selftests/arm64/tags/.gitignore: warning: ignored by one of the .gitignore files tools/testing/selftests/arm64/tags/Makefile: warning: ignored by one of the .gitignore files tools/testing/selftests/arm64/tags/run_tags_test.sh: warning: ignored by one of the .gitignore files tools/testing/selftests/arm64/tags/tags_test.c: warning: ignored by one of the .gitignore files These are ignored by the '.*' or 'tags' in the top .gitignore, but there is no rule to negate it. You might be tempted to do 'git add -f' but I want to have the real issue fixed (by fixing a .gitignore, or by renaming files, etc.). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> --- Changes in v3: - change working directory to srctree (Nicolas) Changes in v2: - Add $(srctree)/ to make it work with O= Makefile | 6 ++++++ scripts/misc-check | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 scripts/misc-check
Comments
On Thu, Dec 29, 2022 at 04:43:10PM +0900 Masahiro Yamada wrote: > The top .gitignore comments about how to detect files breaking > .gitignore rules, but people rarely care about it. > > Add a new W=1 warning to detect files that are tracked but ignored by > git. If git is not installed or the source tree is not tracked by git > at all, this script does not print anything. > > Running it on v6.2-rc1 detected the following: > > $ make W=1 misc-check > Documentation/devicetree/bindings/.yamllint: warning: ignored by one of the .gitignore files > drivers/clk/.kunitconfig: warning: ignored by one of the .gitignore files > drivers/gpu/drm/tests/.kunitconfig: warning: ignored by one of the .gitignore files > drivers/hid/.kunitconfig: warning: ignored by one of the .gitignore files > fs/ext4/.kunitconfig: warning: ignored by one of the .gitignore files > fs/fat/.kunitconfig: warning: ignored by one of the .gitignore files > kernel/kcsan/.kunitconfig: warning: ignored by one of the .gitignore files > lib/kunit/.kunitconfig: warning: ignored by one of the .gitignore files > mm/kfence/.kunitconfig: warning: ignored by one of the .gitignore files > tools/testing/selftests/arm64/tags/.gitignore: warning: ignored by one of the .gitignore files > tools/testing/selftests/arm64/tags/Makefile: warning: ignored by one of the .gitignore files > tools/testing/selftests/arm64/tags/run_tags_test.sh: warning: ignored by one of the .gitignore files > tools/testing/selftests/arm64/tags/tags_test.c: warning: ignored by one of the .gitignore files > > These are ignored by the '.*' or 'tags' in the top .gitignore, but > there is no rule to negate it. > > You might be tempted to do 'git add -f' but I want to have the real > issue fixed (by fixing a .gitignore, or by renaming files, etc.). > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > Reviewed-by: Nathan Chancellor <nathan@kernel.org> > Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> > --- > > Changes in v3: > - change working directory to srctree (Nicolas) > > Changes in v2: > - Add $(srctree)/ to make it work with O= > > Makefile | 6 ++++++ > scripts/misc-check | 19 +++++++++++++++++++ > 2 files changed, 25 insertions(+) > create mode 100755 scripts/misc-check Tested-by: Nicolas Schier <nicolas@fjasle.eu> out of curiosity: do you plan to implement more checks in the misc-checks target? Kind regards, Nicolas
On Thu, Dec 29, 2022 at 11:23 PM Nicolas Schier <nicolas@fjasle.eu> wrote: > > On Thu, Dec 29, 2022 at 04:43:10PM +0900 Masahiro Yamada wrote: > > The top .gitignore comments about how to detect files breaking > > .gitignore rules, but people rarely care about it. > > > > Add a new W=1 warning to detect files that are tracked but ignored by > > git. If git is not installed or the source tree is not tracked by git > > at all, this script does not print anything. > > > > Running it on v6.2-rc1 detected the following: > > > > $ make W=1 misc-check > > Documentation/devicetree/bindings/.yamllint: warning: ignored by one of the .gitignore files > > drivers/clk/.kunitconfig: warning: ignored by one of the .gitignore files > > drivers/gpu/drm/tests/.kunitconfig: warning: ignored by one of the .gitignore files > > drivers/hid/.kunitconfig: warning: ignored by one of the .gitignore files > > fs/ext4/.kunitconfig: warning: ignored by one of the .gitignore files > > fs/fat/.kunitconfig: warning: ignored by one of the .gitignore files > > kernel/kcsan/.kunitconfig: warning: ignored by one of the .gitignore files > > lib/kunit/.kunitconfig: warning: ignored by one of the .gitignore files > > mm/kfence/.kunitconfig: warning: ignored by one of the .gitignore files > > tools/testing/selftests/arm64/tags/.gitignore: warning: ignored by one of the .gitignore files > > tools/testing/selftests/arm64/tags/Makefile: warning: ignored by one of the .gitignore files > > tools/testing/selftests/arm64/tags/run_tags_test.sh: warning: ignored by one of the .gitignore files > > tools/testing/selftests/arm64/tags/tags_test.c: warning: ignored by one of the .gitignore files > > > > These are ignored by the '.*' or 'tags' in the top .gitignore, but > > there is no rule to negate it. > > > > You might be tempted to do 'git add -f' but I want to have the real > > issue fixed (by fixing a .gitignore, or by renaming files, etc.). > > > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > > Reviewed-by: Nathan Chancellor <nathan@kernel.org> > > Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> > > --- > > > > Changes in v3: > > - change working directory to srctree (Nicolas) > > > > Changes in v2: > > - Add $(srctree)/ to make it work with O= > > > > Makefile | 6 ++++++ > > scripts/misc-check | 19 +++++++++++++++++++ > > 2 files changed, 25 insertions(+) > > create mode 100755 scripts/misc-check > > Tested-by: Nicolas Schier <nicolas@fjasle.eu> > > out of curiosity: do you plan to implement more checks in the misc-checks > target? I chose a generic name so I can put more in this script, but honestly I have nothing else in my mind for now. > > Kind regards, > Nicolas >
On Thu, Dec 29, 2022 at 04:43:10PM +0900, Masahiro Yamada wrote: > The top .gitignore comments about how to detect files breaking > .gitignore rules, but people rarely care about it. > > Add a new W=1 warning to detect files that are tracked but ignored by > git. If git is not installed or the source tree is not tracked by git > at all, this script does not print anything. > > Running it on v6.2-rc1 detected the following: Since patch was published there is no sign it was ever meet Linux Next. What's the plan?
On Fri, Jan 27, 2023 at 10:25 PM Andy Shevchenko <andriy.shevchenko@intel.com> wrote: > > On Thu, Dec 29, 2022 at 04:43:10PM +0900, Masahiro Yamada wrote: > > The top .gitignore comments about how to detect files breaking > > .gitignore rules, but people rarely care about it. > > > > Add a new W=1 warning to detect files that are tracked but ignored by > > git. If git is not installed or the source tree is not tracked by git > > at all, this script does not print anything. > > > > Running it on v6.2-rc1 detected the following: > > Since patch was published there is no sign it was ever meet Linux Next. > What's the plan? Oh? I can see this patch in linux-next. $ git log next-20230127 -- scripts/misc-check
On Fri, Jan 27, 2023 at 11:31:07PM +0900, Masahiro Yamada wrote: > On Fri, Jan 27, 2023 at 10:25 PM Andy Shevchenko > <andriy.shevchenko@intel.com> wrote: > > > > On Thu, Dec 29, 2022 at 04:43:10PM +0900, Masahiro Yamada wrote: > > > The top .gitignore comments about how to detect files breaking > > > .gitignore rules, but people rarely care about it. > > > > > > Add a new W=1 warning to detect files that are tracked but ignored by > > > git. If git is not installed or the source tree is not tracked by git > > > at all, this script does not print anything. > > > > > > Running it on v6.2-rc1 detected the following: > > > > Since patch was published there is no sign it was ever meet Linux Next. > > What's the plan? > > Oh? Sorry, my mistake. I need to understand why these patches do not fix the issue I have. > I can see this patch in linux-next. > > $ git log next-20230127 -- scripts/misc-check
On Fri, Jan 27, 2023 at 04:41:37PM +0200, Andy Shevchenko wrote: > On Fri, Jan 27, 2023 at 11:31:07PM +0900, Masahiro Yamada wrote: > > On Fri, Jan 27, 2023 at 10:25 PM Andy Shevchenko > > <andriy.shevchenko@intel.com> wrote: > > > > > > On Thu, Dec 29, 2022 at 04:43:10PM +0900, Masahiro Yamada wrote: > > > > The top .gitignore comments about how to detect files breaking > > > > .gitignore rules, but people rarely care about it. > > > > > > > > Add a new W=1 warning to detect files that are tracked but ignored by > > > > git. If git is not installed or the source tree is not tracked by git > > > > at all, this script does not print anything. > > > > > > > > Running it on v6.2-rc1 detected the following: > > > > > > Since patch was published there is no sign it was ever meet Linux Next. > > > What's the plan? > > > > Oh? > > Sorry, my mistake. I need to understand why these patches do not fix > the issue I have. OK, after carefully reading the commit message it's actually the culprit of the warnings I have. So, it seems we need to wait maintainers / developers of the respective code to go and fix this. Is it your intention?
On Fri, Jan 27, 2023 at 11:50 PM Andy Shevchenko <andriy.shevchenko@intel.com> wrote: > > On Fri, Jan 27, 2023 at 04:41:37PM +0200, Andy Shevchenko wrote: > > On Fri, Jan 27, 2023 at 11:31:07PM +0900, Masahiro Yamada wrote: > > > On Fri, Jan 27, 2023 at 10:25 PM Andy Shevchenko > > > <andriy.shevchenko@intel.com> wrote: > > > > > > > > On Thu, Dec 29, 2022 at 04:43:10PM +0900, Masahiro Yamada wrote: > > > > > The top .gitignore comments about how to detect files breaking > > > > > .gitignore rules, but people rarely care about it. > > > > > > > > > > Add a new W=1 warning to detect files that are tracked but ignored by > > > > > git. If git is not installed or the source tree is not tracked by git > > > > > at all, this script does not print anything. > > > > > > > > > > Running it on v6.2-rc1 detected the following: > > > > > > > > Since patch was published there is no sign it was ever meet Linux Next. > > > > What's the plan? > > > > > > Oh? > > > > Sorry, my mistake. I need to understand why these patches do not fix > > the issue I have. > > OK, after carefully reading the commit message it's actually the culprit of > the warnings I have. > > So, it seems we need to wait maintainers / developers of the respective code > to go and fix this. Is it your intention? Yes. I expect the 0day bot will block new breakages, but actually the mainline got more warnings under kselftest.
diff --git a/Makefile b/Makefile index acce5ec514f6..c0d7c75d8f14 100644 --- a/Makefile +++ b/Makefile @@ -1848,6 +1848,12 @@ rust-analyzer: # Misc # --------------------------------------------------------------------------- +PHONY += misc-check +misc-check: + $(Q)$(srctree)/scripts/misc-check + +all: misc-check + PHONY += scripts_gdb scripts_gdb: prepare0 $(Q)$(MAKE) $(build)=scripts/gdb diff --git a/scripts/misc-check b/scripts/misc-check new file mode 100755 index 000000000000..d40d5484e0c5 --- /dev/null +++ b/scripts/misc-check @@ -0,0 +1,19 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-only + +set -e + +# Detect files that are tracked but ignored by git. This is checked only when +# ${KBUILD_EXTRA_WARN} contains 1, git is installed, and the source tree is +# tracked by git. +check_tracked_ignored_files () { + case "${KBUILD_EXTRA_WARN}" in + *1*) ;; + *) return;; + esac + + git -C ${srctree:-.} ls-files -i -c --exclude-per-directory=.gitignore 2>/dev/null | + sed 's/$/: warning: ignored by one of the .gitignore files/' >&2 +} + +check_tracked_ignored_files