Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Brendan Jackman <jackmanb@google.com>
To: Nicolas Schier <nsc@kernel.org>, Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,  <linux-kernel@vger.kernel.org>,
	Justin Stitt <justinstitt@google.com>,  <llvm@lists.linux.dev>,
	<linux-kbuild@vger.kernel.org>
Subject: Re: [PATCH] .gitignore: ignore temporary files from 'bear'
Date: Mon, 01 Sep 2025 11:29:44 +0000	[thread overview]
Message-ID: <DCHFGJXCAPAZ.3JG065Y5DZVLZ@google.com> (raw)
In-Reply-To: <aLNQFmgS2IcDbPmd@levanger>

On Sat Aug 30, 2025 at 7:25 PM UTC, Nicolas Schier wrote:
> On Fri, Aug 29, 2025 at 04:38:24PM -0700, Nathan Chancellor wrote:
>> Hi Brendan,
>> 
>> On Wed, Aug 27, 2025 at 08:59:43AM +0000, Brendan Jackman wrote:
>> > Bear [0] is a tool for generating compile_commands.json. For Kbuild,
>> > Bear is not useful, since Kbuild already generates the necessary info
>> > and that can be converted to compile_commands.json by
>> > gen_compile_commads.py.
>> > 
>> > However, for code in tools/, it's handy. For example, this command
>> > updates compile_commands.json so that clangd code navigation will also
>> > work for the VMA unit tests:
>> > 
>> > 	bear --append -- make -C tools/testing/vma -j
>> > 
>> > Bear generates some temporary files. These are usually deleted again
>> > but having them show up ephemerally confuses tools that trigger
>> > recompilation on source code changes. Ignore them in Git so that these
>> > tools can tell they aren't source code.
>> > 
>> > [0]: https://github.com/rizsotto/Bear
>> > 
>> > Signed-off-by: Brendan Jackman <jackmanb@google.com>
>> 
>> We can likely take this via the Kbuild tree. I do wonder if this would
>> be better in a tools/.gitignore file since bear is really only of use
>> there but I am not sure it matters much.
>
> yeah, please consider using tools/.gitignore.  

I don't believe that works here, because AFAIK clangd assumes a single
compile_commands.json, so while we could git-ignore
tools/compile_commands.json that wouldn't really serve the usecase I
have here with 'bear --append'.

> Please have a look at
> this thread about ignoring files from "external" tools:
>
> https://lore.kernel.org/lkml/CAHk-=wiJHMje8cpiTajqrLrM23wZK0SWetuK1Bd67c0OGM_BzQ@mail.gmail.com/

Hm, I would read the spirit of that thread as not being about things
from 'external tools', rather Linus' objection seems to be that the
_lifetime_ of the mbox files is unrelated to the kernel build. Well, to
be honest the only coherent principle I can get from it is "don't break
Linus' workflow". Which... yeah, is still a pretty valid concern.

> If using tools/.gitignore is not possible, I think the best way for
> ignoring files that are not natively related to kernel build tools is to 
> update the local ~/.config/git/ignore, as suggested in
>
> https://lore.kernel.org/lkml/CAK7LNAQas0cK7pgi72tYC3yU=ZkQxnr41YYW1mXd-sWiHtG+UA@mail.gmail.com/

Given this alternative, and given the fact that I'm ignoring a very
generic suffix in *.tmp (if it was just *.events.json I'd say the
practical risk has gotta be close to nil), I think we could just drop
this unless anyone else pops up with evidence that 'bear' is important
to lots of people or something.

Cheers,
Brendan

      reply	other threads:[~2025-09-01 11:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27  8:59 [PATCH] .gitignore: ignore temporary files from 'bear' Brendan Jackman
2025-08-29 23:38 ` Nathan Chancellor
2025-08-30 19:25   ` Nicolas Schier
2025-09-01 11:29     ` Brendan Jackman [this message]

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=DCHFGJXCAPAZ.3JG065Y5DZVLZ@google.com \
    --to=jackmanb@google.com \
    --cc=justinstitt@google.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=nsc@kernel.org \
    /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