GNOME Bugzilla – Bug 756260
Applying static deltas sometimes fails
Last modified: 2015-10-10 14:42:20 UTC
I have seen multiple different failures when applying static deltas in the latest version (2015.9) of ostree: 1. Sometimes there is an lzma error. This is due to not returning the correct special error codes from _ostree_lzma_decompressor_convert when the input buffer has length 0. 2. If some objects that the static delta generates are already present in the repo for whatever reason there are lots of failed assertions. While debugging this I also noticed an error that isn't handled gracefully when generating static deltas: if bsdiff fails due to running out of memory, the top level g_assert (success || error) fails since error is not set properly.
Created attachment 312921 [details] [review] static-delta: Handle LZMA_BUF_ERROR returned by zlib zlib can return LZMA_BUF_ERROR, which indicates that either the input or output buffer has size zero. This case should cause the correct error to be passed back from g_converter_convert to expand the relevant buffer. Since this error is ambiguous as to which buffer is too small, an explicit check on the output buffer size is added as well.
Created attachment 312922 [details] [review] static-delta: Don't run bspatch when output object already exists There is already a check that the destination object does not exist in all other cases when processing an incoming static delta. However, the bspatch case would still try to run and fail. Add an analogous check to that case as well.
Created attachment 312923 [details] [review] static-delta: Set error on bsdiff failure bsdiff can fail when generating static deltas, particularly if not enough memory is available. Set error properly when this happens.
Review of attachment 312921 [details] [review]: Looks similar to what we're doing with the zlib compressor. OK.
Comment on attachment 312921 [details] [review] static-delta: Handle LZMA_BUF_ERROR returned by zlib https://git.gnome.org/browse/ostree/commit/?id=dd35e1b9cdb4b8abf0ffd15263ae33db3e729d75
Review of attachment 312922 [details] [review]: LGTM
Review of attachment 312922 [details] [review]: https://git.gnome.org/browse/ostree/commit/?id=f2b4a9e10729321d7fd90382cda28d450479b336
Review of attachment 312923 [details] [review]: LGTM. Aside, would be interesting to see if a a static analyzer could detect this.
Review of attachment 312923 [details] [review]: https://git.gnome.org/browse/ostree/commit/?id=60e5529ba0143e6bf4e204fd00f7989d0f3c57c5