Author: markt Date: Thu Feb 25 20:29:10 2016 New Revision: 1732359 URL: http://svn.apache.org/viewvc?rev=1732359&view=rev Log: NSIS follows symbolic links so the recursive deletes which are part of the uninstall were removing the contents of any symlinked directories located under the Tomcat installation directory. This commit modifies the uninstaller so it first removes all symlinks from the Tomcat installation directory and any sub-directories before it does the recursive deletes.
Modified: tomcat/trunk/res/tomcat.nsi tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/res/tomcat.nsi URL: http://svn.apache.org/viewvc/tomcat/trunk/res/tomcat.nsi?rev=1732359&r1=1732358&r2=1732359&view=diff ============================================================================== --- tomcat/trunk/res/tomcat.nsi (original) +++ tomcat/trunk/res/tomcat.nsi Thu Feb 25 20:29:10 2016 @@ -1137,6 +1137,12 @@ FunctionEnd SetShellVarContext current RMDir /r "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@ $TomcatServiceName" + ; Before files are removed using recursive deletes, remove any symbolic + ; links in the installation directory and the directory structure below it + ; to ensure the recursive deletes don't result in any nasty surprises. + Push "$INSTDIR" + Call un.RemoveSymlinks + Delete "$INSTDIR\tomcat.ico" Delete "$INSTDIR\LICENSE" Delete "$INSTDIR\NOTICE" @@ -1174,7 +1180,7 @@ FunctionEnd ; ================= ; uninstall init function ; - ; Read the command line paramater and set up the service name variables so the + ; Read the command line parameter and set up the service name variables so the ; uninstaller knows which service it is working with ; ================= Function un.onInit @@ -1184,6 +1190,49 @@ FunctionEnd StrCpy $TomcatServiceFileName $R1.exe StrCpy $TomcatServiceManagerFileName $R1w.exe FunctionEnd + + ; ================= + ; Removes symbolic links from the path found on top of the stack. + ; The path is removed from the stack as a result of calling this function. + ; ================= + Function un.RemoveSymlinks + Pop $0 + ${GetFileAttributes} "$0" "REPARSE_POINT" $3 + ; DetailPrint "Processing directory [$0] [$3]" + FindFirst $1 $2 $0\*.* + ; DetailPrint "Search [$1] found [$2]" + StrCmp $3 "1" RemoveSymlinks-delete + RemoveSymlinks-loop: + ; DetailPrint "Search [$1] processing [$0\$2]" + StrCmp $2 "" RemoveSymlinks-exit + StrCmp $2 "." RemoveSymlinks-skip + StrCmp $2 ".." RemoveSymlinks-skip + IfFileExists $0\$2\*.* RemoveSymlinks-directory + RemoveSymlinks-skip: + ; DetailPrint "Search [$1] ignoring file [$0\$2]" + FindNext $1 $2 + StrCmp $2 "" RemoveSymlinks-exit + goto RemoveSymlinks-loop + RemoveSymlinks-directory: + ; DetailPrint "Search [$1] found directory [$0\$2]" + Push $0 + Push $1 + Push $0\$2 + Call un.RemoveSymlinks + Pop $1 + Pop $0 + ; DetailPrint "Search [$1] restored for [$0]" + FindNext $1 $2 + goto RemoveSymlinks-loop + RemoveSymlinks-delete: + ; DetailPrint "Deleting symlink [$0]" + SetFileAttributes "$0" "NORMAL" + System::Call "kernel32::RemoveDirectoryW(w `$0`) i.n" + RemoveSymlinks-exit: + ; DetailPrint "Search [$1] closed" + FindClose $1 + FunctionEnd + !endif ;eof Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1732359&r1=1732358&r2=1732359&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Thu Feb 25 20:29:10 2016 @@ -180,6 +180,11 @@ during the build process from <code>/usr/share/java</code> to <code>${user.home}/temp</code>. Patch provided by Ahmed Hosni. (markt) </fix> + <fix> + <bug>59031</bug>: When using the Windows uninstaller, do not remove the + contents of any directories that have been symlinked into the Tomcat + directory structure. (markt) + </fix> </changelog> </subsection> </section> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org