All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Nick Desaulniers <ndesaulniers@google.com>, Kortan <kortanzh@gmail.com>
Cc: masahiroy@kernel.org, linux-kbuild@vger.kernel.org,
	llvm@lists.linux.dev, clang-built-linux@googlegroups.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] gen_compile_commands: fix missing 'sys' package
Date: Thu, 9 Sep 2021 12:28:43 -0700	[thread overview]
Message-ID: <5fbef4f5-30bb-5cb7-71c5-ae6a48c1822a@kernel.org> (raw)
In-Reply-To: <CAKwvOdnReHxf7ysorwTZtN65Hbw4dTk-z8fAQUaKCvEQ_a97eg@mail.gmail.com>

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
>>

      reply	other threads:[~2021-09-09 19:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 17:22   ` Nick Desaulniers
2021-09-09 19:28   ` Nathan Chancellor [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=5fbef4f5-30bb-5cb7-71c5-ae6a48c1822a@kernel.org \
    --to=nathan@kernel.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=kortanzh@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=ndesaulniers@google.com \
    /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 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.