From 1072a20f2e78759a10dc3310e613aa2128eadcd95815fefae97f01c068fbd34d Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Wed, 20 Dec 2017 15:49:40 +0000 Subject: [PATCH] Accepting request 556822 from home:mgorse:branches:GNOME:Factory - Add file-roller-ignore-unrar-if-wrapper.patch: Since unrar is non-free and it is planned to include a limited wrapper that would call unar, we should avoid this wrapper and call unar directly (bsc#1072118). - Add file-roller-rar-file-date.patch: fix wrong file date when using rar 5.30 or higher (bgo#758121). - Add file-roller-unar-dir-critical.patch: fix a warning when parsing lsar output (bgo#791505). OBS-URL: https://build.opensuse.org/request/show/556822 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/file-roller?expand=0&rev=260 --- file-roller-ignore-unrar-if-wrapper.patch | 52 +++++++++ file-roller-rar-file-date.patch | 131 ++++++++++++++++++++++ file-roller-unar-dir-critical.patch | 30 +++++ file-roller.changes | 12 ++ file-roller.spec | 9 ++ 5 files changed, 234 insertions(+) create mode 100644 file-roller-ignore-unrar-if-wrapper.patch create mode 100644 file-roller-rar-file-date.patch create mode 100644 file-roller-unar-dir-critical.patch diff --git a/file-roller-ignore-unrar-if-wrapper.patch b/file-roller-ignore-unrar-if-wrapper.patch new file mode 100644 index 0000000..8b432fa --- /dev/null +++ b/file-roller-ignore-unrar-if-wrapper.patch @@ -0,0 +1,52 @@ +diff -urp file-roller-3.26.2.orig/src/fr-command-rar.c file-roller-3.26.2/src/fr-command-rar.c +--- file-roller-3.26.2.orig/src/fr-command-rar.c 2017-10-31 15:07:52.000000000 -0500 ++++ file-roller-3.26.2/src/fr-command-rar.c 2017-12-13 12:25:16.159981774 -0600 +@@ -705,6 +705,39 @@ fr_command_rar_get_mime_types (FrArchive + return rar_mime_type; + } + ++static gboolean ++unrar_is_suse_wrapper () ++{ ++ const gchar *path = g_getenv ("PATH"); ++ gchar **paths; ++ gchar **pp; ++ gchar *p; ++ gchar *full_name; ++ FILE *fp; ++ char bytes[2]; ++ gboolean ret = FALSE; ++ ++ if (!path) ++ path = "/usr/bin"; ++ ++ paths = g_strsplit (path, ":", 0); ++ for (pp = paths; *pp; pp++) ++ { ++ p = *pp; ++ full_name = g_strconcat (p, "/unrar", NULL); ++ fp = fopen (full_name, "r"); ++ g_free (full_name); ++ if (!fp) ++ continue; ++ bytes[0] = bytes[1] = 0; ++ fread (bytes, 2, 1, fp); ++ fclose (fp); ++ ret = (bytes[0] == '#' && bytes[1] == '!'); ++ break; ++ } ++ g_strfreev (paths); ++ return ret; ++} + + static FrArchiveCap + fr_command_rar_get_capabilities (FrArchive *archive, +@@ -716,7 +749,7 @@ fr_command_rar_get_capabilities (FrArchi + capabilities = FR_ARCHIVE_CAN_STORE_MANY_FILES | FR_ARCHIVE_CAN_ENCRYPT | FR_ARCHIVE_CAN_ENCRYPT_HEADER; + if (_g_program_is_available ("rar", check_command)) + capabilities |= FR_ARCHIVE_CAN_READ_WRITE | FR_ARCHIVE_CAN_CREATE_VOLUMES; +- else if (_g_program_is_available ("unrar", check_command)) ++ else if (_g_program_is_available ("unrar", check_command) && !unrar_is_suse_wrapper ()) + capabilities |= FR_ARCHIVE_CAN_READ; + + /* multi-volumes are read-only */ diff --git a/file-roller-rar-file-date.patch b/file-roller-rar-file-date.patch new file mode 100644 index 0000000..a6d64c6 --- /dev/null +++ b/file-roller-rar-file-date.patch @@ -0,0 +1,131 @@ +From f1e74492e765a3e055e0bed61cc5b2b930de12ad Mon Sep 17 00:00:00 2001 +From: Paolo Bacchilega +Date: Sun, 19 Nov 2017 16:49:32 +0100 +Subject: [PATCH] rar archives: wrong file date when using rar 5.30 or higher + +adapt to the new format + +[bug #758121] +--- + src/fr-command-rar.c | 78 +++++++++++++++++++++++++++++++++++++++++++++------- + src/fr-command-rar.h | 1 + + 2 files changed, 69 insertions(+), 10 deletions(-) + +diff --git a/src/fr-command-rar.c b/src/fr-command-rar.c +index adfc3daa..8f31f7a3 100644 +--- a/src/fr-command-rar.c ++++ b/src/fr-command-rar.c +@@ -84,6 +84,61 @@ mktime_from_string (const char *date_s, + return mktime (&tm); + } + ++ ++static time_t ++mktime_from_string_rar_5_30 (const char *date_s, ++ const char *time_s) ++{ ++ struct tm tm = {0, }; ++ char **fields; ++ ++ tm.tm_isdst = -1; ++ ++ /* date */ ++ ++ fields = g_strsplit (date_s, "-", 3); ++ if (fields[0] != NULL) { ++ tm.tm_year = atoi (fields[0]) - 1900; ++ if (fields[1] != NULL) { ++ tm.tm_mon = atoi (fields[1]) - 1; ++ if (fields[2] != NULL) ++ tm.tm_mday = atoi (fields[2]); ++ } ++ } ++ g_strfreev (fields); ++ ++ /* time */ ++ ++ fields = g_strsplit (time_s, ":", 2); ++ if (fields[0] != NULL) { ++ tm.tm_hour = atoi (fields[0]); ++ if (fields[1] != NULL) ++ tm.tm_min = atoi (fields[1]); ++ } ++ g_strfreev (fields); ++ ++ return mktime (&tm); ++} ++ ++ ++/* ++ * Sample rar 5.30 or higher output: ++ * ++ ++RAR 5.30 Copyright (c) 1993-2017 Alexander Roshal 11 Aug 2017 ++Trial version Type 'rar -?' for help ++ ++Archive: test.rar ++Details: RAR 5 ++ ++ Attributes Size Packed Ratio Date Time Checksum Name ++----------- --------- -------- ----- ---------- ----- -------- ---- ++ -rw-r--r-- 51 47 92% 2017-11-19 16:20 80179DAB loremipsum.txt ++----------- --------- -------- ----- ---------- ----- -------- ---- ++ 51 47 92% 1 ++ ++ */ ++ + /* Sample rar-5 listing output: + + RAR 5.00 beta 8 Copyright (c) 1993-2013 Alexander Roshal 22 Aug 2013 +@@ -187,15 +242,17 @@ process_line (char *line, + g_return_if_fail (line != NULL); + + if (! rar_comm->list_started) { +- if (strncmp (line, "RAR ", 4) == 0) { +- int version; +- sscanf (line, "RAR %d.", &version); +- rar_comm->rar5 = (version >= 5); +- } +- else if (strncmp (line, "UNRAR ", 6) == 0) { +- int version; +- sscanf (line, "UNRAR %d.", &version); +- rar_comm->rar5 = (version >= 5); ++ if ((strncmp (line, "RAR ", 4) == 0) || (strncmp (line, "UNRAR ", 6) == 0)) { ++ int major_version; ++ int minor_version; ++ ++ if (strncmp (line, "RAR ", 4) == 0) ++ sscanf (line, "RAR %d.%d", &major_version, &minor_version); ++ else ++ sscanf (line, "UNRAR %d.%d", &major_version, &minor_version); ++ ++ rar_comm->rar5 = (major_version >= 5); ++ rar_comm->rar5_30 = ((major_version == 5) && (minor_version >= 30)) || (major_version >= 6); + } + else if (strncmp (line, "--------", 8) == 0) { + rar_comm->list_started = TRUE; +@@ -259,7 +316,8 @@ process_line (char *line, + } + else { + fdata->size = g_ascii_strtoull (size_field, NULL, 10); +- fdata->modified = mktime_from_string (date_field, time_field); ++ ++ fdata->modified = rar_comm->rar5_30 ? mktime_from_string_rar_5_30 (date_field, time_field) : mktime_from_string (date_field, time_field); + + if (attr_field_is_dir (attr_field, rar_comm)) { + char *tmp; +diff --git a/src/fr-command-rar.h b/src/fr-command-rar.h +index 09ed2709..2a6e671d 100644 +--- a/src/fr-command-rar.h ++++ b/src/fr-command-rar.h +@@ -44,6 +44,7 @@ struct _FrCommandRar + gboolean list_started; + gboolean rar4_odd_line; + gboolean rar5; ++ gboolean rar5_30; + FileData *fdata; + }; + +-- +2.15.0 + diff --git a/file-roller-unar-dir-critical.patch b/file-roller-unar-dir-critical.patch new file mode 100644 index 0000000..a825dbc --- /dev/null +++ b/file-roller-unar-dir-critical.patch @@ -0,0 +1,30 @@ +From fe422f7c6b42a0d618b2b49999cfb2210f9ceca5 Mon Sep 17 00:00:00 2001 +From: Mike Gorse +Date: Mon, 11 Dec 2017 21:34:40 -0600 +Subject: [PATCH] unarchiver: check that XADFileSize is set before reading it + +Lsar does not set XADFileSize for directories, so we would output a +critical when encountering one. + +https://bugzilla.gnome.org/show_bug.cgi?id=791505 +--- + src/fr-command-unarchiver.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/fr-command-unarchiver.c b/src/fr-command-unarchiver.c +index a7cdb834..5e8fd705 100644 +--- a/src/fr-command-unarchiver.c ++++ b/src/fr-command-unarchiver.c +@@ -91,7 +91,8 @@ list_command_completed (gpointer data) + + entry = json_array_get_object_element (content, i); + fdata = file_data_new (); +- fdata->size = json_object_get_int_member (entry, "XADFileSize"); ++ if (json_object_has_member (entry, "XADFileSize")) ++ fdata->size = json_object_get_int_member (entry, "XADFileSize"); + fdata->modified = mktime_from_string (json_object_get_string_member (entry, "XADLastModificationDate")); + if (json_object_has_member (entry, "XADIsEncrypted")) + fdata->encrypted = json_object_get_int_member (entry, "XADIsEncrypted") == 1; +-- +2.15.0 + diff --git a/file-roller.changes b/file-roller.changes index 554deb4..51f9ac4 100644 --- a/file-roller.changes +++ b/file-roller.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Wed Dec 13 19:02:07 UTC 2017 - mgorse@suse.com + +- Add file-roller-ignore-unrar-if-wrapper.patch: Since unrar is + non-free and it is planned to include a limited wrapper that + would call unar, we should avoid this wrapper and call unar + directly (bsc#1072118). +- Add file-roller-rar-file-date.patch: fix wrong file date when + using rar 5.30 or higher (bgo#758121). +- Add file-roller-unar-dir-critical.patch: fix a warning when + parsing lsar output (bgo#791505). + ------------------------------------------------------------------- Tue Oct 31 22:06:03 UTC 2017 - luc14n0@linuxmail.org diff --git a/file-roller.spec b/file-roller.spec index e339ca9..a109723 100644 --- a/file-roller.spec +++ b/file-roller.spec @@ -28,6 +28,12 @@ Source: https://download.gnome.org/sources/file-roller/3.26/%{name}-%{ve Patch0: file-roller-3.4-change-archiver-priority.patch # PATCH-FEATURE-OPENSUSE file-roller-pkg-match.patch bnc#696530 dimstar@opensuse.org -- List package match names for automatic installation using PK. Patch1: file-roller-pkg-match.patch +# PATCH-FIX-OPENSUSE file-roller-ignore-unrar-if-wrapper.patch bsc#1072118 mgorse@suse.com -- if unrar is a wrapper script for unar, then ignore it, and use unar instead. +Patch2: file-roller-ignore-unrar-if-wrapper.patch +# PATCH-FIX-UPSTREAM file-roller-rar-file-date.patch bgo#758121 mgorse@suse.com -- fix wrong file date when using rar 5.30 or higher. +Patch3: file-roller-rar-file-date.patch +# PATCH-FIX-UPSTREAM file-roller-unar-dir-critical.patch bgo#791505 mgorse@suse.com -- fix warning when parsing lsar output. +Patch4: file-roller-unar-dir-critical.patch # Needed for directory ownership BuildRequires: dbus-1 BuildRequires: fdupes @@ -84,6 +90,9 @@ contained in the archive, and extract files from the archive. %setup -q %patch0 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 %if !0%{?is_opensuse} translation-update-upstream %endif