[gnome-autoar/wip/oholy/compressor-hardlink-fixes: 3/3] compressor: Write all deffered hardlink entries
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-autoar/wip/oholy/compressor-hardlink-fixes: 3/3] compressor: Write all deffered hardlink entries
- Date: Thu, 25 Mar 2021 07:32:41 +0000 (UTC)
commit b1c7ea79df7a06de250be5e540c9a0dfc3149021
Author: Ondrej Holy <oholy redhat com>
Date: Wed Mar 24 16:16:51 2021 +0100
compressor: Write all deffered hardlink entries
Some formats, e.g. new cpio, writes the file content for hardlinks the
last time an inode is seen. To achieve this, the archive entries are
internally stored over `archive_entry_linkify` and written later.
After all archive entries are written, `archive_entry_linkify` has to
be called in a loop to write all deffered entries. However, currently
it is called only once, which can cause that some of the hardlinks is
not written to the archive. Let's call it in a loop to fix mentioned
issue.
Relates: https://gitlab.gnome.org/GNOME/gnome-autoar/-/issues/25
gnome-autoar/autoar-compressor.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gnome-autoar/autoar-compressor.c b/gnome-autoar/autoar-compressor.c
index 6f3e27e..e851a27 100644
--- a/gnome-autoar/autoar-compressor.c
+++ b/gnome-autoar/autoar-compressor.c
@@ -1514,12 +1514,12 @@ autoar_compressor_step_create (AutoarCompressor *self)
return;
}
- /* Process the final entry */
+ /* Process the final entries */
{
struct archive_entry *entry, *sparse;
entry = NULL;
archive_entry_linkify (self->resolver, &entry, &sparse);
- if (entry != NULL) {
+ while (entry != NULL) {
GFile *file_to_read;
const char *pathname_in_entry;
pathname_in_entry = archive_entry_pathname (entry);
@@ -1528,6 +1528,9 @@ autoar_compressor_step_create (AutoarCompressor *self)
autoar_compressor_do_write_data (self, entry, file_to_read);
/* I think we do not have to remove the entry in the hash table now
* because we are going to free the entire hash table. */
+
+ g_clear_pointer (&entry, archive_entry_free);
+ archive_entry_linkify (self->resolver, &entry, &sparse);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]