a 0 byte qemu-uninstall.exe.nsis file gives data error on 7z extraction
A free file archiver for extremely high compression
Brought to you by:
ipavlov
A 0 byte qemu-uninstall.exe.nsis file inside a 7z archive throws data error on 7z extraction
Ref
Bug concerns being able to extract a 0 byte file from archive
last lines of log C:\vol\scoop_01\SCOOPG\apps\qemu\7.2.0-rc2\7zip.log
Sub items Errors: 1
Archives with Errors: 1
Sub items Errors: 1
ERROR: Data Error : lib\gdk-pixbuf-2.0\2.10.0\qemu-uninstall.exe.nsis
Diff:
Latest NSIS 3.08 supports new feature for uninstaller file,
and qemu uses that feature for qemu.
7-Zip 22.01 and older versions do not support that feature. So 7-Zip now can't unpack uninstaller file, because 7-zip expects only old-style uninstaller.
I'll try to fix the problem in next version of 7-Zip.
Technical details:
NSIS before 3.08 used "patch block" that creates uninstaller executable stub from installer executable stub. And new uninstaller (3.08) can be stored without that "patch block". That trick allowed to reduce the size of package before. That is why there was such complexity.
Last edit: Igor Pavlov 2022-12-05
Also I look that pe file headers of qemu installers.
And I see another problems in pe sections:
Probably they use some software that changes resource section
.rsrcof pe file. But that program writes incorrect values to pe headers for next.relocsection.Please ask them to check each step that you use to produce exe file. And check each program that they use.
Last edit: Igor Pavlov 2022-12-05
If it creates incorrect header it should be their job to fix it.
I relayed the communication to the qemu issue, the first day itself.
I think, Igor was referring to possible addition corruption happening to the PE headers in the exe, that may or may not be the cause of the 7z throwing data error on the PE-archive stored within it.
The exe is able to execute and self-install to windows C:\Program Files\qemu\ .
Imho, archive/unarchive tools need to be robust to minor hiccups, and 7z should also be able to workaround it.
The dl.7z seems to be just the renamed exe
The sha512 has matches with the checksum file given in the website https://qemu.weilnetz.de/w64/
Its possible the exe is unofficially self-signed. The DigitCertUtil.exe also confirms that the certificate does not chain to trusted higher root certificate authorities.
The qemu team sort of has a backlog when it comes to windows-side bugs and doesn't get to them fast enough. But i'll try ping again.
in summary:
It might be the case that the pe-header is a just coincidental parallel problem. While it is disconcerting, it might be a minor tooling issue.
As the executable can self-inflate itself smoothly, 7z should also be able to.
Also, qemu-project currently have the 7.2 release going on.
As I wrote before, the problem with PE headers is separate problem.
7-Zip can't unpack that file, bacause qemu uses new nsis uninstaller feature unsupported by current 7-zip.
Actually when you unpack exe file, 7-zip uses several levels of parsing:
At first level 7-Zip sees PE (EXE) headers and tries to parse PE headers.
Then it sees NSIS installer inside big PE file, and it uses NSIS parser. It looks so:
7-Zip doesn't know about new feature inside nsis package. That is why we have unpacking error.
When I debugged that file, I saw that PE headers also incorrect , Probably it's because they inserted some resources and/or signature to exe stub with some incorrect way or with some incorrect tool. It doesn't interfere 7-Zip to unpack NSIS part, it's just distinct problem.
Last edit: Igor Pavlov 2022-12-12
In NSIS 3.08, we did change the uninstaller code to a hybrid system, where if you don't use !uninstfinalize, it will act the same as the older versions to save space. If you do use !uninstfinalize, makensis will assemble and write out the uninstaller as a whole file, so you can do cool things like sign it, then it just adds the uninstaller back in just like a 'File' command in the script.
Technical details: in the exehead uninstaller code, you can just check 'parm2' (icon size): if it's zero, it's a single whole file; if it's non-zero, then it's an old style patched uninstaller.
PS: I developed the uninstaller code for this :).
There was a patch in NSIS for mingw-w64 a few months ago that disabled .reloc sections because the default setting changed, don't know if that applies here though.
Last edit: Jason 2022-12-13