Closed antonio-rojas closed 2 years ago
Weird, this absolutely worked before! I'll try to reproduce this.... Thanks for the sample tarball!
Weird, I can't reproduce this at all with the file you attached. My libarchive version is 3.5.2, asgen was compiled with LDC 1.28.0, are you using different versions?
Using ldc 1.28.1 and libarchive 3.6.0, but downgrading doesn't make any difference
Weird, I can't reproduce this at all with the file you attached. My libarchive version is 3.5.2, asgen was compiled with LDC 1.28.0, are you using different versions?
Really weird indeed: I have tested the binaries from Fedora and Debian, including their respective shared libraries down to glibc, and I can always reproduce it.
Recompiling libarchive without optimization fixes this. Still, I've found no way to reproduce it with pure libarchive code.
Edit: Nevermind, removing optimization actually breaks iconv detection, so libarchive was compiled without the codepath that causes the crash
This seems to be stack exhaustion. This could fix it:
diff -u -r a/src/asgen/zarchive.d a2/src/asgen/zarchive.d
--- a/src/asgen/zarchive.d 2022-02-22 18:16:54.000000000 +0100
+++ a2/src/asgen/zarchive.d 2022-03-27 20:51:22.390736900 +0200
@@ -436,7 +436,7 @@
aentry.data = this.readEntry (ar);
yield (aentry);
}
- });
+ }, 65536);
return gen;
}
@heftig That would make quite a bit of sense! @antonio-rojas can you test this?
Can confirm the fix, thanks!
Brrr, eww! That's an ugly trap set for D's Fibers, but at least it's documented... @heftig do you want to submit a PR to fix this, or should I include a patch? (The thing that I might want to change is storing the stack size in a constant on top of the function and add a comment about this behavior there, so it's clear what the argument does and we have a future reference).
Do what you think is best. This was my first time touching D code.
I can imagine many issues in D code that would be a lot easier to find and easier to debug when starting with the language than this one! Thank you for having a look and finding the issue! :-)
appstream-generator segfaults when processing a repo database tarball if it is in pax format, like the attached one, with this backtrace:
Although the backtrace points to a libarchive crash, I am not able to reproduce this by running the same code appstream-generator runs in a separate C program. This works flawlessly on the attached file:
core.files.tar.gz