mstorsjo / msvc-wine

Scripts for setting up and running MSVC in Wine on Linux
Other
667 stars 82 forks source link

RecursionError: maximum recursion depth exceeded while calling a Python object #138

Closed hacksysteam closed 1 month ago

hacksysteam commented 1 month ago

Hi @mstorsjo

Running this command gives error:

python vsdownload.py --accept-license --print-deps-tree Microsoft.VisualStudio.Workload.VCTools

Microsoft.VisualStudio.PackageGroup.Debugger.Core
        Microsoft.VisualStudio.Debugger
          Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client
            Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client
              Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client
                Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client
                  Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client
                    Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client
                      Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client
Traceback (most recent call last):
  File "/tmp/msvc-wine/vsdownload.py", line 654, in <module>
    printDepends(packages, i, "", None, "", args)
  File "/tmp/msvc-wine/vsdownload.py", line 295, in printDepends
    printDepends(packages, key, type, chip, indent + "  ", args)
  File "/tmp/msvc-wine/vsdownload.py", line 295, in printDepends
    printDepends(packages, key, type, chip, indent + "  ", args)
  File "/tmp/msvc-wine/vsdownload.py", line 295, in printDepends
    printDepends(packages, key, type, chip, indent + "  ", args)
  [Previous line repeated 994 more times]
  File "/tmp/msvc-wine/vsdownload.py", line 282, in printDepends
    p = findPackage(packages, target, chip)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/msvc-wine/vsdownload.py", line 249, in findPackage
    id = id.lower()
         ^^^^^^^^^^
RecursionError: maximum recursion depth exceeded while calling a Python object
hacksysteam commented 1 month ago

this works but i'm not sure if this will cause any issues

def printDepends(packages, target, deptype, chip, indent, args):
     chipstr = ""
     if chip != None:
@@ -286,6 +558,8 @@ def printDepends(packages, target, deptype, chip, indent, args):
         deps = p["dependencies"]
         for key in deps:
             dep = deps[key]
+            if key == p["id"]:
+                continue
             type = ""
             if "type" in dep:
                 type = dep["type"]
@@ -294,6 +568,7 @@ def printDepends(packages, target, deptype, chip, indent, args):
                 chip = dep["chip"]
             printDepends(packages, key, type, chip, indent + "  ", args)
huangqinjin commented 1 month ago

Related to #135 .

From the manifest, the dependency chain is

Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client (machineArch: arm64)
  Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client (machineArch: x64)
    Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client (machineArch: x86)
      (no dependencies)

But machineArch is not handled currently, so the dependency chain is parsed as

Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client (machineArch: arm64)
  Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client (machineArch: arm64)
    ...
hacksysteam commented 1 month ago

@huangqinjin have you encountered this issue: https://github.com/mstorsjo/msvc-wine/issues/139

hacksysteam commented 1 month ago

@huangqinjin the issue got fixed after applying your pull request: https://github.com/mstorsjo/msvc-wine/pull/140