Skip to content

Commit 36b3ff0

Browse files
addaleaxMylesBorins
authored andcommitted
deps: float gyp patch for long filenames
Pulling in https://codereview.chromium.org/2019133002/ in its current state, as gyp seems to be largely abandoned as a project. Original commit message: Hash intermediate file name to avoid ENAMETOOLONG Hash the intermediate Makefile target used for multi-output rules so that it still works when the involved file names are very long. Since the intermediate file's name is effectively arbitrary, this does not come with notable behavioural changes. The `import hashlib` boilerplate is taken directly from `xcodeproj_file.py`. Concretely, this makes the V8 inspector build currently fail when long pathnames are involved, notably when using ecryptfs which has a lower file name length limit. Fixes: #7959 Ref: #7510 PR-URL: #7963 Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
1 parent 9b29cfc commit 36b3ff0

File tree

1 file changed

+6
-1
lines changed
  • tools/gyp/pylib/gyp/generator

1 file changed

+6
-1
lines changed

tools/gyp/pylib/gyp/generator/make.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
from gyp.common import GetEnvironFallback
3232
from gyp.common import GypError
3333

34+
import hashlib
35+
3436
generator_default_variables = {
3537
'EXECUTABLE_PREFIX': '',
3638
'EXECUTABLE_SUFFIX': '',
@@ -1743,7 +1745,10 @@ def WriteMakeRule(self, outputs, inputs, actions=None, comment=None,
17431745
# actual command.
17441746
# - The intermediate recipe will 'touch' the intermediate file.
17451747
# - The multi-output rule will have an do-nothing recipe.
1746-
intermediate = "%s.intermediate" % (command if command else self.target)
1748+
1749+
# Hash the target name to avoid generating overlong filenames.
1750+
cmddigest = hashlib.sha1(command if command else self.target).hexdigest()
1751+
intermediate = "%s.intermediate" % cmddigest
17471752
self.WriteLn('%s: %s' % (' '.join(outputs), intermediate))
17481753
self.WriteLn('\t%s' % '@:');
17491754
self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate))

0 commit comments

Comments
 (0)