From 10361fb485b6304c2b13c38e2f5d845b349a8074 Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Mon, 22 Nov 2021 10:28:03 +0900 Subject: [PATCH 1/4] 1.12.3.1 --- .gitignore | 1 + ...viewer-utils-fix-logic-on-big-endian.patch | 102 ------------------ gnome-commander.spec | 7 +- sources | 2 +- 4 files changed, 6 insertions(+), 106 deletions(-) delete mode 100644 0001-unicode2utf8-viewer-utils-fix-logic-on-big-endian.patch diff --git a/.gitignore b/.gitignore index dff499e..6f72d53 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ gnome-commander-1.2.8.7.tar.bz2 /gnome-commander-1.12.1.tar.xz /gnome-commander-1.12.2.tar.xz /gnome-commander-1.12.3.tar.xz +/gnome-commander-1.12.3.1.tar.xz diff --git a/0001-unicode2utf8-viewer-utils-fix-logic-on-big-endian.patch b/0001-unicode2utf8-viewer-utils-fix-logic-on-big-endian.patch deleted file mode 100644 index f9e52d8..0000000 --- a/0001-unicode2utf8-viewer-utils-fix-logic-on-big-endian.patch +++ /dev/null @@ -1,102 +0,0 @@ -From dcaaf89d44ddb463e8be22583080f454fc61d2d9 Mon Sep 17 00:00:00 2001 -From: gnome-commander Fedora maintainer - -Date: Sun, 21 Nov 2021 11:21:29 +0900 -Subject: [PATCH] unicode2utf8(viewer-utils): fix logic on big endian - ---- - src/intviewer/inputmodes.cc | 2 +- - src/intviewer/viewer-utils.cc | 24 ++++++++++++------------ - src/intviewer/viewer-utils.h | 2 +- - 3 files changed, 14 insertions(+), 14 deletions(-) - -diff --git a/src/intviewer/inputmodes.cc b/src/intviewer/inputmodes.cc -index 269777e7..7a4d1b5f 100644 ---- a/src/intviewer/inputmodes.cc -+++ b/src/intviewer/inputmodes.cc -@@ -223,7 +223,7 @@ static void inputmode_ascii_activate(GVInputModesData *imd, const gchar *encodin - { - // these are defined in 'cp437.c' - unsigned int unicode = ascii_cp437_to_unicode[i]; -- unicode2utf8(unicode, (unsigned char*)&imd->ascii_charset_translation[i]); -+ unicode2utf8(unicode, &imd->ascii_charset_translation[i]); - } - g_free (imd->input_mode_name); - imd->input_mode_name = g_strdup ("CP437"); -diff --git a/src/intviewer/viewer-utils.cc b/src/intviewer/viewer-utils.cc -index 40f8819c..6d9c6e59 100644 ---- a/src/intviewer/viewer-utils.cc -+++ b/src/intviewer/viewer-utils.cc -@@ -29,36 +29,36 @@ - - using namespace std; - --int unicode2utf8 (unsigned int unicode, unsigned char *out) -+int unicode2utf8 (unsigned int unicode, char_type *out) - { - int bytes_needed = 0; - if (unicode<0x80) - { - bytes_needed = 1; -- out[0] = (unsigned char)(unicode&0xFF); -+ *out = (unsigned char)(unicode&0xFF); - } - else - if (unicode<0x0800) - { - bytes_needed = 2; -- out[0] = (unsigned char)(unicode>>6 | 0xC0); -- out[1] = (unsigned char)((unicode&0x3F)| 0x80); -+ *out = (unsigned char)(unicode>>6 | 0xC0); -+ *out |= ((unsigned char)((unicode&0x3F)| 0x80) << 8); - } - else - if (unicode<0x10000) - { - bytes_needed = 3; -- out[0] = (unsigned char)((unicode>>12) | 0xE0); -- out[1] = (unsigned char)(((unicode>>6) & 0x3F) | 0x80); -- out[2] = (unsigned char)((unicode & 0x3F) | 0x80); -+ *out = (unsigned char)((unicode>>12) | 0xE0); -+ *out |= ((unsigned char)(((unicode>>6) & 0x3F) | 0x80) << 8); -+ *out |= ((unsigned char)((unicode & 0x3F) | 0x80) << 16); - } - else - { - bytes_needed = 4; -- out[0] = (unsigned char)((unicode>>18) | 0xE0); -- out[1] = (unsigned char)(((unicode>>12) & 0x3F) | 0x80); -- out[2] = (unsigned char)(((unicode>>6) & 0x3F) | 0x80); -- out[3] = (unsigned char)((unicode & 0x3F) | 0x80); -+ *out = (unsigned char)((unicode>>18) | 0xE0); -+ *out |= ((unsigned char)(((unicode>>12) & 0x3F) | 0x80) << 8); -+ *out |= ((unsigned char)(((unicode>>6) & 0x3F) | 0x80) << 16); -+ *out |= ((unsigned char)((unicode & 0x3F) | 0x80) << 24); - } - - return bytes_needed; -@@ -84,7 +84,7 @@ char_type *convert_utf8_to_chartype_array (const gchar *utf8text, /*out*/ int &a - { - unicode_char = g_utf8_get_char(pos); - -- unicode2utf8(unicode_char, (unsigned char*)&result[index]); -+ unicode2utf8(unicode_char, &result[index]); - - pos = g_utf8_next_char(pos); - if (!pos) -diff --git a/src/intviewer/viewer-utils.h b/src/intviewer/viewer-utils.h -index eb06fedc..c561e698 100644 ---- a/src/intviewer/viewer-utils.h -+++ b/src/intviewer/viewer-utils.h -@@ -26,7 +26,7 @@ - - #define GVIEWER_DEFAULT_PATH_PREFIX "/gnome-commander/internal_viewer/" - --int unicode2utf8(unsigned int unicode, unsigned char *out); -+int unicode2utf8(unsigned int unicode, char_type *out); - char_type *convert_utf8_to_chartype_array(const gchar *utf8text, /*out*/ int &array_length); - - guint8 *mem_reverse(const guint8 *buffer, guint buflen); --- -2.33.1 - diff --git a/gnome-commander.spec b/gnome-commander.spec index dc9a24f..713c76e 100644 --- a/gnome-commander.spec +++ b/gnome-commander.spec @@ -40,7 +40,7 @@ %endif %global shortver 1.12 -%global fullver %{shortver}.3 +%global fullver %{shortver}.3.1 %global mainrel 1 %if 0%{?use_release} >= 1 @@ -87,7 +87,6 @@ Source2: create-gcmd-git-bare-tarball.sh Source10: mimeedit-svn%{mimeedit_rev}.sh Patch1: gnome-commander-1.6.0-path-fedora-specific.patch # Must send to be upstream -Patch101: 0001-unicode2utf8-viewer-utils-fix-logic-on-big-endian.patch BuildRequires: gcc-c++ %if 0%{?use_gcc_strict_sanitize} @@ -199,7 +198,6 @@ git commit -m "base" -q %patch1 -p1 -b .path git commit -m "Apply Fedora specific path configuration" -a -cat %PATCH101 | git am %if 0%{use_autotool} > 0 ( export NOCONFIGURE=1 ; sh autogen.sh ) @@ -367,6 +365,9 @@ popd %{_datadir}/pixmaps/%{name}/ %changelog +* Mon Nov 22 2021 Mamoru TASAKA - 4:1.12.3.1-1 +- 1.12.3.1 + * Sun Nov 21 2021 Mamoru TASAKA - 4:1.12.3-1 - 1.12.3 - enable test diff --git a/sources b/sources index 1efd9b0..212c6fb 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-commander-1.12.3.tar.xz) = 7bdf29e9668b3eb40604db665d55d9300317f756a785ed5b6d5b6f5d684dc9a6c0fdcfeabd06cf522a9dbc9bbe904e575947d9eef771eab3dd813bd8e50dc5a9 +SHA512 (gnome-commander-1.12.3.1.tar.xz) = 1206d545493deeb2237af6b9026baf6faab2a8f6ae86eb1abb5c2e5ceb6212ad66382d3abd07c89f14271ac8709d14548f0bfe68fb0e11b1779e0c061e0272e5 From ecd0a7b79506f709dfc437dec4b4da2f45878d26 Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Mon, 22 Nov 2021 22:59:00 +0900 Subject: [PATCH 2/4] Fix crash when saving device information on preference --- ...e_devices-place-GVariantBuilder-stru.patch | 64 +++++++++++++++++++ gnome-commander.spec | 30 ++++++++- 2 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 0001-GnomeCmdData-save_devices-place-GVariantBuilder-stru.patch diff --git a/0001-GnomeCmdData-save_devices-place-GVariantBuilder-stru.patch b/0001-GnomeCmdData-save_devices-place-GVariantBuilder-stru.patch new file mode 100644 index 0000000..7aafb7e --- /dev/null +++ b/0001-GnomeCmdData-save_devices-place-GVariantBuilder-stru.patch @@ -0,0 +1,64 @@ +From 9723c65d0295baedeb6ee4cb85b35ab51ef22376 Mon Sep 17 00:00:00 2001 +From: Mamoru TASAKA +Date: Mon, 22 Nov 2021 17:04:36 +0900 +Subject: [PATCH] GnomeCmdData::save_devices: place GVariantBuilder structure + on stack initially + +As written on: +https://www.freedesktop.org/software/gstreamer-sdk/data/docs/latest/glib/glib-GVariant.html#g-variant-builder-new +when calling g_variant_builder_init(), GVariantBuilder structure must be placed on stack first +and the reference to the memory must be passed to the function, instead of +passing nullptr. +--- + src/gnome-cmd-data.cc | 15 ++++++++------- + 1 file changed, 8 insertions(+), 7 deletions(-) + +diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc +index 51407cc..b38f96a 100644 +--- a/src/gnome-cmd-data.cc ++++ b/src/gnome-cmd-data.cc +@@ -1722,23 +1722,24 @@ void GnomeCmdData::save_devices() + devices = gnome_cmd_con_list_get_all_dev (gnome_cmd_data.priv->con_list); + if (devices && g_list_length(devices) > 0) + { +- GVariantBuilder *gVariantBuilder = nullptr; ++ GVariantBuilder gVariantBuilder; ++ gboolean device_added_p = false; + + for (; devices; devices = devices->next) + { + auto *device = GNOME_CMD_CON_DEVICE (devices->data); + if (device && !gnome_cmd_con_device_get_autovol (device)) + { +- if (!gVariantBuilder) ++ if (!device_added_p) + { +- g_variant_builder_init (gVariantBuilder, G_VARIANT_TYPE_ARRAY); ++ g_variant_builder_init (&gVariantBuilder, G_VARIANT_TYPE_ARRAY); + } +- ++ device_added_p = true; + gchar *icon_path = g_strdup (gnome_cmd_con_device_get_icon_path (device)); + if (!icon_path || icon_path[0] == '\0') + icon_path = g_strdup (""); + +- g_variant_builder_add (gVariantBuilder, GCMD_SETTINGS_DEVICES_FORMAT_STRING, ++ g_variant_builder_add (&gVariantBuilder, GCMD_SETTINGS_DEVICES_FORMAT_STRING, + gnome_cmd_con_device_get_alias (device), + gnome_cmd_con_device_get_device_fn (device), + gnome_cmd_con_device_get_mountp (device), +@@ -1747,9 +1748,9 @@ void GnomeCmdData::save_devices() + } + } + +- if (gVariantBuilder) ++ if (device_added_p) + { +- devicesToStore = g_variant_builder_end (gVariantBuilder); ++ devicesToStore = g_variant_builder_end (&gVariantBuilder); + g_settings_set_value(options.gcmd_settings->general, GCMD_SETTINGS_DEVICES, devicesToStore); + return; + } +-- +2.33.1 + diff --git a/gnome-commander.spec b/gnome-commander.spec index 713c76e..c69add0 100644 --- a/gnome-commander.spec +++ b/gnome-commander.spec @@ -13,7 +13,7 @@ %global update_po 0 %global if_pre 0 -%global use_gcc_strict_sanitize 0 +%global use_gcc_strict_sanitize 1 %global use_release 1 %global use_gitbare 0 @@ -41,7 +41,7 @@ %global shortver 1.12 %global fullver %{shortver}.3.1 -%global mainrel 1 +%global mainrel 2 %if 0%{?use_release} >= 1 %global fedorarel %{?prever:0.}%{mainrel}%{?prever:.%{prerpmver}} @@ -87,6 +87,7 @@ Source2: create-gcmd-git-bare-tarball.sh Source10: mimeedit-svn%{mimeedit_rev}.sh Patch1: gnome-commander-1.6.0-path-fedora-specific.patch # Must send to be upstream +Patch101: 0001-GnomeCmdData-save_devices-place-GVariantBuilder-stru.patch BuildRequires: gcc-c++ %if 0%{?use_gcc_strict_sanitize} @@ -192,12 +193,34 @@ git config user.name "%{name} Fedora maintainer" git config user.email "%{name}-owner@fedoraproject.org" %if 0%{?use_release} +cat > .gitignore < 0 ( export NOCONFIGURE=1 ; sh autogen.sh ) @@ -365,6 +388,9 @@ popd %{_datadir}/pixmaps/%{name}/ %changelog +* Mon Nov 22 2021 Mamoru TASAKA - 4:1.12.3.1-2 +- Fix crash when saving device information on preference + * Mon Nov 22 2021 Mamoru TASAKA - 4:1.12.3.1-1 - 1.12.3.1 From c6a3cf3ce65710806761a26c104b306daa6b1342 Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Mon, 22 Nov 2021 23:04:26 +0900 Subject: [PATCH 3/4] drop sanitizer for formal build, oops... --- gnome-commander.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnome-commander.spec b/gnome-commander.spec index c69add0..068a248 100644 --- a/gnome-commander.spec +++ b/gnome-commander.spec @@ -13,7 +13,7 @@ %global update_po 0 %global if_pre 0 -%global use_gcc_strict_sanitize 1 +%global use_gcc_strict_sanitize 0 %global use_release 1 %global use_gitbare 0 From d258ce83af90b7b3a27da78da28804c9284be6b3 Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Wed, 24 Nov 2021 22:24:28 +0900 Subject: [PATCH 4/4] wrap patch --- gnome-commander.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gnome-commander.spec b/gnome-commander.spec index 068a248..f166d9d 100644 --- a/gnome-commander.spec +++ b/gnome-commander.spec @@ -220,7 +220,10 @@ git commit -m "base" -q %patch1 -p1 -b .path git commit -m "Apply Fedora specific path configuration" -a +%if 0%{?use_release} +# Already fixed in git master cat %PATCH101 | git am +%endif %if 0%{use_autotool} > 0 ( export NOCONFIGURE=1 ; sh autogen.sh )