[gnome-autoar/wip/oholy/extractor-readonly-folders] extractor: Fix extraction of readonly folders
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-autoar/wip/oholy/extractor-readonly-folders] extractor: Fix extraction of readonly folders
- Date: Thu, 25 Mar 2021 07:37:45 +0000 (UTC)
commit 2b2672a33cd50c0349aeeb432f4697cec44ea36b
Author: Ondrej Holy <oholy redhat com>
Date: Wed Mar 24 17:23:48 2021 +0100
extractor: Fix extraction of readonly folders
If archive contains read-only folders, the extraction of their children
fails with the "Permissions denied" error. This is because the folder
permissions are restored immediately before writing their children.
Let's do not restore unix mode before writing the children to fix
this issue.
gnome-autoar/autoar-extractor.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gnome-autoar/autoar-extractor.c b/gnome-autoar/autoar-extractor.c
index fd2dfd5..eb707fe 100644
--- a/gnome-autoar/autoar-extractor.c
+++ b/gnome-autoar/autoar-extractor.c
@@ -1204,8 +1204,12 @@ autoar_extractor_do_write_entry (AutoarExtractor *self,
}
fileandinfo.file = g_object_ref (dest);
- fileandinfo.info = g_object_ref (info);
+ fileandinfo.info = g_file_info_dup (info);
g_array_append_val (self->extracted_dir_list, fileandinfo);
+
+ /* Unset folder permissions for now to be sure it is writable. */
+ g_file_info_set_attribute (info, G_FILE_ATTRIBUTE_UNIX_MODE,
+ G_FILE_ATTRIBUTE_TYPE_INVALID, NULL);
}
break;
case AE_IFLNK:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]