guix-play/guix/build
Mark H Weaver 485ac28235
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>
2021-01-08 14:10:33 -05:00
..
maven build/maven: Fix typo. 2020-10-28 21:11:11 -07:00
android-ndk-build-system.scm build-system: android-ndk: Let upstream install header files. 2018-05-10 01:06:22 +02:00
android-repo.scm android-repo-download: Use parallel-job-count instead of hard-coding job 2020-09-03 00:09:38 +02:00
ant-build-system.scm gnu: ant-build-system: Don't override symlinks. 2019-10-13 22:35:04 +02:00
asdf-build-system.scm build-system: asdf: Improve install phase for CL source packages. 2020-09-15 22:00:29 +02:00
bournish.scm bournish: Prevent inlining of run-time support procedures. 2020-04-02 16:07:08 +02:00
bzr.scm Add (guix bzr-download). 2019-05-09 00:22:37 -04:00
cargo-build-system.scm Merge branch 'master' into staging 2020-11-22 23:36:09 +01:00
cargo-utils.scm build/cargo-utils: Use all allocated threads to generate checksums. 2020-07-15 10:26:35 +03:00
clojure-build-system.scm build-system: Add 'clojure-build-system'. 2018-11-19 12:07:44 +01:00
clojure-utils.scm clojure-utils: Avoid use of '@@'. 2020-01-15 23:48:33 +01:00
cmake-build-system.scm build-system/cmake: Specify C++ compiler when cross-compiling. 2020-01-26 13:39:18 +01:00
compile.scm compile: Build gnu/{packages,tests}/* with '-O1'. 2020-06-22 15:42:55 +02:00
copy-build-system.scm build: Fix docstring typos. 2020-10-16 15:24:15 +02:00
cvs.scm cvs-download: Use invoke instead of system*. 2018-03-16 05:02:32 -04:00
debug-link.scm grafts: Add (guix build debug-link) and use it. 2018-08-24 18:01:05 +02:00
download-nar.scm Use guile-zlib extension in build-side code. 2020-08-24 10:41:06 +02:00
download.scm download: Delete the output file upon failure. 2020-03-22 00:02:23 +01:00
dub-build-system.scm build-system/dub: Let all phases return #T unconditionally. 2018-11-13 10:46:00 +01:00
dune-build-system.scm guix: dune-build-system: Add a package parameter. 2019-03-23 22:58:52 +01:00
emacs-build-system.scm build-system/emacs: Hide the 'delete' binding from (guix build utils). 2020-05-07 15:14:46 +02:00
emacs-utils.scm build: emacs-utils: Add an option to select scoping for batch eval. 2020-03-22 21:17:38 -04:00
font-build-system.scm build-system/gnu: Add 'bootstrap' phase. 2018-03-11 22:04:40 +01:00
git.scm git-download: Use 'invoke'. 2019-01-06 00:22:05 +01:00
glib-or-gtk-build-system.scm build-system/glib-or-gtk: Use invoke instead of system*. 2018-03-16 05:01:47 -04:00
gnu-bootstrap.scm Add (guix build gnu-bootstrap). 2020-02-17 23:21:04 +01:00
gnu-build-system.scm build-systems/gnu: Add compressor file extension to symbolic links. 2020-12-29 13:38:54 -05:00
gnu-dist.scm build-system/gnu: Fix 'install' phase of 'gnu-dist'. 2020-06-18 14:48:17 +02:00
go-build-system.scm build-system/go: Install license files. 2020-10-15 11:13:25 +03:00
graft.scm grafts: Add (guix build debug-link) and use it. 2018-08-24 18:01:05 +02:00
gremlin.scm gremlin: Add 'file-needed/recursive'. 2020-12-01 21:30:28 +01:00
guile-build-system.scm build-system/guile: Display progress report as expected by (guix status). 2019-06-02 22:01:34 +02:00
haskell-build-system.scm build-system/haskell: Do not pass "--bindir" during configure. 2020-08-13 16:44:56 +02:00
hg.scm svn-download, hg-download: Use 'report-invoke-error'. 2020-10-10 22:37:45 +02:00
java-utils.scm guix: java-utils: Add Maven-related phases. 2020-07-17 04:10:28 +02:00
json.scm Revert "guix: node-build-system: Use guile-json instead of a custom parser." 2019-07-14 20:18:07 +02:00
julia-build-system.scm build: julia-build-system: Update for new Julia version. 2020-04-12 16:15:47 +03:00
linux-module-build-system.scm build-system: linux-module: Allow passing #:make-flags argument. 2020-06-02 14:22:32 +02:00
lisp-utils.scm Merge branch 'staging' 2020-10-19 13:11:40 -04:00
make-bootstrap.scm make-bootstrap: Adjust copied linux headers. 2019-11-15 13:00:23 +02:00
maven-build-system.scm build/maven-build-system: Return #t in fix-pom-files phase. 2020-10-26 21:36:09 +01:00
meson-build-system.scm build-system/meson: Do not apply strip-runpath to the "debug" output. 2020-11-06 15:44:56 -05:00
minify-build-system.scm build-system/minify: Phases no longer return a Boolean. 2020-11-25 00:02:30 +01:00
node-build-system.scm guix: node-build-system: Do not symlink /bin. 2020-02-25 00:27:09 +01:00
ocaml-build-system.scm build-system/ocaml: Use invoke and return #t. 2018-11-18 18:40:53 +01:00
perl-build-system.scm build-system/perl: Use invoke instead of system*. 2018-03-16 05:01:52 -04:00
po.scm po: Micro-optimize 'read-po-file'. 2020-06-23 00:03:08 +02:00
profiles.scm profiles: Add comment at the top of 'manifest' file. 2020-06-17 12:06:33 +02:00
python-build-system.scm build/python: Fix cythonize check phase. 2020-12-13 22:20:19 +02:00
qt-build-system.scm guix: qt-build-system: Add phase check-setup. 2020-01-28 13:03:08 +01:00
qt-utils.scm guix: Fix wrap-qt-program. 2019-11-26 12:31:39 +01:00
r-build-system.scm build-system/r: Fix type error. 2018-06-06 23:30:30 +02:00
rakudo-build-system.scm build: Add rakudo-build-system. 2019-03-23 22:26:48 +02:00
ruby-build-system.scm build: ruby-build-system: Remove an extraneous binding. 2020-09-01 13:19:08 -04:00
scons-build-system.scm gnu: Add nsis-x86_64 and nsis-i686. 2019-10-11 11:44:44 -04:00
store-copy.scm build: store-copy: Export file-size procedure. 2020-05-05 16:08:32 +02:00
svn.scm svn-download, hg-download: Use 'report-invoke-error'. 2020-10-10 22:37:45 +02:00
syscalls.scm syscalls: set-thread-name, thread-name: Fix thinko. 2020-06-08 16:49:03 +02:00
texlive-build-system.scm build-system/texlive: Phases no longer return a Boolean. 2020-11-25 00:02:30 +01:00
union.scm Remove most uses of the _IO*F constants. 2019-01-09 14:47:53 +01:00
utils.scm utils: Allow text substitution even in the presence of NUL characters. 2021-01-08 14:10:33 -05:00
waf-build-system.scm build-system/waf: Use invoke. 2018-06-19 10:48:14 +02:00