scripts/install.py --uninstall does not always remove symbolic links.
Review Request #29 - Created Dec. 16, 2010 and submitted
Aleric Inglewood | Reviewers | ||
viewer | |||
SNOW-744 | |||
None | viewer-development |
Packages (tar balls) installed with scripts/install.py do contain symbolic links. Everything that they contain is written to the file installed.xml, and upon uninstall attempted to remove. However, the python script first tests if a file exists before it removes it and uses os.path.exists for this, which only returns true when the target is a file, or a symbolic link *pointing* to an existing file. Since the removal of the tar ball elements is arbitrary, it is possible (and often the case) that the file the symbolic link points to is removed before the symbolic link itself is removed, causing the test to fail and the symbolic link not to be removed. This patch solves this bug by using os.path.lexists which returns true for normal files when they exist, and true for symbolic links if they exist, whether or not the file they point to exists, exactly what we want. os.path.lexists was added to python 2.4, so that should not be problem.
This patch was originally tested to work several months ago, and has been in use by the Imprudence TPV for a while now.
Your explanation is consistent with python's documentation and the change looks simple and sane. The change won't have any effect on platforms that don't have os.lstat(), but those seem to be the ones that don't have symlinks in the first place.
Other reviews