LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2] gen_compile_commands: fix missing 'sys' package
@ 2021-09-08  3:28 Kortan
  2021-09-08 17:07 ` Nathan Chancellor
  2021-09-09 17:22 ` Nick Desaulniers
  0 siblings, 2 replies; 5+ messages in thread
From: Kortan @ 2021-09-08  3:28 UTC (permalink / raw)
  To: nathan, ndesaulniers
  Cc: masahiroy, linux-kbuild, llvm, clang-built-linux, linux-kernel, Kortan

We need to import the 'sys' package since the script has called
sys.exit() method.

Signed-off-by: Kortan <kortanzh@gmail.com>
---
Changes v1 -> v2:
* Fix commit title.
* Improve commit message. 

 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 0033eedce003..1d1bde1fd45e 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.33.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] gen_compile_commands: fix missing 'sys' package
  2021-09-08  3:28 [PATCH v2] gen_compile_commands: fix missing 'sys' package Kortan
@ 2021-09-08 17:07 ` Nathan Chancellor
  2021-09-09 11:01   ` Masahiro Yamada
  2021-09-09 17:22 ` Nick Desaulniers
  1 sibling, 1 reply; 5+ messages in thread
From: Nathan Chancellor @ 2021-09-08 17:07 UTC (permalink / raw)
  To: Kortan
  Cc: ndesaulniers, masahiroy, linux-kbuild, llvm, clang-built-linux,
	linux-kernel

On Wed, Sep 08, 2021 at 11:28:48AM +0800, Kortan wrote:
> We need to import the 'sys' package since the script has called
> sys.exit() method.
> 
> Signed-off-by: Kortan <kortanzh@gmail.com>

Thank you for making those changes!

I should have mentioned that this probably warrants a Fixes: tag, which
can be generated by running:

$ git show -s --format='Fixes: %h ("%s")' 6ad7cbc01527223f3f92baac9b122f15651cf76b
Fixes: 6ad7cbc01527 ("Makefile: Add clang-tidy and static analyzer support to makefile")

as that was the patch that introduced this issue. I personally have a
git alias for this as it comes up enough.

$ git config --get alias.fixes
show -s --format="Fixes: %h (\"%s\")"

I do not think this warrants a v3, just something to keep in mind for
the future.

Fixes: 6ad7cbc01527 ("Makefile: Add clang-tidy and static analyzer support to makefile")
Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
> Changes v1 -> v2:
> * Fix commit title.
> * Improve commit message. 
> 
>  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 0033eedce003..1d1bde1fd45e 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.33.0
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] gen_compile_commands: fix missing 'sys' package
  2021-09-08 17:07 ` Nathan Chancellor
@ 2021-09-09 11:01   ` Masahiro Yamada
  0 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2021-09-09 11:01 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Kortan, Nick Desaulniers, Linux Kbuild mailing list, llvm,
	clang-built-linux, Linux Kernel Mailing List

On Thu, Sep 9, 2021 at 2:07 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Wed, Sep 08, 2021 at 11:28:48AM +0800, Kortan wrote:
> > We need to import the 'sys' package since the script has called
> > sys.exit() method.
> >
> > Signed-off-by: Kortan <kortanzh@gmail.com>
>
> Thank you for making those changes!
>
> I should have mentioned that this probably warrants a Fixes: tag, which
> can be generated by running:
>
> $ git show -s --format='Fixes: %h ("%s")' 6ad7cbc01527223f3f92baac9b122f15651cf76b
> Fixes: 6ad7cbc01527 ("Makefile: Add clang-tidy and static analyzer support to makefile")
>
> as that was the patch that introduced this issue. I personally have a
> git alias for this as it comes up enough.
>
> $ git config --get alias.fixes
> show -s --format="Fixes: %h (\"%s\")"
>
> I do not think this warrants a v3, just something to keep in mind for
> the future.
>
> Fixes: 6ad7cbc01527 ("Makefile: Add clang-tidy and static analyzer support to makefile")
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>


Applied to linux-kbuild
with Fixes and Nathan's Reviewed-by.
Thanks.



> > ---
> > Changes v1 -> v2:
> > * Fix commit title.
> > * Improve commit message.
> >
> >  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 0033eedce003..1d1bde1fd45e 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.33.0
> >
> >



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] gen_compile_commands: fix missing 'sys' package
  2021-09-08  3:28 [PATCH v2] gen_compile_commands: fix missing 'sys' package Kortan
  2021-09-08 17:07 ` Nathan Chancellor
@ 2021-09-09 17:22 ` Nick Desaulniers
  2021-09-09 19:28   ` Nathan Chancellor
  1 sibling, 1 reply; 5+ messages in thread
From: Nick Desaulniers @ 2021-09-09 17:22 UTC (permalink / raw)
  To: Kortan
  Cc: nathan, masahiroy, linux-kbuild, llvm, clang-built-linux, linux-kernel

On Tue, Sep 7, 2021 at 8:30 PM Kortan <kortanzh@gmail.com> wrote:
>
> We need to import the 'sys' package since the script has called
> sys.exit() method.
>
> Signed-off-by: Kortan <kortanzh@gmail.com>

I'm quite sure I've run this script before; how have we not noticed
such an issue before?

> ---
> Changes v1 -> v2:
> * Fix commit title.
> * Improve commit message.
>
>  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 0033eedce003..1d1bde1fd45e 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.33.0
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210908032847.18683-1-kortanzh%40gmail.com.



-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] gen_compile_commands: fix missing 'sys' package
  2021-09-09 17:22 ` Nick Desaulniers
@ 2021-09-09 19:28   ` Nathan Chancellor
  0 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2021-09-09 19:28 UTC (permalink / raw)
  To: Nick Desaulniers, Kortan
  Cc: masahiroy, linux-kbuild, llvm, clang-built-linux, linux-kernel

On 9/9/2021 10:22 AM, 'Nick Desaulniers' via Clang Built Linux wrote:
> On Tue, Sep 7, 2021 at 8:30 PM Kortan <kortanzh@gmail.com> wrote:
>>
>> We need to import the 'sys' package since the script has called
>> sys.exit() method.
>>
>> Signed-off-by: Kortan <kortanzh@gmail.com>
> 
> I'm quite sure I've run this script before; how have we not noticed
> such an issue before?

Nobody hitting the error paths in this script?

$ cat test.py
import sys

if __name__ == '__main__':
     a = int(sys.argv[1])
     print("a = %d" % a)
     if a == 2:
         printf(os.uname())

$ python3 test.py 1

$ python3 test.py 2
a = 2
Traceback (most recent call last):
   File "/home/nathan/test.py", line 7, in <module>
     print(os.uname())
NameError: name 'os' is not defined

>> ---
>> Changes v1 -> v2:
>> * Fix commit title.
>> * Improve commit message.
>>
>>   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 0033eedce003..1d1bde1fd45e 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.33.0
>>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-09 19:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08  3:28 [PATCH v2] gen_compile_commands: fix missing 'sys' package Kortan
2021-09-08 17:07 ` Nathan Chancellor
2021-09-09 11:01   ` Masahiro Yamada
2021-09-09 17:22 ` Nick Desaulniers
2021-09-09 19:28   ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).