Skip to content

Commit

Permalink
gyp: quote a few paths potentially containing spaces in makefile gene…
Browse files Browse the repository at this point in the history
…rator (nodejs#439)

Fixes: nodejs#439
  • Loading branch information
Benoit Favre committed May 25, 2020
1 parent 5f47b7a commit 08a2d56
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions gyp/pylib/gyp/generator/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,9 +928,9 @@ def WriteActions(self, actions, extra_sources, extra_outputs,
else:
self.WriteLn('quiet_cmd_%s = ACTION %s $@' % (name, name))
if len(dirs) > 0:
command = 'mkdir -p %s' % ' '.join(dirs) + '; ' + command
command = 'mkdir -p %s' % ' '.join('"%s"' % d for d in dirs) + '; ' + command

cd_action = 'cd %s; ' % Sourceify(self.path or '.')
cd_action = 'cd "%s"; ' % Sourceify(self.path or '.')

# command and cd_action get written to a toplevel variable called
# cmd_foo. Toplevel variables can't handle things that change per
Expand All @@ -944,8 +944,8 @@ def WriteActions(self, actions, extra_sources, extra_outputs,
# libraries, but until everything is made cross-compile safe, also use
# target libraries.
# TODO(piman): when everything is cross-compile safe, remove lib.target
self.WriteLn('cmd_%s = LD_LIBRARY_PATH=$(builddir)/lib.host:'
'$(builddir)/lib.target:$$LD_LIBRARY_PATH; '
self.WriteLn('cmd_%s = LD_LIBRARY_PATH="$(builddir)/lib.host:'
'$(builddir)/lib.target:$$LD_LIBRARY_PATH"; '
'export LD_LIBRARY_PATH; '
'%s%s'
% (name, cd_action, command))
Expand Down Expand Up @@ -1065,8 +1065,8 @@ def WriteRules(self, rules, extra_sources, extra_outputs,
for ac in rule['action']]
mkdirs = ''
if len(dirs) > 0:
mkdirs = 'mkdir -p %s; ' % ' '.join(dirs)
cd_action = 'cd %s; ' % Sourceify(self.path or '.')
mkdirs = 'mkdir -p %s; ' % ' '.join('"%s"' % d for d in dirs)
cd_action = 'cd "%s"; ' % Sourceify(self.path or '.')

# action, cd_action, and mkdirs get written to a toplevel variable
# called cmd_foo. Toplevel variables can't handle things that change
Expand Down

0 comments on commit 08a2d56

Please sign in to comment.