lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 29 Dec 2022 16:36:59 +0900
From:   Masahiro Yamada <masahiroy@...nel.org>
To:     Nicolas Schier <nicolas@...sle.eu>
Cc:     linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>
Subject: Re: [PATCH v2 2/2] kbuild: make W=1 warn files that are tracked but
 ignored by git

On Thu, Dec 29, 2022 at 1:48 AM Nicolas Schier <nicolas@...sle.eu> wrote:
>
> On Sun 25 Dec 2022 00:51:38 GMT, 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 the v6.1 kernel 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@...nel.org>
> > ---
> >
> > 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
> >
> > diff --git a/Makefile b/Makefile
> > index 44239352d2bf..f6ff8f77a669 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1852,6 +1852,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..bf68712d1ac1
> > --- /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 ls-files -i -c --exclude-per-directory=.gitignore 2>/dev/null |
> > +             sed 's/$/: warning: ignored by one of the .gitignore files/' >&2
>
> I like that check.  It doesn't work with O=...; works for me with
> something like:
>
>   git ${abs_srctree:+-C "${abs_srctree}"} ls-files ...



A good catch!

I will fix it in v3.
Thanks.




>
> Reviewed-by: Nicolas Schier <nicolas@...sle.eu>



-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists