]> git.baikalelectronics.ru Git - kernel.git/commit
scripts/spdxcheck.py: Strictly read license files in utf-8
authorNishanth Menon <nm@ti.com>
Wed, 7 Jul 2021 20:48:40 +0000 (15:48 -0500)
committerJonathan Corbet <corbet@lwn.net>
Mon, 12 Jul 2021 15:56:50 +0000 (09:56 -0600)
commit4b400643bfa374121af0b343d74bd05bf473d342
treebe9e169e2003eb62ef816543ba4fd6fa473916d6
parent01da9c8979f3d24bb75ef7080a8d9915e88dff94
scripts/spdxcheck.py: Strictly read license files in utf-8

Commit 98805de3a356 ("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 <module>
    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 <r-ravikumar@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210707204840.30891-1-nm@ti.com
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
scripts/spdxcheck.py