clearlinux / swupd-server

Software update server (deprecated)
Other
13 stars 17 forks source link

Skip subtraction when both files are deleted #58

Closed phmccarty closed 7 years ago

phmccarty commented 7 years ago

Subtracting files from manifests when both versions are marked deleted proves problematic for client updates, because the version at which the files were deleted will differ, and the client uses the versions to determine when it should delete files for an update.

As an example, consider a distro with 2 bundles, "A" and "B". Bundle B includes bundle A, which results in files in A being subtracted from B. In this situation the following sequence of four changes result in a subtraction that prevents a client update from deleting a file.

1) In version 10, file /usr/foo is added to bundles A and B. 2) In version 20, /usr/foo is deleted from bundle A. 3) In version 30, /usr/foo is deleted from bundle B. 4) In version 40, bundle B is modified.

Due to arbitrary modifications to bundle B in step 4, /usr/foo is subtracted from bundle B, because it's also deleted in bundle A. However, the file versions mismatch. So, an update from version 20 to 40 will result in /usr/foo not being deleted because the deleted entry from bundle A was not deleted in a version newer than 20.

This patch fixes the issue by ensuring that the deleted entry in bundle B remains intact for version 30. And the client update then works correctly: an update from 20 to 40 will properly delete /usr/foo, because 20 < 30 <= 40.

phmccarty commented 7 years ago

Uploaded patch set 2, with a revised code comment and slight fixes to the first commit's description.

tmarcu commented 7 years ago

lgtm with the new descriptions.