Bug 248834 - devel/py-appdirs: Configure phase fails with UnicodeDecodeError in 'ascii' codec
Summary: devel/py-appdirs: Configure phase fails with UnicodeDecodeError in 'ascii' codec
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-22 15:07 UTC by John W. O'Brien
Modified: 2020-08-23 19:46 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (python)
john: merge-quarterly?


Attachments
devel/py-appdirs: Backport explicit encoding patch (1.22 KB, patch)
2020-08-22 15:07 UTC, John W. O'Brien
john: maintainer-approval? (python)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John W. O'Brien 2020-08-22 15:07:19 UTC
Created attachment 217444 [details]
devel/py-appdirs: Backport explicit encoding patch

Symptom
=======

=======================<phase: configure      >============================
===>  Configuring for py36-appdirs-1.4.4
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 25, in <module>
    for line in read("appdirs.py").splitlines():
  File "setup.py", line 19, in read
    out = "\n" + inf.read().replace("\r\n", "\n")
  File "/usr/local/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 0xc8 in position 129: ordinal not in range(128)
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/py-appdirs

Analysis
========

The appdirs.py file is UTF-8 encoded, and under certain circumstances, the built-in `open` function will guess the wrong encoding.

QA
==

portlint: OK
poudriere: OK -- testport on 12.1R amd64 w/py27, py35, py36, py37 (default), and py38

Note: The attached patch does not increment PORTREVISION because if the bug is triggered, no package is produced.
Comment 1 Po-Chuan Hsieh freebsd_committer freebsd_triage 2020-08-23 19:46:05 UTC
Fixed in r545913 with USE_LOCALE. Thanks!