@bx80 opened this Pull Request on March 1st 2022 Contributor

Description:

Fixes #18724

Background

During an update, any files that already exist in the installation destination but no longer exist in the update package will be identified and removed.

The process is:
1) Copy the new files.
2) Check for obsolete files that exist in the installation target but are no longer part of the package.
3) Delete the obsolete files.

This causes a problem when a file is renamed with only a change in case, eg. Myfile to MyFile.

For case sensitive systems this works:
1) The new MyFile is copied without interfering with the old Myfile
2) Myfile is identified as not being in the source package and noted for deletion.
3) The obsolete Myfile is correctly unlinked without interfering with the new MyFile.

For case insensitive system this fails:
1) The new MyFile is copied and overwrites the old Myfile as the name is treated as the same.
2) Myfile is identified as not being in the source package and noted for deletion.
3) The new MyFile is incorrectly deleted as the name is treated as the same, this results in a missing file.

Fix

To fix this a new method has been added which checks if the file system is case insensitive by writing a file with one case and checking if it exists using another case. If the file is reported to exist under a differently cased filename then the file system is assumed to be case insensitive.

When checking for files which exist in the installation but not in the source package and a case insensitive file system is detected then the file name comparison will be performed in a case insensitive manner, this results in the following behaviour:

1) The new MyFile is copied and overwrites the old Myfile as the name is treated as the same.
2) MyFile in the source package is compared case insensitively with the existing Myfile and considered to exist in the source package, so it is not noted for deletion.
3) No attempt is made to delete Myfile and as it has been overwritten with the new MyFile, resulting in the new file in the correct place.

Review

This Pull Request was closed on March 8th 2022
Powered by GitHub Issue Mirror