Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5908368pxv; Wed, 7 Jul 2021 14:48:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSy8fgwGjw9u6RnUBHWt6rVgVquy2e7tN3YC4nWeK1QyYPa+JDsrlBotVXkgYv3e8iH+Ra X-Received: by 2002:a05:6402:520c:: with SMTP id s12mr33963867edd.357.1625694486954; Wed, 07 Jul 2021 14:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625694486; cv=none; d=google.com; s=arc-20160816; b=aXYhqxhXQhodmxV5uz16WOAj2MhRxJBctrYyfuufKrVQhKTP9KnWEPsp1ZJmv8b3Zj VddQZVctAx39hD9xKlVVb2w6e+okma5dzspICZ8WfuHgK+DqNhetftQeUZSv6q1To0WW jMS3UbglMJjJ1b5eLIht744TpGhrkYmt9O513FqdPWODhDw9iif/dxU+LxqWXFf18V1W gBpU/xZlQFgwBvF9xEJUQ8G6IsfEiuzivo4ZRWJXS0e+0V6sCZ2ifURtkfx83tlpGm4w z2MmCJmv8bHgv6eVXxOdb8JK905cX6gpskePDuvRKGTR3367GMT/X0RdMO0URpQXvqCS GIUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=6HPmRna3waQ2ClqP2nauya0jag1AjaDVOXfeFC0wbWc=; b=tptom82WffYCG+xE8MRIo+/AebrtFLCVOC7JfjG9pSl3mkOJS54xLVCsjOcn7YPWsd OcTqbgfEy9Zuq3R+620qkbVpovhIQKl3wcTEHwp439uEtZq5+9M4freLvm7es4+a5MFB 7d6++aNEV9T7W5QsUHFo+9B+wXbgqag7oTjNjA9xSiwq2i9gsej0b85Y5gVeISsIu31L tB2L63Fht/ekmglkzPmHvCmsI3x9r8ShyraJg6zq3vFOibrxoknl6rlh5irRnQHg3G4q 4rzIMydhs6+bikQTnqIpY8Yhyi7CbcpeKoFm5RXnuz+ikIQtmqelxs47qc9Io+QCFeWS t3Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=YklCtSer; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a12si337387edr.3.2021.07.07.14.47.38; Wed, 07 Jul 2021 14:48:06 -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=@ti.com header.s=ti-com-17Q1 header.b=YklCtSer; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230438AbhGGUvi (ORCPT + 99 others); Wed, 7 Jul 2021 16:51:38 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:59232 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230127AbhGGUvh (ORCPT ); Wed, 7 Jul 2021 16:51:37 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 167KmgXF117595; Wed, 7 Jul 2021 15:48:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1625690922; bh=6HPmRna3waQ2ClqP2nauya0jag1AjaDVOXfeFC0wbWc=; h=From:To:CC:Subject:Date; b=YklCtSerr2qyb05xEtsc1ES/XxEXfDcE8Pqbmr0D29tWei73gFdTuvQ8w5kDxwBI8 Tce1wDq1pQIHG+sTMb7pNDOUELS7p6Jz1CpZK/AiZu8VAvpObZkIzlOXiMDAlI0spc jFVjy+DsxsviqYdaMpoVtmvLzKt/DvrtYwZctDdA= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 167Kmgk0089987 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 7 Jul 2021 15:48:42 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 7 Jul 2021 15:48:41 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2 via Frontend Transport; Wed, 7 Jul 2021 15:48:41 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 167Kmfmh015408; Wed, 7 Jul 2021 15:48:41 -0500 From: Nishanth Menon To: Greg Kroah-Hartman , Thomas Gleixner , Jonathan Corbet CC: "Ravikumar, Rahul" , lkml , linux-spdx , Nishanth Menon Subject: [PATCH V2] scripts/spdxcheck.py: Strictly read license files in utf-8 Date: Wed, 7 Jul 2021 15:48:40 -0500 Message-ID: <20210707204840.30891-1-nm@ti.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit bc41a7f36469 ("LICENSES: Add the CC-BY-4.0 license") unfortunately introduced LICENSES/dual/CC-BY-4.0 in UTF-8 Unicode text While python will barf at it with: FAIL: 'ascii' codec can't decode byte 0xe2 in position 2109: ordinal not in range(128) Traceback (most recent call last): File "scripts/spdxcheck.py", line 244, in spdx = read_spdxdata(repo) File "scripts/spdxcheck.py", line 47, in read_spdxdata for l in open(el.path).readlines(): File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2109: ordinal not in range(128) While it is indeed debatable if 'Licensor.' used in the license file needs unicode quotes, instead, force spdxcheck to read utf-8. Reported-by: Rahul T R Signed-off-by: Nishanth Menon Reviewed-by: Thomas Gleixner --- Changes since V1: * Commit message update to drop "Let's" "Let us". * Picked up Thomas' Reviewed-by V1: https://lore.kernel.org/linux-spdx/20210703012128.27946-1-nm@ti.com/ scripts/spdxcheck.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py index 3e784cf9f401..ebd06ae642c9 100755 --- a/scripts/spdxcheck.py +++ b/scripts/spdxcheck.py @@ -44,7 +44,7 @@ def read_spdxdata(repo): continue exception = None - for l in open(el.path).readlines(): + for l in open(el.path, encoding="utf-8").readlines(): if l.startswith('Valid-License-Identifier:'): lid = l.split(':')[1].strip().upper() if lid in spdx.licenses: -- 2.32.0