Skip to content

Commit 818fc45

Browse files
Philip Oakleydscho
authored andcommitted
contrib/buildsystems: handle quoted spaces in filenames
The engine.pl script expects file names not to contain spaces. However, paths with spaces are quite prevalent on Windows. Use shellwords() rather than split() to parse them correctly. Helped-by: Junio C Hamano <[email protected]> Signed-off-by: Philip Oakley <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent b1d610c commit 818fc45

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

contrib/buildsystems/engine.pl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use File::Spec;
1313
use Cwd;
1414
use Generators;
15+
use Text::ParseWords;
1516

1617
my (%build_structure, %compile_options, @makedry);
1718
my $out_dir = getcwd();
@@ -231,7 +232,7 @@ sub removeDuplicates
231232
sub handleCompileLine
232233
{
233234
my ($line, $lineno) = @_;
234-
my @parts = split(' ', $line);
235+
my @parts = shellwords($line);
235236
my $sourcefile;
236237
shift(@parts); # ignore cmd
237238
while (my $part = shift @parts) {
@@ -265,7 +266,7 @@ sub handleLibLine
265266
my (@objfiles, @lflags, $libout, $part);
266267
# kill cmd and rm 'prefix'
267268
$line =~ s/^rm -f .* && .* rcs //;
268-
my @parts = split(' ', $line);
269+
my @parts = shellwords($line);
269270
while ($part = shift @parts) {
270271
if ($part =~ /^-/) {
271272
push(@lflags, $part);
@@ -306,7 +307,7 @@ sub handleLinkLine
306307
{
307308
my ($line, $lineno) = @_;
308309
my (@objfiles, @lflags, @libs, $appout, $part);
309-
my @parts = split(' ', $line);
310+
my @parts = shellwords($line);
310311
shift(@parts); # ignore cmd
311312
while ($part = shift @parts) {
312313
if ($part =~ /^-IGNORE/) {

0 commit comments

Comments
 (0)