meson icon indicating copy to clipboard operation
meson copied to clipboard

configure_file breaks Perl code: transforms e.g. \@array to @array

Open stapelberg opened this issue 5 years ago • 1 comments

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.2
  • ninja --version: 1.10.0

stapelberg avatar May 18 '20 20:05 stapelberg

see also https://github.com/mesonbuild/meson/issues/13091

Exactly the same issue, identified in the same way, with the same proposed solution.

Kangie avatar Apr 18 '24 01:04 Kangie

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.

jpakkane avatar May 26 '24 10:05 jpakkane