clearlinux / swupd-server

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

Only create deltas between two regular files #57

Closed phmccarty closed 7 years ago

phmccarty commented 7 years ago

For three different Clear Linux OS builds in the last few months, deltas were created between files with type change L->F (symlink to file). This was allowed to occur because there is no check if file->peer->is_link in __create_delta().

Instead, remove the file->is_link check and simply ensure that the from/to file types are both F (i.e. "regular file").

tmarcu commented 7 years ago

+1, test for this would be nice to add. Maybe a TODO would be good so this is updated in the future when we do end up supporting more?

phmccarty commented 7 years ago

I will add a test shortly. I don't think it will make sense to create deltas between anything other than regular files...

Note that this code may need some rework for rename support. I didn't look into that.

phmccarty commented 7 years ago

I meant to use a logical OR instead of AND... the test I am writing caught this bug. I'll upload a revised patch + test shortly.

phmccarty commented 7 years ago

Uploaded a new patch set

tmarcu commented 7 years ago

Which parts of this code would have to be taken into consideration for rename support?

phmccarty commented 7 years ago

@tmarcu I'm not sure. My comment was more of a heads up that I have no idea how the current rename code creates deltas :-)