Skip to content

avoid UnicodeDecodeError when reading 'configure' script and checking for 'Generated by GNU Autoconf' in ConfigureMake#1817

Merged
damianam merged 2 commits intoeasybuilders:developfrom
boegel:configuremake_read_configure_script
Sep 30, 2019
Merged

avoid UnicodeDecodeError when reading 'configure' script and checking for 'Generated by GNU Autoconf' in ConfigureMake#1817
damianam merged 2 commits intoeasybuilders:developfrom
boegel:configuremake_read_configure_script

Conversation

@boegel
Copy link
Copy Markdown
Member

@boegel boegel commented Sep 27, 2019

fix for following error (hit this on CentOS 8 when installing Bison-3.3.2.eb with $LC_ALL set to C)

ERROR: Traceback (most recent call last):
  File "/tmp/kehoste/eb400/lib/python3.6/site-packages/easybuild/main.py", line 112, in build_and_install_software
    (ec_res['success'], app_log, err) = build_and_install_one(ec, init_env)
  File "/tmp/kehoste/eb400/lib/python3.6/site-packages/easybuild/framework/easyblock.py", line 3051, in build_and_install_one
    result = app.run_all_steps(run_test_cases=run_test_cases)
  File "/tmp/kehoste/eb400/lib/python3.6/site-packages/easybuild/framework/easyblock.py", line 2959, in run_all_steps
    self.run_step(step_name, step_methods)
  File "/tmp/kehoste/eb400/lib/python3.6/site-packages/easybuild/framework/easyblock.py", line 2829, in run_step
    step_method(self)()
  File "/tmp/kehoste/eb400/lib/python3.6/site-packages/easybuild/easyblocks/generic/configuremake.py", line 219, in configure_step
    if os.path.exists(configure_command) and AUTOCONF_GENERATED_MSG in read_file(configure_command):
  File "/tmp/kehoste/eb400/lib/python3.6/site-packages/easybuild/tools/filetools.py", line 188, in read_file
    txt = handle.read()
  File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 741356: ordinal not in range(128)

… for 'Generated by GNU Autoconf' in ConfigureMake
@boegel boegel added the bug fix label Sep 27, 2019
@boegel boegel added this to the next release (4.0.1) milestone Sep 27, 2019
@boegel boegel requested a review from damianam September 27, 2019 11:19
@damianam
Copy link
Copy Markdown
Member

If that makes you happy we can merge that, but I would add some comments explaining why. Someone will read it at some point and think "why is this a bytes literal"?

Besides that, that's IMO an environment problem. I have had that before in completely different scenarios that had nothing to do with EB. If you environment is not sanitized to handle UTF-8 that is bound to happen sooner or later, doesn't matter if you try to hide it in this particular case.

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Sep 27, 2019

@damianam I agree this is an edge case and perhaps a shoot-in-your-own-foot situation, but since this surprised me a bit when I was hitting it, it's in a very commonly used generic easyblock, and it's pretty much trivial to fix, I would like to get this merged.

It's not like we can shoot ourselves in the foot here, can we? ;)

I tested this with both Python 2 & 3, on different systems, should be OK to merge without introducing problems...

@damianam
Copy link
Copy Markdown
Member

@boegel That's fine for me. I am not sure I agree this is our duty to fix this, since whoever is using this will hit the same error further down the road, but I guess it a reasonable safeguard for this easyblock. Going in!

@damianam damianam merged commit c2f387f into easybuilders:develop Sep 30, 2019
@boegel boegel deleted the configuremake_read_configure_script branch September 30, 2019 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants