[gnome-autoar/wip/oholy/compressor-hardlink-fixes: 1/3] compressor: Fix hardlink detection for remote files
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-autoar/wip/oholy/compressor-hardlink-fixes: 1/3] compressor: Fix hardlink detection for remote files
- Date: Thu, 25 Mar 2021 07:32:41 +0000 (UTC)
commit 5b24f77a1028945b8305f0f7e88963b6a15a712e
Author: Ondrej Holy <oholy redhat com>
Date: Wed Mar 24 15:09:52 2021 +0100
compressor: Fix hardlink detection for remote files
Currently, all files are considered as hardlinks when compressing files provided
by GVfs (e.g. SFTP) to TAR format, so the file content is lost for those files.
This is because the `inode`, `device`, and/or `nlink` attributes are not set for
those files. Let's do not call `archive_entry_linkify` in this case to not create
broken archives.
Fixes: https://gitlab.gnome.org/GNOME/gnome-autoar/-/issues/25
gnome-autoar/autoar-compressor.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gnome-autoar/autoar-compressor.c b/gnome-autoar/autoar-compressor.c
index 1650f43..c831c6a 100644
--- a/gnome-autoar/autoar-compressor.c
+++ b/gnome-autoar/autoar-compressor.c
@@ -946,7 +946,11 @@ autoar_compressor_do_add_to_archive (AutoarCompressor *self,
struct archive_entry *entry, *sparse;
entry = self->entry;
- archive_entry_linkify (self->resolver, &entry, &sparse);
+
+ if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_UNIX_DEVICE) &&
+ g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_UNIX_INODE) &&
+ g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_UNIX_NLINK))
+ archive_entry_linkify (self->resolver, &entry, &sparse);
if (entry != NULL) {
GFile *file_to_read;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]