[wpkg-users] [Bug 267] In a system where a package was installed and after uninstalled, the 3rd execution of wpkg.js cause the installation and the uninstallation of this package instead of no action

bugzilla-daemon at bugzilla.wpkg.org bugzilla-daemon at bugzilla.wpkg.org
Tue Feb 7 20:30:51 CET 2012


http://bugzilla.wpkg.org/show_bug.cgi?id=267

Rainer Meier <r.meier at wpkg.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |r.meier at wpkg.org
         Resolution|                            |INVALID

--- Comment #2 from Rainer Meier <r.meier at wpkg.org>  ---
Hi Stefano,

WPKG in this case works perfectly as expected.

Step 1 performs correctly (honestly I did not even check).

Step 2 is supposed to remove the package. Looking at the log I see the
following:

...
2012-02-07 09:59:30, DEBUG   : Executing command:
'%PROGRAMFILES(x86)%\dia\dia-0.97.2-uninstall.exe /S'.
2012-02-07 09:59:30, ERROR   : Command
'%PROGRAMFILES(x86)%\dia\dia-0.97.2-uninstall.exe /S' was
unsuccessful.|Impossibile trovare il file specificato.|
2012-02-07 09:59:30, DEBUG   : Command returned result: -1
2012-02-07 09:59:30, ERROR   : Exit code returned non-successful value:
-1|Package: Dia Diagram
Editor.|Command:|%PROGRAMFILES(x86)%\dia\dia-0.97.2-uninstall.exe /S
...
2012-02-07 09:59:30, DEBUG   : The path 'C:\Program
Files\dia\dia-0.97.2-uninstall.exe' exists and is a file: the test was
successful.
...
2012-02-07 09:59:30, ERROR   : Could not process (remove) Dia Diagram
Editor.|Package still installed.
...

The uninstall commands failed. I think the translation of "Impossibile trovare
il file specificato." is "File not found" in short.
As a result the exit code of the command is -1. Your package does not specify
that -1 is a "success" exit code (see <exit /> node for commands).

Then WPKG executes the check to verify that the software was properly
uninstalled. Which seems not to be the case:

"The path 'C:\Program Files\dia\dia-0.97.2-uninstall.exe' exists and is a file:
the test was successful."

So WPKG thinks that Dia is still installed properly and properly returns an
error:

"Could not process (remove) Dia Diagram Editor.|Package still installed."



As a result WPKG will not remove Dia from the local wpkg.xml file. So remember
that for WPKG the Dia package is still installed. It will try over and over
again to perform proper uninstall on subsequent synchronization until it
succeeds.


Next step (as you write) is that you were going to delete the Dia folder
manually.
On subsequent WPKG run WPKG will first verify that checks for packages supposed
to be installed do properly succeed. In your case remember again that Dia is
still a package which is supposed to be installed for WPKG as it has not been
properly uninstalled. As you manually removed a file which is essential for Dia
(the uninstaller as specified by your checks) WPKG will first try to repair the
broken Dia package. And yes, this is intended behavior as WPKG first needs to
ensure consistent system state and it verifies all packages to be properly
installed. Hence it's going to re-install it first to make sure it can be
properly removed by specified uninstall procedures.

After installation it will immediately execute the remove commands to do a
proper removal. This removal will fail again due to not working remove commands
(see above).


SOLUTION
========

To get this fixed you only need to make sure the uninstall procedure (remove
commands) do work properly. Unfortunately Dia is one of the applications
suffering from the NSIS fork "bug" or "design flaw". The uninstaller will
terminate immediately and spawn a child process which performs the removal of
application files. As a result WPKG will continue processing before the
uninstaller finishes removing the files. There are several options known to
help in most cases. Some say the _=%ProgramFiles%\Dia\ command line parameter
helps the uninstaller to wait for the Dia folder to be removed before exiting.
I personally use a small cmd script which uninstalls Dis correctly and waits
for the uninstaller to disappear before it continues. I am going to attach this
script to this report.
Basically the script is also used for other tricky applications facing the same
bug (NSIS based) like VLC.


In order to use it update your package:

# package.xml:
<package 
    id="dia" 
    name="Dia Diagram Editor" 
    revision="0.97.2-20111224" 
    reboot="false" 
    priority="1">    

    <check type="logical" condition="or">
        <check type="file" condition="exists"
path="%PROGRAMFILES%\dia\dia-0.97.2-uninstall.exe" />
        <check type="file" condition="exists"
path="%PROGRAMFILES(x86)%\dia\dia-0.97.2-uninstall.exe" />
    </check>

    <install cmd='%SOFTWARE%\dia\dia-setup-0.97.2.exe /S' />
    <upgrade cmd='%SOFTWARE%\dia\dia-setup-0.97.2.exe /S' />
    <remove cmd='%SOFTWARE%\dia\unattended-uninstall.cmd' />
</package>



NOTE: You should also increment the package revision. So WPKG will
automatically "upgrade" to the latest and fixed package before doing proper
uninstall this time.



PS: Please post such questions to the mailing list first in the future.
Installer-Related issues are well-known to the community and people will be
happy to assist you if you can't sort it out yourself.

-- 
Configure bugmail: http://bugzilla.wpkg.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.



More information about the wpkg-users mailing list