`ch-image`: crashes during parse in C locale on non-ASCII characters under Python 3.6
For example:
$ env | egrep '^LC_'
LC_TERMINAL=iTerm2
LC_TERMINAL_VERSION=3.4.15
LC_ALL=C
$ python3 --version
Python 3.6.12
$ ch-image build --parse-only -t spack -f examples/spack/Dockerfile examples/spack
Traceback (most recent call last):
File "bin/ch-image", line 240, in <module>
main()
File "bin/ch-image", line 234, in main
cli.func(cli)
File "/host/p/Charliecloud/charliecloud/bin/../lib/charliecloud/build.py", line 139, in main
text = ch.ossafe(fp.read, "can't read: %s" % cli.file)
File "/host/p/Charliecloud/charliecloud/bin/../lib/charliecloud/charliecloud.py", line 1984, in ossafe
return f(*args, **kwargs)
File "/usr/local/stow/python-3.6.12/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 1896: ordinal not in range(128)
The offending character is the curly quote on line 43 of the Dockerfile:
# Depending on what's commented below, we get either Spack’s “develop” branch
However, with Python 3.7 it works:
$ python3 --version
Python 3.7.3
$ ch-image build --parse-only -t spack -f examples/spack/Dockerfile examples/spack
$
And with a different locale it works:
$ export LC_ALL=en_US.utf8
$ python3 --version
Python 3.6.12
$ ch-image build --parse-only -t spack -f examples/spack/Dockerfile examples/spack
$
I have not tried locales other than C, en_US.utf8, and whatever is the default on my system, i.e. LC_ALL unset.
I suspect the cause is the same as #970 (closed).
Given that Python 3.6 is rather old and a straightforward workaround is available, I want to record the problem but I plan to close it immediately as WONTFIX.
Edited by reidpr