configure_file breaks Perl code: transforms e.g. \@array to @array
Describe the bug A clear and concise description of what the bug is.
To Reproduce
minimal example:
cat > foo.pl.in <<'EOT'
#!/usr/bin/env perl
use strict;
use warnings;
use lib qw(@abs_top_builddir@);
my @array = qw(1 2);
use Data::Dumper;
say Dumper(\@array);
EOT
cat > meson.build <<'EOT'
project('broken')
test_cdata = configuration_data()
test_cdata.set('abs_top_builddir', meson.current_build_dir())
complete_run = configure_file(
input: 'foo.pl.in',
output: 'foo.pl',
configuration: test_cdata,
)
EOT
mkdir build
cd build
meson ..
diff -u ../foo.pl.in foo.pl
Expected behavior
Only @abs_top_builddir@ should be replaced, and \@array should be left unmodified.
system parameters
- Arch Linux
- Python version: 3.8.1
meson --version: 0.53.2ninja --version: 1.10.0
see also https://github.com/mesonbuild/meson/issues/13091
Exactly the same issue, identified in the same way, with the same proposed solution.
The real problem here is predicting if changing the behaviour so that @BOB is not touched, will any downstream users break. Though I guess breaking a few is ok, but no large scale breakage. We don't really have a good way of testing whether that is the case. Rebuilding all of WrapDB is a good start, but most of Meson code is not there, sadly.