Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp807131pxb; Thu, 9 Sep 2021 12:29:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxC8yBjPAq8luhK//Xfg+htj0ZooqnB0QguRVyRlPJssK4eBoBjn21Wv3h7qlLwVWrbAPfi X-Received: by 2002:a05:6638:1642:: with SMTP id a2mr1344024jat.88.1631215798853; Thu, 09 Sep 2021 12:29:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631215798; cv=none; d=google.com; s=arc-20160816; b=Q1gBhBDq67XkjBq64FWoB2I5ue9YAcwyaQloB3DbOWgi0rh4SY/uFeWREoa00AXORN BF1VMwdZLLKyH2cZ4wbalbvuJTs3iDurVAHQ10vPlnCsU4l23x1dGBLR9550X1P54REW /QMJsnGAOvPI8uGICkMsu6nu41IvmEH60g+H25q4ZPXEkY+bZ87pxsXMYRB9i++CYaoH CH7VQx1eRlmZgjSBP+87pnLIDsrssRfmE3Zuyu6ARuN7cwlXZkn1jqRZ9u6MyIZqNXk9 Ok8y1EYr9xhuVyo2i3+MgOml0VlMhG6FhNPclwksw0H3mjwzw/jGtehICdGYKBiVGtGU 5TdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=Jj+CILvnUf5jz9NjPFryQnu+pxbtcRieARRFQ5tLGxQ=; b=RaSsVXmpuIAILEtWWtKFQxvf7ULxo5FpXeqekJCZGzuIM8N+K8FmOn/Ck0zlE79v93 2JyDltBx0xJD8nrCRwMVE9rcvJ078Xtfd/nExPwOYsR6YoakqUB6Q4l8Ct+ztzLptJSq mJTzUeHCh6KsUO6+SglIYfMaxQJW5Ve20QUcmToB1oaQr0zKaHacpkrhd2OKB6FQKo48 Iy4n8rIas3NR1RpmsJH7qrRuwrzu5VcHjjr3cntipQ00W25FO74zGnOBFGDSLHd9Y9d8 2tsYbMQtaGGAXJuxXNp66kcI15rws2xrjMisjc6lBIFaQRnXIEvPJYwKl4YWWbq86HtW GqVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KCcBYkPN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 13si2399731ily.171.2021.09.09.12.29.39; Thu, 09 Sep 2021 12:29:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KCcBYkPN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245352AbhIIT35 (ORCPT + 99 others); Thu, 9 Sep 2021 15:29:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:39090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235517AbhIIT3x (ORCPT ); Thu, 9 Sep 2021 15:29:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8DA3B6103E; Thu, 9 Sep 2021 19:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631215724; bh=P1QW69W98o9fYQWfC2nvqxZ7tCZTgXSiiFrDQUDOq4g=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=KCcBYkPN1YBlsfHI/xJgEAb+qWL9qW7neS03S58btYL5tyraju+1ILF33AqCqsh1v 2WetDPFkGrhIxe2biqouVvyezah4rzl06ZxNLFQfhzKLY7K1jAb0zbqLt7mtHpbC4j fzLDa/UqdKy3IatHqdqWzp1zPSY5bqcWo91G7Gy00aUxhLH57QMmycBtm86RYToI6X nrzqf3L7wMO6qb3rjR0GTc2LPCmRlMEQ2RW6P/asVf9P5CHOvpiKmguhXfGHCexJmC SKtGAUt6NK1MPxPo8lqko1KFDvs3cFP7yIrzh+oQtIX3Pz+vj3didenCRaEu1lNrlm 9AkulQ5RyX6MA== Subject: Re: [PATCH v2] gen_compile_commands: fix missing 'sys' package To: Nick Desaulniers , Kortan Cc: masahiroy@kernel.org, linux-kbuild@vger.kernel.org, llvm@lists.linux.dev, clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org References: <20210908032847.18683-1-kortanzh@gmail.com> From: Nathan Chancellor Message-ID: <5fbef4f5-30bb-5cb7-71c5-ae6a48c1822a@kernel.org> Date: Thu, 9 Sep 2021 12:28:43 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/9/2021 10:22 AM, 'Nick Desaulniers' via Clang Built Linux wrote: > On Tue, Sep 7, 2021 at 8:30 PM Kortan wrote: >> >> We need to import the 'sys' package since the script has called >> sys.exit() method. >> >> Signed-off-by: Kortan > > 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 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 >>