Wireshark-dev: Re: [Wireshark-dev] Windows uninstaller doesn't remove translations.
On Mar 26, 2020, at 9:58 AM, Gerald Combs <gerald@xxxxxxxxxxxxx> wrote:
> As far as I know, the /r flag has been around for a while, but we tend not to use it. I'm not sure why `RMDir /r /REBOOTOK $INSTDIR` is in the list of examples, since right below that is says:
>
> "Warning: Using RMDir /r $INSTDIR in the uninstaller is not safe. Though it is unlikely, the user might select to install to the root of the Program Files folder and this command would wipe out the entire Program Files folder, including all other installed programs! The user can also put other files in the installation folder and wouldn't expect them to get deleted along with the program. Solutions are available for easily uninstalling only files which were installed by the installer."
>
> This also applies to subdirectories, e.g. adding `RMDir /r $INSTDIR\Microsoft` would be a bad idea. Having said that, we've been recursively removing $INSTDIR\plugins and $INSTDIR\profiles since 2012 and 2013 respectively and no one's complained so far. I'm not sure why $INSTDIR\styles would be any different.
If the user selects to install to the root of the Program Files folder, rather than in a subdirectory for the program, and the program being installed has, in its installation tree, a subdirectory named "Microsoft", they run the risk of scribbling on top of existing files, so they've *already* potentially made a mistake.
If there's an important directory named C:\Program Files\styles, and somebody tries to install Wireshark so that ts top-level directory is C:\Program Files rather than C:\Program Files\Wireshark, we'll presumably cheerfully dump files into C:\Program Files\styles - or overwrite existing files there.
Should installers check for the user "[selecting] to install to the root of the Program Files folder" and say "sorry, that's a bad idea, trust me, we won't let you do that"?
(Or should uninstallers check whether $INSTDIR is something such as C:\Program Files and, if so, say "you installed this under C:\, so I'm not even going to *try* to figure out what files under C:\Program Files are mine and which aren't; you're going to have to remove the files yourself - good luck!")