* [PATCH] gen_compile_commands: add missing sys import
@ 2021-09-14 15:44 andreas
2021-09-14 16:01 ` Nick Desaulniers
2021-09-14 16:01 ` Nathan Chancellor
0 siblings, 2 replies; 4+ messages in thread
From: andreas @ 2021-09-14 15:44 UTC (permalink / raw)
To: Nathan Chancellor, Nick Desaulniers; +Cc: Andreas Rammhold, llvm, linux-kernel
From: Andreas Rammhold <andreas@rammhold.de>
The sys.exit was being used at multiple locations within the script but
never imported. This lead to the script exiting with a error instead of
with the nicely formatted (useful) error output.
Signed-off-by: Andreas Rammhold <andreas@rammhold.de>
---
scripts/clang-tools/gen_compile_commands.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py
index 0033eedce003e..1d1bde1fd45eb 100755
--- a/scripts/clang-tools/gen_compile_commands.py
+++ b/scripts/clang-tools/gen_compile_commands.py
@@ -13,6 +13,7 @@ import logging
import os
import re
import subprocess
+import sys
_DEFAULT_OUTPUT = 'compile_commands.json'
_DEFAULT_LOG_LEVEL = 'WARNING'
--
2.32.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gen_compile_commands: add missing sys import
2021-09-14 15:44 [PATCH] gen_compile_commands: add missing sys import andreas
@ 2021-09-14 16:01 ` Nick Desaulniers
2021-09-14 16:01 ` Nathan Chancellor
1 sibling, 0 replies; 4+ messages in thread
From: Nick Desaulniers @ 2021-09-14 16:01 UTC (permalink / raw)
To: andreas; +Cc: Nathan Chancellor, llvm, linux-kernel
On Tue, Sep 14, 2021 at 8:44 AM <andreas@rammhold.de> wrote:
>
> From: Andreas Rammhold <andreas@rammhold.de>
>
> The sys.exit was being used at multiple locations within the script but
> never imported. This lead to the script exiting with a error instead of
> with the nicely formatted (useful) error output.
>
> Signed-off-by: Andreas Rammhold <andreas@rammhold.de>
Hi Andreas,
Thanks for the patch. Someone beat you to the punch though:
https://lore.kernel.org/lkml/20210908032847.18683-1-kortanzh@gmail.com/.
This is good; it means folks are playing with this. :)
> ---
> scripts/clang-tools/gen_compile_commands.py | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py
> index 0033eedce003e..1d1bde1fd45eb 100755
> --- a/scripts/clang-tools/gen_compile_commands.py
> +++ b/scripts/clang-tools/gen_compile_commands.py
> @@ -13,6 +13,7 @@ import logging
> import os
> import re
> import subprocess
> +import sys
>
> _DEFAULT_OUTPUT = 'compile_commands.json'
> _DEFAULT_LOG_LEVEL = 'WARNING'
> --
> 2.32.0
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gen_compile_commands: add missing sys import
2021-09-14 15:44 [PATCH] gen_compile_commands: add missing sys import andreas
2021-09-14 16:01 ` Nick Desaulniers
@ 2021-09-14 16:01 ` Nathan Chancellor
2021-09-14 16:31 ` Andreas Rammhold
1 sibling, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2021-09-14 16:01 UTC (permalink / raw)
To: andreas, Nick Desaulniers; +Cc: llvm, linux-kernel
Hi Andreas,
On 9/14/2021 8:44 AM, andreas@rammhold.de wrote:
> From: Andreas Rammhold <andreas@rammhold.de>
>
> The sys.exit was being used at multiple locations within the script but
> never imported. This lead to the script exiting with a error instead of
> with the nicely formatted (useful) error output.
>
> Signed-off-by: Andreas Rammhold <andreas@rammhold.de>
> ---
> scripts/clang-tools/gen_compile_commands.py | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py
> index 0033eedce003e..1d1bde1fd45eb 100755
> --- a/scripts/clang-tools/gen_compile_commands.py
> +++ b/scripts/clang-tools/gen_compile_commands.py
> @@ -13,6 +13,7 @@ import logging
> import os
> import re
> import subprocess
> +import sys
>
> _DEFAULT_OUTPUT = 'compile_commands.json'
> _DEFAULT_LOG_LEVEL = 'WARNING'
>
Thank you for the patch! Someone else submitted the exact same fix and
it is now pending in the kbuild tree:
https://git.kernel.org/masahiroy/linux-kbuild/c/776f04ca2c29f13d483a3effc0c27404fe901143
I am curious, how did you discover this? Did you hit one of those error
paths?
Cheers,
Nathan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gen_compile_commands: add missing sys import
2021-09-14 16:01 ` Nathan Chancellor
@ 2021-09-14 16:31 ` Andreas Rammhold
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Rammhold @ 2021-09-14 16:31 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: Nick Desaulniers, llvm, linux-kernel
On 09:01 14.09.21, Nathan Chancellor wrote:
> Hi Andreas,
>
> On 9/14/2021 8:44 AM, andreas@rammhold.de wrote:
> > From: Andreas Rammhold <andreas@rammhold.de>
> >
> > The sys.exit was being used at multiple locations within the script but
> > never imported. This lead to the script exiting with a error instead of
> > with the nicely formatted (useful) error output.
> >
> > Signed-off-by: Andreas Rammhold <andreas@rammhold.de>
> > ---
> > scripts/clang-tools/gen_compile_commands.py | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py
> > index 0033eedce003e..1d1bde1fd45eb 100755
> > --- a/scripts/clang-tools/gen_compile_commands.py
> > +++ b/scripts/clang-tools/gen_compile_commands.py
> > @@ -13,6 +13,7 @@ import logging
> > import os
> > import re
> > import subprocess
> > +import sys
> > _DEFAULT_OUTPUT = 'compile_commands.json'
> > _DEFAULT_LOG_LEVEL = 'WARNING'
> >
>
> Thank you for the patch! Someone else submitted the exact same fix and it is
> now pending in the kbuild tree:
>
> https://git.kernel.org/masahiroy/linux-kbuild/c/776f04ca2c29f13d483a3effc0c27404fe901143
Oh! I should have send the patch when I originally comitted it.. Good
that it is fixed now. :-)
> I am curious, how did you discover this? Did you hit one of those error
> paths?
I can't recall the exact story anymore. I was looking into why the
keyring didn't offer the TPM backend on my new device. I did a fresh
checkout of the source tree on the device and set out to get clangd
working in the source tree with my neovim.
At first I tried to call the script without compiling the kernel. That
failed with some obvious error.
It could have been that I ended up in one of the error paths. Naturally
I digged into how this whole machinery works and that lead to opening
the file. Neovim, being setup for Python development, showed me that
there was an undefined symbol / missing import. I verified that and then
added the import.
As far as I can remeber I did end up compiling the kernel and/or then
running `make compile_commands.json`. Ever since then it just worked!
Thank you for working on this! :-)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-14 16:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14 15:44 [PATCH] gen_compile_commands: add missing sys import andreas
2021-09-14 16:01 ` Nick Desaulniers
2021-09-14 16:01 ` Nathan Chancellor
2021-09-14 16:31 ` Andreas Rammhold
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.