diff options
author | Harmen Stoppels <harmenstoppels@gmail.com> | 2021-10-27 11:59:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-27 02:59:10 -0700 |
commit | e04b172eb00c72bdadcdba20d45169738828943a (patch) | |
tree | ad75d7dce7b1c211affec45dad74ad847f428832 /LICENSE-MIT | |
parent | 2fd87046cd49a75d60aabaf3e502373e88dbc187 (diff) | |
download | spack-e04b172eb00c72bdadcdba20d45169738828943a.tar.gz spack-e04b172eb00c72bdadcdba20d45169738828943a.tar.bz2 spack-e04b172eb00c72bdadcdba20d45169738828943a.tar.xz spack-e04b172eb00c72bdadcdba20d45169738828943a.zip |
Allow non-UTF-8 encoding in sbang hook (#26793)
Currently Spack reads full files containing shebangs to memory as
strings, meaning Spack would have to guess their encoding. Currently
Spack has a fixed guess of UTF-8.
This is unnecessary, since e.g. the Linux kernel does not assume an
encoding on paths at all, it's just bytes and some delimiters on the
byte level.
This commit does the following:
1. Shebangs are treated as bytes, so that e.g. latin1 encoded files do
not throw UnicodeEncoding errors, and adds a test for this.
2. No more bytes than necessary are read to memory, we only have to read
until the first newline, and from there on we an copy the file byte by
bytes instead of decoding and re-encoding text.
3. We cap the number of bytes read to 4096, if no newline is found
before that, we don't attempt to patch it.
4. Add support for luajit too.
This should make Spack both more efficient and usable for non-UTF8
files.
Diffstat (limited to 'LICENSE-MIT')
0 files changed, 0 insertions, 0 deletions