Toshaan Bharvani
3 years ago
commit
1fcf5694b9
4 changed files with 368 additions and 0 deletions
@ -0,0 +1,108 @@
@@ -0,0 +1,108 @@
|
||||
From b46a189982945d7154a12be59533f6385833a9cb Mon Sep 17 00:00:00 2001 |
||||
From: Ondrej Holy <oholy@redhat.com> |
||||
Date: Tue, 30 Nov 2021 13:39:55 +0100 |
||||
Subject: [PATCH] extractor: Fix extraction of raw format archives |
||||
|
||||
An extraction of raw format archives leads to crashes currently. |
||||
This is because the generic "data" string is returned from libarchive |
||||
instead of the real pathname, which is not expected currently. Let's |
||||
handle this case properly and fallback to the source basename. |
||||
|
||||
Fixes: https://gitlab.gnome.org/GNOME/gnome-autoar/-/issues/38 |
||||
--- |
||||
gnome-autoar/autoar-extractor.c | 53 +++++++++++++++++++-------------- |
||||
1 file changed, 31 insertions(+), 22 deletions(-) |
||||
|
||||
diff --git a/gnome-autoar/autoar-extractor.c b/gnome-autoar/autoar-extractor.c |
||||
index eb3edda..bb60901 100644 |
||||
--- a/gnome-autoar/autoar-extractor.c |
||||
+++ b/gnome-autoar/autoar-extractor.c |
||||
@@ -964,6 +964,7 @@ autoar_extractor_check_file_conflict (AutoarExtractor *self, |
||||
|
||||
/* Check also parents for conflict to be sure it is directory. */ |
||||
parent = g_file_get_parent (file); |
||||
+ g_return_val_if_fail (parent, NULL); |
||||
return autoar_extractor_check_file_conflict (self, parent, AE_IFDIR); |
||||
} |
||||
|
||||
@@ -1664,11 +1665,15 @@ autoar_extractor_step_scan_toplevel (AutoarExtractor *self) |
||||
return; |
||||
} |
||||
self->use_raw_format = TRUE; |
||||
+ |
||||
+ g_debug ("autoar_extractor_step_scan_toplevel: using raw format"); |
||||
} |
||||
|
||||
while ((r = archive_read_next_header (a, &entry)) == ARCHIVE_OK) { |
||||
const char *pathname; |
||||
g_autofree char *utf8_pathname = NULL; |
||||
+ const char *symlink_pathname; |
||||
+ const char *hardlink_pathname; |
||||
|
||||
if (g_cancellable_is_cancelled (self->cancellable)) { |
||||
archive_read_free (a); |
||||
@@ -1683,28 +1688,26 @@ autoar_extractor_step_scan_toplevel (AutoarExtractor *self) |
||||
} |
||||
} |
||||
|
||||
- if (self->use_raw_format) { |
||||
- pathname = autoar_common_get_basename_remove_extension (g_file_peek_path (self->source_file)); |
||||
- g_debug ("autoar_extractor_step_scan_toplevel: %d: raw pathname = %s", |
||||
- self->total_files, pathname); |
||||
- } else { |
||||
- const char *symlink_pathname; |
||||
- const char *hardlink_pathname; |
||||
- |
||||
- pathname = archive_entry_pathname (entry); |
||||
- utf8_pathname = autoar_common_get_utf8_pathname (pathname); |
||||
- symlink_pathname = archive_entry_symlink (entry); |
||||
- hardlink_pathname = archive_entry_hardlink (entry); |
||||
- |
||||
- g_debug ("autoar_extractor_step_scan_toplevel: %d: pathname = %s%s%s%s%s%s%s", |
||||
- self->total_files, pathname, |
||||
- utf8_pathname ? " utf8 pathname = " : "", |
||||
- utf8_pathname ? utf8_pathname : "", |
||||
- symlink_pathname ? " symlink = " : "", |
||||
- symlink_pathname ? symlink_pathname : "", |
||||
- hardlink_pathname ? " hardlink = " : "", |
||||
- hardlink_pathname ? hardlink_pathname : ""); |
||||
- } |
||||
+ pathname = archive_entry_pathname (entry); |
||||
+ utf8_pathname = autoar_common_get_utf8_pathname (pathname); |
||||
+ symlink_pathname = archive_entry_symlink (entry); |
||||
+ hardlink_pathname = archive_entry_hardlink (entry); |
||||
+ |
||||
+ /* The raw format usually doesn't propagate file name and the generic "data" |
||||
+ * string is returned instead. Let's use source basename in that case. |
||||
+ */ |
||||
+ if (self->use_raw_format && g_str_equal (pathname, "data")) |
||||
+ pathname = autoar_common_get_basename_remove_extension (self->source_basename); |
||||
+ |
||||
+ g_debug ("autoar_extractor_step_scan_toplevel: %d: pathname = %s%s%s%s%s%s%s", |
||||
+ self->total_files, pathname, |
||||
+ utf8_pathname ? " utf8 pathname = " : "", |
||||
+ utf8_pathname ? utf8_pathname : "", |
||||
+ symlink_pathname ? " symlink = " : "", |
||||
+ symlink_pathname ? symlink_pathname : "", |
||||
+ hardlink_pathname ? " hardlink = " : "", |
||||
+ hardlink_pathname ? hardlink_pathname : ""); |
||||
+ |
||||
self->files_list = |
||||
g_list_prepend (self->files_list, |
||||
autoar_extractor_do_sanitize_pathname (self, |
||||
@@ -1889,6 +1892,12 @@ autoar_extractor_step_extract (AutoarExtractor *self) { |
||||
pathname = archive_entry_pathname (entry); |
||||
hardlink = archive_entry_hardlink (entry); |
||||
|
||||
+ /* The raw format usually doesn't propagate file name and the generic "data" |
||||
+ * string is returned instead. Let's use source basename in that case. |
||||
+ */ |
||||
+ if (self->use_raw_format && g_str_equal (pathname, "data")) |
||||
+ pathname = autoar_common_get_basename_remove_extension (self->source_basename); |
||||
+ |
||||
extracted_filename = |
||||
autoar_extractor_do_sanitize_pathname (self, pathname); |
||||
|
||||
-- |
||||
2.33.1 |
||||
|
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
From 7237276439281abfedd619ecf6f5c17fae411137 Mon Sep 17 00:00:00 2001 |
||||
From: Ondrej Holy <oholy@redhat.com> |
||||
Date: Tue, 30 Nov 2021 13:45:07 +0100 |
||||
Subject: [PATCH] extractor: Fix extraction to root directory |
||||
|
||||
An extraction to the root of an archive which contains the "/" path |
||||
leads to crashes. Let's handle this rare corner case. |
||||
|
||||
Relates: https://gitlab.gnome.org/GNOME/gnome-autoar/-/issues/38 |
||||
--- |
||||
gnome-autoar/autoar-extractor.c | 10 +++++++++- |
||||
1 file changed, 9 insertions(+), 1 deletion(-) |
||||
|
||||
diff --git a/gnome-autoar/autoar-extractor.c b/gnome-autoar/autoar-extractor.c |
||||
index bb60901..ab68c47 100644 |
||||
--- a/gnome-autoar/autoar-extractor.c |
||||
+++ b/gnome-autoar/autoar-extractor.c |
||||
@@ -857,6 +857,14 @@ autoar_extractor_get_common_prefix (GList *files, |
||||
while (!g_file_has_parent (prefix, root)) { |
||||
file = g_file_get_parent (prefix); |
||||
g_object_unref (prefix); |
||||
+ |
||||
+ /* This can happen if the archive contains the "/" path and the destination |
||||
+ * is "/" as well. |
||||
+ */ |
||||
+ if (file == NULL) { |
||||
+ return NULL; |
||||
+ } |
||||
+ |
||||
prefix = file; |
||||
} |
||||
|
||||
@@ -984,7 +992,7 @@ autoar_extractor_do_write_entry (AutoarExtractor *self, |
||||
{ |
||||
GFile *parent; |
||||
parent = g_file_get_parent (dest); |
||||
- if (!g_file_query_exists (parent, self->cancellable)) |
||||
+ if (parent && !g_file_query_exists (parent, self->cancellable)) |
||||
g_file_make_directory_with_parents (parent, |
||||
self->cancellable, |
||||
NULL); |
||||
-- |
||||
2.33.1 |
||||
|
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
From 0f528ab688d4b01c51c0d33c3893854aae3d80ac Mon Sep 17 00:00:00 2001 |
||||
From: Ondrej Holy <oholy@redhat.com> |
||||
Date: Tue, 30 Nov 2021 10:53:22 +0100 |
||||
Subject: [PATCH] tests: Do not left read-only directory in the tree |
||||
|
||||
Currently, various tools fail to remove the read-only directory, which |
||||
is created as an output from the test suite. This for example breaks |
||||
package building when tests are enabled. Let's make it writable again |
||||
when test is done to fix the issue. |
||||
|
||||
Fixes: https://gitlab.gnome.org/GNOME/gnome-autoar/-/issues/34 |
||||
--- |
||||
tests/test-extract-unit.c | 6 ++++++ |
||||
1 file changed, 6 insertions(+) |
||||
|
||||
diff --git a/tests/test-extract-unit.c b/tests/test-extract-unit.c |
||||
index 615ba22..5965f48 100644 |
||||
--- a/tests/test-extract-unit.c |
||||
+++ b/tests/test-extract-unit.c |
||||
@@ -1264,6 +1264,7 @@ test_readonly_directory (void) |
||||
g_autoptr (ExtractTest) extract_test = NULL; |
||||
g_autoptr (ExtractTestData) data = NULL; |
||||
g_autoptr (GFile) archive = NULL; |
||||
+ g_autoptr (GFile) readonly = NULL; |
||||
g_autoptr (AutoarExtractor) extractor = NULL; |
||||
|
||||
extract_test = extract_test_new ("test-readonly-directory"); |
||||
@@ -1285,6 +1286,11 @@ test_readonly_directory (void) |
||||
g_assert_no_error (data->error); |
||||
g_assert_true (data->completed_signalled); |
||||
assert_reference_and_output_match (extract_test); |
||||
+ |
||||
+ /* Make the directory writable again to avoid issues when deleting. */ |
||||
+ readonly = g_file_get_child (extract_test->output, "arextract"); |
||||
+ g_file_set_attribute_uint32 (readonly, G_FILE_ATTRIBUTE_UNIX_MODE, 0755, |
||||
+ G_FILE_QUERY_INFO_NONE, NULL, NULL); |
||||
} |
||||
|
||||
static void |
||||
-- |
||||
2.33.1 |
||||
|
@ -0,0 +1,174 @@
@@ -0,0 +1,174 @@
|
||||
Name: gnome-autoar |
||||
Version: 0.4.1 |
||||
Release: 2%{?dist} |
||||
Summary: Archive library |
||||
|
||||
License: LGPLv2+ |
||||
URL: https://git.gnome.org/browse/gnome-autoar |
||||
Source0: https://download.gnome.org/sources/gnome-autoar/0.4/gnome-autoar-%{version}.tar.xz |
||||
|
||||
# https://gitlab.gnome.org/GNOME/gnome-autoar/-/issues/38 |
||||
Patch0: extractor-Fix-extraction-of-raw-format-archives.patch |
||||
Patch1: extractor-Fix-extraction-to-root-directory.patch |
||||
|
||||
# https://gitlab.gnome.org/GNOME/gnome-autoar/-/issues/34 |
||||
Patch2: tests-Do-not-left-read-only-directory-in-the-tree.patch |
||||
|
||||
BuildRequires: gcc |
||||
BuildRequires: meson |
||||
BuildRequires: gtk-doc |
||||
BuildRequires: pkgconfig(gio-2.0) |
||||
BuildRequires: pkgconfig(glib-2.0) |
||||
BuildRequires: pkgconfig(gobject-2.0) |
||||
BuildRequires: pkgconfig(gobject-introspection-1.0) |
||||
BuildRequires: pkgconfig(gtk+-3.0) |
||||
BuildRequires: pkgconfig(libarchive) |
||||
BuildRequires: vala |
||||
|
||||
%description |
||||
gnome-autoar is a GObject based library for handling archives. |
||||
|
||||
|
||||
%package devel |
||||
Summary: Development files for %{name} |
||||
Requires: %{name}%{?_isa} = %{version}-%{release} |
||||
|
||||
%description devel |
||||
The %{name}-devel package contains libraries and header files for |
||||
developing applications that use %{name}. |
||||
|
||||
|
||||
%prep |
||||
%autosetup -p1 |
||||
|
||||
|
||||
%build |
||||
%meson -Dvapi=true \ |
||||
-Dgtk_doc=true \ |
||||
-Dtests=true \ |
||||
%{nil} |
||||
%meson_build |
||||
|
||||
|
||||
%install |
||||
%meson_install |
||||
|
||||
|
||||
%check |
||||
%meson_test |
||||
|
||||
|
||||
%files |
||||
%license COPYING |
||||
%dir %{_libdir}/girepository-1.0 |
||||
%{_libdir}/girepository-1.0/GnomeAutoar-0.1.typelib |
||||
%{_libdir}/girepository-1.0/GnomeAutoarGtk-0.1.typelib |
||||
%{_libdir}/libgnome-autoar-0.so.0* |
||||
%{_libdir}/libgnome-autoar-gtk-0.so.0* |
||||
|
||||
%files devel |
||||
%{_includedir}/gnome-autoar-0/ |
||||
%{_libdir}/pkgconfig/gnome-autoar-0.pc |
||||
%{_libdir}/pkgconfig/gnome-autoar-gtk-0.pc |
||||
%{_libdir}/*.so |
||||
%dir %{_datadir}/gir-1.0 |
||||
%{_datadir}/gir-1.0/GnomeAutoar-0.1.gir |
||||
%{_datadir}/gir-1.0/GnomeAutoarGtk-0.1.gir |
||||
%{_datadir}/gtk-doc/ |
||||
%dir %{_datadir}/vala |
||||
%dir %{_datadir}/vala/vapi |
||||
%{_datadir}/vala/vapi/gnome-autoar-0.vapi |
||||
%{_datadir}/vala/vapi/gnome-autoar-gtk-0.vapi |
||||
%{_datadir}/vala/vapi/gnome-autoar-0.deps |
||||
%{_datadir}/vala/vapi/gnome-autoar-gtk-0.deps |
||||
|
||||
|
||||
%changelog |
||||
* Tue Dec 07 2021 Ondrej Holy <oholy@redhat.com> - 0.4.1-2 |
||||
- Fix extraction of raw format archives |
||||
- Run embedded test suite as a part of the build |
||||
|
||||
* Mon Nov 01 2021 Kalev Lember <klember@redhat.com> - 0.4.1-1 |
||||
- Update to 0.4.1 |
||||
|
||||
* Tue Aug 10 2021 Ondrej Holy <oholy@redhat.com> - 0.4.0-1 |
||||
- Update to 0.4.0 |
||||
|
||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 0.3.3-2 |
||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags |
||||
Related: rhbz#1991688 |
||||
|
||||
* Mon Jun 21 2021 Kalev Lember <klember@redhat.com> - 0.3.3-1 |
||||
- Update to 0.3.3 |
||||
|
||||
* Wed May 05 2021 Kalev Lember <klember@redhat.com> - 0.3.2-1 |
||||
- Update to 0.3.2 |
||||
|
||||
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 0.3.1-2 |
||||
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 |
||||
|
||||
* Mon Mar 15 2021 Kalev Lember <klember@redhat.com> - 0.3.1-1 |
||||
- Update to 0.3.1 |
||||
|
||||
* Wed Feb 17 2021 Kalev Lember <klember@redhat.com> - 0.3.0-1 |
||||
- Update to 0.3.0 |
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.4-5 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild |
||||
|
||||
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.4-4 |
||||
- Second attempt - Rebuilt for |
||||
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild |
||||
|
||||
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.4-3 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild |
||||
|
||||
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.4-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild |
||||
|
||||
* Tue Jan 07 2020 Kalev Lember <klember@redhat.com> - 0.2.4-1 |
||||
- Update to 0.2.4 |
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.3-4 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild |
||||
|
||||
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.3-3 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild |
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.3-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild |
||||
|
||||
* Sat Mar 03 2018 Kalev Lember <klember@redhat.com> - 0.2.3-1 |
||||
- Update to 0.2.3 |
||||
- Drop ldconfig scriptlets |
||||
|
||||
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.2-5 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild |
||||
|
||||
* Sat Feb 03 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.2.2-4 |
||||
- Switch to %%ldconfig_scriptlets |
||||
|
||||
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.2-3 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild |
||||
|
||||
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.2-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild |
||||
|
||||
* Tue Mar 21 2017 Kalev Lember <klember@redhat.com> - 0.2.2-1 |
||||
- Update to 0.2.2 |
||||
|
||||
* Fri Mar 03 2017 Kalev Lember <klember@redhat.com> - 0.2.1-1 |
||||
- Update to 0.2.1 |
||||
|
||||
* Fri Feb 24 2017 Kalev Lember <klember@redhat.com> - 0.2.0-1 |
||||
- Update to 0.2.0 |
||||
- Build with vala support |
||||
|
||||
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.1-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild |
||||
|
||||
* Sat Sep 03 2016 Kalev Lember <klember@redhat.com> - 0.1.1-1 |
||||
- Update to 0.1.1 |
||||
|
||||
* Fri Sep 02 2016 Kalev Lember <klember@redhat.com> - 0.1.0-1 |
||||
- Initial Fedora build |
Loading…
Reference in new issue