Skip to contentSkip to conversation

Fix objdump output parser in "nsis.py"

PATCH In review Arthur Sengileyev 3 participants 3 messages Apr 12, 2025 – Apr 14, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix objdump output parser in "nsis.py"

In msys2 distribution objdump from gcc is using single tab character prefix, but objdump from clang is using 4 white space characters instead. The script will not identify any dll dependencies for a QEMU build generated with clang. This in turn will fail the build, because there will be no files inside dlldir and no setup file will be created. Instead of checking for whitespace in prefix use lstrip to accommodate for differences in outputs.

---
 scripts/nsis.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/nsis.py +1 -1
index af4e064819..8f469634eb 100644
@@ -23,7 +23,7 @@ def find_deps(exe_or_dll, search_path, analyzed_deps):
     output = subprocess.check_output(["objdump", "-p", exe_or_dll], text=True)
     output = output.split("\n")
     for line in output:
-        if not line.startswith("\tDLL Name: "):
+        if not line.lstrip().startswith("DLL Name: "):
             continue
 
         dep = line.split("DLL Name: ")[1].strip()
Signature · 1 line
2.43.0
Reviewed-by Stefan Weil on v1 1/1
#1 lore raw

Am 12.04.25 um 20:08 schrieb Arthur Sengileyev:

Quoted 18 lines

In msys2 distribution objdump from gcc is using single tab character prefix, but objdump from clang is using 4 white space characters instead. The script will not identify any dll dependencies for a QEMU build generated with clang. This in turn will fail the build, because there will be no files inside dlldir and no setup file will be created. Instead of checking for whitespace in prefix use lstrip to accommodate for differences in outputs.

---
  scripts/nsis.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
scripts/nsis.py +0 -0
index af4e064819..8f469634eb 100644

scripts/nsis.py def find_deps(exe_or_dll, search_path, analyzed_deps): · line 29

Quoted 8 lines
scripts/nsis.py +1 -1
@@ -23,7 +23,7 @@ def find_deps(exe_or_dll, search_path, analyzed_deps):
      output = subprocess.check_output(["objdump", "-p", exe_or_dll], text=True)
      output = output.split("\n")
      for line in output:
-        if not line.startswith("\tDLL Name: "):
+        if not line.lstrip().startswith("DLL Name: "):
              continue
 
          dep = line.split("DLL Name: ")[1].strip()

Thanks. I use nearly the same code if not line.strip().startswith("DLL Name: "): in my builds for WoA.

@Stefan, can this trivial patch still be applied for 10.0?

I had planned to replace the whole code with objdump by platform independent Python code, but that's a larger change, and I missed the deadline.

#2 lore raw
Quoted 32 lines · Stefan Weil

Am 12.04.25 um 20:08 schrieb Arthur Sengileyev:

Quoted 18 lines

In msys2 distribution objdump from gcc is using single tab character prefix, but objdump from clang is using 4 white space characters instead. The script will not identify any dll dependencies for a QEMU build generated with clang. This in turn will fail the build, because there will be no files inside dlldir and no setup file will be created. Instead of checking for whitespace in prefix use lstrip to accommodate for differences in outputs.

---
  scripts/nsis.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
scripts/nsis.py +0 -0
index af4e064819..8f469634eb 100644

scripts/nsis.py def find_deps(exe_or_dll, search_path, analyzed_deps): · line 28

Quoted 7 lines
scripts/nsis.py +1 -1
@@ -23,7 +23,7 @@ def find_deps(exe_or_dll, search_path, analyzed_deps):
      output = subprocess.check_output(["objdump", "-p", exe_or_dll], text=True)
      output = output.split("\n")
      for line in output:
-        if not line.startswith("\tDLL Name: "):
+        if not line.lstrip().startswith("DLL Name: "):
              continue
          dep = line.split("DLL Name: ")[1].strip()

Thanks. I use nearly the same code `if not line.strip().startswith("DLL
Name: "):` in my builds for WoA.

Quoted 1 line

@Stefan, can this trivial patch still be applied for 10.0?

Yes, it is included in Michael Tokarev's latest trivial patches pull request.

Quoted 7 lines

I had planned to replace the whole code with objdump by platform independent Python code, but that's a larger change, and I missed the deadline.