diffoscope's odd UnicodeDecodeError error message: reason found

From: Mark Millard <marklmi_at_yahoo.com>
Date: Tue, 4 May 2021 11:14:02 -0700
I had reported in the reproducable build list messages:

> # diffoscope /.zfs/snapshot/2021-04-*-01:40:48-0/bin/sh
> [...]
> $<3/>2021-05-04 08:49:21 W: diffoscope.main: Fuzzy-matching is currently disabled as the "tlsh" module is unavailable.
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb7 in position 18: invalid start byte

Well, it turns out that the file name pattern was
incorrect and only matched one file.

By contrast:

# diffoscope /.zfs/snapshot/2021-04-*/bin/sh
$<3/>2021-05-04 11:05:25 W: diffoscope.main: Fuzzy-matching is currently disabled as the "tlsh" module is unavailable.

worked fine.

And making the "one file" status obvious:

# diffoscope c_tests/a.out
$<3/>2021-05-04 11:11:45 W: diffoscope.main: Fuzzy-matching is currently disabled as the "tlsh" module is unavailable.
$<3/>Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/diffoscope/main.py", line 745, in main
    sys.exit(run_diffoscope(parsed_args))
  File "/usr/local/lib/python3.7/site-packages/diffoscope/main.py", line 677, in run_diffoscope
    difference = load_diff_from_path(path1)
  File "/usr/local/lib/python3.7/site-packages/diffoscope/readers/__init__.py", line 31, in load_diff_from_path
    return load_diff(codecs.getreader("utf-8")(fp), path)
  File "/usr/local/lib/python3.7/site-packages/diffoscope/readers/__init__.py", line 35, in load_diff
    return JSONReaderV1().load(fp, path)
  File "/usr/local/lib/python3.7/site-packages/diffoscope/readers/json.py", line 33, in load
    raw = json.load(fp)
  File "/usr/local/lib/python3.7/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/local/lib/python3.7/codecs.py", line 504, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb7 in position 18: invalid start byte

Not exactly an obvious error message for the issue.

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)
Received on Tue May 04 2021 - 16:14:14 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:28 UTC