Skip to content

Commit a265040

Browse files
addaleaxrvagg
authored andcommitted
gyp: 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: nodejs/node#7959 Ref: nodejs/node#7510 PR-URL: nodejs/node#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 8ad9ecd commit a265040

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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': '',
@@ -1771,7 +1773,10 @@ def WriteMakeRule(self, outputs, inputs, actions=None, comment=None,
17711773
# actual command.
17721774
# - The intermediate recipe will 'touch' the intermediate file.
17731775
# - The multi-output rule will have an do-nothing recipe.
1774-
intermediate = "%s.intermediate" % (command if command else self.target)
1776+
1777+
# Hash the target name to avoid generating overlong filenames.
1778+
cmddigest = hashlib.sha1(command if command else self.target).hexdigest()
1779+
intermediate = "%s.intermediate" % cmddigest
17751780
self.WriteLn('%s: %s' % (' '.join(outputs), intermediate))
17761781
self.WriteLn('\t%s' % '@:');
17771782
self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate))

0 commit comments

Comments
 (0)