- NSIS Discussion
- nsExec bug, probably, erroneous first run behavior
Archive: nsExec bug, probably, erroneous first run behavior
chjfth
22nd October 2007 09:44 UTC
nsExec bug, probably, erroneous first run behavior
On a Windows machine that nsExec::Exec has never run before, execute a installer generated by the following nsi script:
Name "nsExec Test"
OutFile "nsExec-Test.exe"
ShowInstDetails show
Section "Silent MakeNSIS"
nsExec::Exec "regYYY"
Pop $0 # return value/error/timeout
DetailPrint ""
DetailPrint " Return value: $0"
DetailPrint ""
SectionEnd
Of course, you don't have regYYY.exe on your Windows, but you'll get "Return value: 0" , which means execution success [:-(]. However, a second run of the very installer on the same machine will give the result "Return value: error".
You can easily reproduce this symptom by installing a virtual machine software with snapshot functionality, e.g. WMWare Workstation(you are well off making a snapshot before first launching the installer).
Does any developer guy know what the problem is? I'm using NSIS v2.31 .
kichik
23rd October 2007 00:58 UTC
Works fine for me returning error every time. Have you been able to reproduce this on more than one VM? Which OS? Which configuration? Reboot helps?
chjfth
23rd October 2007 03:54 UTC
Thank you Kichik, before I post this topic, I tried it on two virtual machines, one is Win2k SP4, the other is WinXP SP2(both are simplified Chinese version).
Since Kichik says he tried himself and did not find this problem, I tried again on a new Windows Win2K system(English version). This time nsExec behaves correctly as well. So I suspect that this problem can only be seen on simplified Chinese versions of Windows.
Please download this VMware virtual machine(simplified Chinese Win2k) and try again for me. http://down.nlscan.com/Misc/Internet...-nsExec-bug.7z
BTW: On every reboot of that Win2K VM, we got 0 from nsExec::Exec, a second run after reboot gives the correct result, i.e, "error".
chjfth
23rd October 2007 04:20 UTC
Why is my URL submitted hidden by the forum? That URL is:
down.nlscan.com/Misc/Internet-Keep-Ref/_vmware-5-Win2kchs-nsExec-bug.7z
kichik
23rd October 2007 20:48 UTC
Your URL is hidden because you're a new user. I get 404 on both posted URLs.
chjfth
24th October 2007 01:50 UTC
Oh sorry, that URL is correct, but the damn IIS6 by default refuses to serve files with the unknown extension name .7z . Now I've corrected it. Please download and try.
kichik
24th October 2007 20:41 UTC
I get a really lousy download speed of 3kb/s and even that is for no longer than a minute straight which is followed by at least 5 minutes of nothing. Can you upload it to a stabler website?
chjfth
25th October 2007 01:56 UTC
Well Kichik, that address is on a server of the company I work for which locates in China. It may be slow for you, so feel free to use any download manager(e.g. FlashGet) to get it. You know, it is hard to find a globally fast website that will gladly host a file larger than 300M bytes. This nsExec issue is not urgent for me. So I can wait several weeks.
Or, if you can get a ISO of Windows 2000/XP simplified Chinese installation disk, you can try installing it on a VM, and I think the problem can be reproduced.
kichik
25th October 2007 19:39 UTC
Well, there's RapidShare, Sendago and others. But I'm still downloading anyway... When it's done, I'll have a look.
kichik
9th November 2007 18:32 UTC
I found and fixed the problem. The internal process nsExec calls never called ExitProcess but only returned its result on WinMain. If there were any threads attached to that process for some reason and they exited after the main thread, the end result would be their result and not the executed program's result.
I still don't know exactly what caused this to happen just on the first execution in your VMWare, but I don't have time to debug it right now.
This might have even caused some issue someone once reported about nsExec never returning at all. If there's another thread that won't die until ExitProcess is called, it might cause this.
chjfth
10th November 2007 14:49 UTC
Thank you Kichik. I'm thankful for your responsiveness.