romkobomko1993 / gyp

Automatically exported from code.google.com/p/gyp
0 stars 0 forks source link

gyp: infinite recursion when using "-f gypd" #141

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to use the "-f gypd" option to see what it produces, but it fails 
with the following 
traceback:

$ ./build/gyp_chromium -f gypd -D OS=linux
Traceback (most recent call last):
  File "./build/gyp_chromium", line 89, in <module>
    sys.exit(gyp.main(args))
  File "./tools/gyp/pylib/gyp/__init__.py", line 434, in main
    options.circular_check)
  File "./tools/gyp/pylib/gyp/__init__.py", line 83, in Load
    depth, generator_input_info, check, circular_check)
  File "./tools/gyp/pylib/gyp/input.py", line 2064, in Load
    depth, check)
  File "./tools/gyp/pylib/gyp/input.py", line 399, in LoadTargetBuildFile
    includes, depth, check)
  File "./tools/gyp/pylib/gyp/input.py", line 357, in LoadTargetBuildFile
    build_file_path)
  File "./tools/gyp/pylib/gyp/input.py", line 816, in ProcessVariablesAndConditionsInDict
    variables, build_file, 'variables')
  File "./tools/gyp/pylib/gyp/input.py", line 823, in ProcessVariablesAndConditionsInDict
    expanded = ExpandVariables(value, is_late, variables, build_file)
  File "./tools/gyp/pylib/gyp/input.py", line 656, in ExpandVariables
    output = ExpandVariables(output, is_late, variables, build_file)
  File "./tools/gyp/pylib/gyp/input.py", line 656, in ExpandVariables
    output = ExpandVariables(output, is_late, variables, build_file)
...
  File "./tools/gyp/pylib/gyp/input.py", line 656, in ExpandVariables
    output = ExpandVariables(output, is_late, variables, build_file)
  File "./tools/gyp/pylib/gyp/input.py", line 503, in ExpandVariables
    (c_start, c_end) = FindEnclosingBracketGroup(input_str[replace_start:])
  File "./tools/gyp/pylib/gyp/input.py", line 421, in FindEnclosingBracketGroup
    if char in brackets.values():
RuntimeError: maximum recursion depth exceeded in cmp while loading 
dependencies of 
build/all.gyp while trying to load build/all.gyp

By adding some debugging prints, I can see that it is trying to expand 
'<(SHARED_INTERMEDIATE_DIR)/app'.

Original issue reported on code.google.com by mseaborn@chromium.org on 24 Feb 2010 at 12:28

GoogleCodeExporter commented 9 years ago
I found a workaround: change generator_default_variables to produce anything 
that won't be interpreted 
as a variable that needs to be expanded:

--- pylib/gyp/generator/gypd.py (revision 805)
+++ pylib/gyp/generator/gypd.py (working copy)
@@ -66,6 +66,7 @@
 # phase.  Bonus points for carrying @ back into the output too.
 for v in _generator_identity_variables:
   generator_default_variables[v] = '<(%s)' % v
+  generator_default_variables[v] = '__%s__' % v

Original comment by mseaborn@chromium.org on 1 Apr 2010 at 4:37

GoogleCodeExporter commented 9 years ago
The proposed workaround has the downside that the .gypd file won't have those 
variable expansions and thus you can't use the .gypd as an input file with a 
different generator later. I propose this alternative patch that detect these 
simple infinite recursions.

https://codereview.chromium.org/417113009/

Original comment by de...@chromium.org on 25 Jul 2014 at 8:56