diff options
author | Tom Lane | 2024-11-11 17:20:08 +0000 |
---|---|---|
committer | Tom Lane | 2024-11-11 17:20:08 +0000 |
commit | a34c33fd2278157de140608523598567bfb7a32f (patch) | |
tree | b4c4137c3f478b0dbc6f549674ef5268f5db37d9 | |
parent | 5a2fed911a85ed6d8a015a6bafe3a0d9a69334ae (diff) |
Avoid bizarre meson behavior with backslashes in command arguments.
meson makes the backslashes in text2macro.pl's --strip argument
into forward slashes, effectively disabling comment stripping.
That hasn't caused us issues before, but it breaks the test case
for b7e3a52a8. We don't really need the pattern to be adjustable,
so just hard-wire it into the script instead.
Context: https://github.com/mesonbuild/meson/issues/1564
Security: CVE-2024-10979
-rw-r--r-- | src/pl/plperl/GNUmakefile | 2 | ||||
-rw-r--r-- | src/pl/plperl/meson.build | 2 | ||||
-rw-r--r-- | src/pl/plperl/text2macro.pl | 8 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/pl/plperl/GNUmakefile b/src/pl/plperl/GNUmakefile index b6310d7673..558c764aad 100644 --- a/src/pl/plperl/GNUmakefile +++ b/src/pl/plperl/GNUmakefile @@ -85,7 +85,7 @@ plperl_opmask.h: plperl_opmask.pl perlchunks.h: $(PERLCHUNKS) @if [ x"$(perl_privlibexp)" = x"" ]; then echo "configure switch --with-perl was not specified."; exit 1; fi - $(PERL) $(srcdir)/text2macro.pl --strip='^(\#.*|\s*)$$' $^ > $@ + $(PERL) $(srcdir)/text2macro.pl $^ > $@ all: all-lib diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build index 6b4fa229c4..006f7356e6 100644 --- a/src/pl/plperl/meson.build +++ b/src/pl/plperl/meson.build @@ -17,7 +17,7 @@ plperl_sources += custom_target('perlchunks.h', input: files('plc_perlboot.pl', 'plc_trusted.pl'), output: 'perlchunks.h', capture: true, - command: [perl, files('text2macro.pl'), '--strip=^(\#.*|\s*)$', '@INPUT@'] + command: [perl, files('text2macro.pl'), '@INPUT@'] ) plperl_sources += custom_target('plperl_opmask.h', diff --git a/src/pl/plperl/text2macro.pl b/src/pl/plperl/text2macro.pl index c6240af69c..ee65eed363 100644 --- a/src/pl/plperl/text2macro.pl +++ b/src/pl/plperl/text2macro.pl @@ -15,14 +15,13 @@ Options: --prefix=S - add prefix S to the names of the macros --name=S - use S as the macro name (assumes only one file) - --strip=S - don't include lines that match perl regex S =head1 DESCRIPTION Reads one or more text files and outputs a corresponding series of C pre-processor macro definitions. Each macro defines a string literal that contains the contents of the corresponding text file. The basename of the text -file as capitalized and used as the name of the macro, along with an optional prefix. +file is capitalized and used as the name of the macro, along with an optional prefix. =cut @@ -34,9 +33,12 @@ use Getopt::Long; GetOptions( 'prefix=s' => \my $opt_prefix, 'name=s' => \my $opt_name, - 'strip=s' => \my $opt_strip, 'selftest!' => sub { exit selftest() },) or exit 1; +# This was once a command-line option, but meson is obstreperous +# about passing backslashes through custom targets. +my $opt_strip = '^(#.*|\s*)$'; + die "No text files specified" unless @ARGV; |