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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7LNASQEXB2bnH1+yj8Xg-Xyb7x4Fi4KJrkowA8dyccyfvfPQ@mail.gmail.com>
Date: Tue, 6 Aug 2024 18:49:35 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Théo Lebrun <theo.lebrun@...tlin.com>
Cc: Nathan Chancellor <nathan@...nel.org>, Nicolas Schier <nicolas@...sle.eu>, 
	Nick Desaulniers <ndesaulniers@...gle.com>, Bill Wendling <morbo@...gle.com>, 
	Justin Stitt <justinstitt@...gle.com>, llvm@...ts.linux.dev, linux-kbuild@...r.kernel.org, 
	linux-kernel@...r.kernel.org, Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH] scripts: run-clang-tools: add file filtering option

On Mon, Aug 5, 2024 at 5:39 PM Théo Lebrun <theo.lebrun@...tlin.com> wrote:
>
> Hello Masahiro,
>
> On Sat Aug 3, 2024 at 10:42 AM CEST, Masahiro Yamada wrote:
> > On Thu, Jul 4, 2024 at 6:28 PM Théo Lebrun <theo.lebrun@...tlin.com> wrote:
> > > +def filter_entries(datastore, filters):
> > > +    for entry in datastore:
> > > +        if filters == []:
> > > +            yield entry
> > > +            continue
> >
> > Maybe, this can be checked on the caller side.
> > (Note, I did not test this at all)
> >
> > if args.file_filter:
> >         datastore = filter_entries(datastore, args.file_filter)
>
> Agreed.
>
> > > +
> > > +        assert entry['file'].startswith(entry['directory'])
> > > +        # filepath is relative to the directory, to avoid matching on the absolute path
> >
> > Does this assertion work with the separate output directory
> > (O= option)?
> >
> > Just try this command:
> >
> >  $ make LLVM=1 O=/tmp/foo clang-tidy
>
> Indeed this does not work. It requires some changes to Makefiles to see
> that it does not work, as this assertion is only used when a filter is
> passed (which current cmd_clang_tools cannot do).
>
> What would you recommend to fix that? If we take the first entry:
>
>   {
>     "command": "clang ...",
>     "directory": "/tmp/foo",
>     "file": "/ABSOLUTE/PATH/linux-clang-tidy/arch/mips/crypto/crc32-mips.c"
>   },
>
> I don't see an easy way to know that "/ABSOLUTE/PATH/linux-clang-tidy/"
> should be removed. We could probably compute it from the command value
> but that isn't a great way forward.
>
> There are some entries that look like this. Those are easy to deal with.
>
>   {
>     "command": "clang ...",
>     "directory": "/tmp/foo",
>     "file": "/tmp/foo/drivers/tty/vt/defkeymap.c"
>   }


The top of the source tree is derived from __file__

  srctree = str(pathlib.Path(__file__).parents[2].resolve())








--
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ