diff options
author | Mark H Weaver <mhw@netris.org> | 2021-01-07 15:15:24 -0500 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2021-01-08 14:10:33 -0500 |
commit | 485ac28235bf8775914b905060266b09629c1bac (patch) | |
tree | 439f53946741042630e8f24ec12580837b6a96c9 /tests/processes.scm | |
parent | 8027711ee8708c130b30be43da7908e0e04d6972 (diff) | |
download | guix-485ac28235bf8775914b905060266b09629c1bac.tar.gz guix-485ac28235bf8775914b905060266b09629c1bac.zip |
utils: Allow text substitution even in the presence of NUL characters.
Fixes <https://issues.guix.gnu.org/30116>.
Before this change, the presence of a NUL character on a line meant that
the (glibc) regexp engine used by Guile would either 1. stop scanning the
string or 2. crash with the error "string contains #\\nul character",
depending on the locale used.
This change works around this limitation by first replacing the NUL character
by an unused Unicode code point, doing the substitution, then reverting the
replacement.
* guix/build/utils.scm (unused-private-use-code-point)
(replace-char): New procedures.
(substitute): Make use of the above procedures to work around the NUL
character regexp engine limitation.
* tests/build-utils.scm: Add tests.
Co-authored-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Diffstat (limited to 'tests/processes.scm')
0 files changed, 0 insertions, 0 deletions