Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4cd4f3b

Browse files
committed
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 b7e3a52. We don't really need the pattern to be adjustable, so just hard-wire it into the script instead. Context: mesonbuild/meson#1564 Security: CVE-2024-10979
1 parent cd82afd commit 4cd4f3b

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/pl/plperl/GNUmakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ plperl_opmask.h: plperl_opmask.pl
8585

8686
perlchunks.h: $(PERLCHUNKS)
8787
@if [ x"$(perl_privlibexp)" = x"" ]; then echo "configure switch --with-perl was not specified."; exit 1; fi
88-
$(PERL) $(srcdir)/text2macro.pl --strip='^(\#.*|\s*)$$' $^ > $@
88+
$(PERL) $(srcdir)/text2macro.pl $^ > $@
8989

9090
all: all-lib
9191

src/pl/plperl/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ plperl_sources += custom_target('perlchunks.h',
1717
input: files('plc_perlboot.pl', 'plc_trusted.pl'),
1818
output: 'perlchunks.h',
1919
capture: true,
20-
command: [perl, files('text2macro.pl'), '--strip=^(\#.*|\s*)$', '@INPUT@']
20+
command: [perl, files('text2macro.pl'), '@INPUT@']
2121
)
2222

2323
plperl_sources += custom_target('plperl_opmask.h',

src/pl/plperl/text2macro.pl

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ =head1 SYNOPSIS
1515
1616
--prefix=S - add prefix S to the names of the macros
1717
--name=S - use S as the macro name (assumes only one file)
18-
--strip=S - don't include lines that match perl regex S
1918
2019
=head1 DESCRIPTION
2120
2221
Reads one or more text files and outputs a corresponding series of C
2322
pre-processor macro definitions. Each macro defines a string literal that
2423
contains the contents of the corresponding text file. The basename of the text
25-
file as capitalized and used as the name of the macro, along with an optional prefix.
24+
file is capitalized and used as the name of the macro, along with an optional prefix.
2625
2726
=cut
2827

@@ -34,9 +33,12 @@ =head1 DESCRIPTION
3433
GetOptions(
3534
'prefix=s' => \my $opt_prefix,
3635
'name=s' => \my $opt_name,
37-
'strip=s' => \my $opt_strip,
3836
'selftest!' => sub { exit selftest() },) or exit 1;
3937

38+
# This was once a command-line option, but meson is obstreperous
39+
# about passing backslashes through custom targets.
40+
my $opt_strip = '^(#.*|\s*)$';
41+
4042
die "No text files specified"
4143
unless @ARGV;
4244

0 commit comments

Comments
 (0)