Archive: Question about makensis.nsi and possible bug in 3.0a0


Question about makensis.nsi and possible bug in 3.0a0
Hello, my question is about this code taken from makensis.nsi in the repository:

    ClearErrors
ExecWait '$R1 _?=$INSTDIR'

BringToFront

IfErrors no_remove_uninstaller
IfFileExists "$INSTDIR\Bin\makensis.exe" no_remove_uninstaller

Delete $R1
RMDir $INSTDIR
StrCpy $R1 ""

no_remove_uninstaller:

StrCmp "" $R1 0 +3
MessageBox MB_ICONEXCLAMATION "Unable to uninstall!"
Abort

This code is causing a problem when NSIS is already installed and the installer is executed again. If the user decides to Uninstall from the uninstaller, the _?=$INSTDIR command line option will generate an error. So IfErrors will always go to no_remove_uninstaller and the "Unable to uninstall!" message will appear.

With nsis-3.0a0-setup.exe I'm always getting this error. I'm using Windows XP.

I made some changes to the error handling.

BTW, there is already thread about the alpha, please use it if you have any other issues...


Originally posted by Anders
I made some changes to the error handling.
Hi Anders, I think with the changes done, when the uninstallation is completed and successful ($0 == 0) the Installer will not be close. Is that the wanted behavior? Because this is not how it works in version 2.46.
Originally posted by Anders
BTW, there is already thread about the alpha, please use it if you have any other issues...
OK, I'll post there for any new issues related to the alpha release.

Originally posted by Crayon2000
Hi Anders, I think with the changes done, when the uninstallation is completed and successful ($0 == 0) the Installer will not be close. Is that the wanted behavior? Because this is not how it works in version 2.46.
If the version is the same it should quit, if different it should not IIRC

Originally posted by Anders
If the version is the same it should quit, if different it should not IIRC
Hi, if I understand correctly :rolleyes: This code is only called when every thing worked well during the uninstallation of the software:
      StrCpy $0 $R1 1
${IfThen} $0 == '"' ${|} StrCpy $R1 $R1 -1 1 ${|} ; Strip quotes from UninstallString
Delete $R1
RMDir $INSTDIR

It means that this will never be called:
        StrCmp $R0 "2" 0 +2 ; Is the existing install the same version?
Quit ; ...yes, already installed, we are done

So I think it is never quitting the Installer when the version is the same.

It's hard to test on my side because I don't have all the required software to compile NSIS. So compiling makensis.nsi will failed because of the missing files.

You are getting things mixed up here, the maybe quit part is only for when the user cancels the uninstaller...


Originally posted by Anders
You are getting things mixed up here
I'm pretty sure you are right.

So if you use the code from the repository and you do the following steps:
  1. Install NSIS 3.0a0 normally
  2. Run the Installer again, you should have the Already Installed page now
  3. Choose Uninstall NSIS
  4. Do the uninstallation steps and click on Close at the end
  5. At this point the Installer should be closed? I don't think that's what is happening.

If you can't test it, I'll be waiting for version 3.0a1.

Thank you for trying to help me. I know I'm not always clear :D