From: Eric Biggers Date: Fri, 23 Oct 2015 04:07:01 +0000 (-0500) Subject: write.c: compaction bug fix X-Git-Tag: v1.8.3~30 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=5bd190198afd209cacf088150536b8a01134fc7e;ds=sidebyside write.c: compaction bug fix --- diff --git a/src/write.c b/src/write.c index e118ac44..ab44f91b 100644 --- a/src/write.c +++ b/src/write.c @@ -2950,6 +2950,20 @@ check_resource_offsets(WIMStruct *wim, off_t end_offset) return 0; } +static int +free_blob_if_invalidated(struct blob_descriptor *blob, void *_wim) +{ + const WIMStruct *wim = _wim; + + if (!blob->will_be_in_output_wim && + blob->blob_location == BLOB_IN_WIM && blob->rdesc->wim == wim) + { + blob_table_unlink(wim->blob_table, blob); + free_blob_descriptor(blob); + } + return 0; +} + /* * Overwrite a WIM, possibly appending new resources to it. * @@ -3066,6 +3080,11 @@ overwrite_wim_inplace(WIMStruct *wim, int write_flags, unsigned num_threads) if (ret) goto out; + /* Prevent new files from being deduplicated with existing blobs + * in the WIM that we haven't decided to write. Such blobs will + * be overwritten during the compaction. */ + for_blob_in_table(wim->blob_table, free_blob_if_invalidated, wim); + if (wim_has_metadata(wim)) { /* Add existing metadata resources to be compacted along * with the file resources. */