> solve this problem :(
Can you try adding
$text = undef;
You will still have the error messages (Unable to open..., read() on closed filehandle..., Failed to read...) but I hope this will avoid the crash ('x' outside of string in unpack...)
(sorry, I could not test).
Note: The tools were designed at a time when CPU and disk were limited (there might have been more diversity in the packaging formats). This may not be the case now, and if somebody is interested in a (major) rewrite, it might be easier to just extract each source packages using dpkg-source (+ heuristic to apply patches) than to do this in-memory extract and patch mechanism.
Regards,
--
Nekral