Package: release.debian.org
Severity: normal
Tags: bookworm
User: release.debian....@packages.debian.org
Usertags: pu
X-Debbugs-Cc: engra...@packages.debian.org
Control: affects -1 + src:engrampa

[ Reason ]
While upload a new upstream version of engrampa, a bookworm-pu has been
prepared that fixes various memleaks and resolves a bug in the archive
"save as" action.

[ Impact ]
Engrampa will still have memleaks + the save as dialog will still be
broken.

[ Tests ]
Manually. A new dialog box has been added by upstream. This will
only be presented to the users in English (as the translations
have not been cherry-picked into this package).

[ Risks ]
Regressions might occur, affecting engrampa and in general MATE desktop
users.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

[ Changes ]

+  * debian/patches:
+    + Cherry-pick various memleak fixes from upstream:
+      0001_dlg-package-installer-fix-memory-leak.patch,
+      0002_fr-window-fix-memory-leak.patch,
+      0003_file-data-fix-memory-leak.patch, and
+      0005_fr-process-fix-memory-leak.patch.
+    + Add 0004_Fix-archive-file-save-as-function.patch. Fix archive 'save as'
+      function. (Closes: #969761).

[ Other info ]
None.
diff -Nru engrampa-1.26.0/debian/changelog engrampa-1.26.0/debian/changelog
--- engrampa-1.26.0/debian/changelog    2021-12-12 16:00:52.000000000 +0100
+++ engrampa-1.26.0/debian/changelog    2023-12-29 08:13:22.000000000 +0100
@@ -1,3 +1,16 @@
+engrampa (1.26.0-1+deb12u1) bookworm; urgency=medium
+
+  * debian/patches:
+    + Cherry-pick various memleak fixes from upstream:
+      0001_dlg-package-installer-fix-memory-leak.patch,
+      0002_fr-window-fix-memory-leak.patch,
+      0003_file-data-fix-memory-leak.patch, and
+      0005_fr-process-fix-memory-leak.patch.
+    + Add 0004_Fix-archive-file-save-as-function.patch. Fix archive 'save as'
+      function. (Closes: #969761).
+
+ -- Mike Gabriel <sunwea...@debian.org>  Fri, 29 Dec 2023 08:13:22 +0100
+
 engrampa (1.26.0-1) unstable; urgency=medium
 
   [ Martin Wimpress ]
diff -Nru 
engrampa-1.26.0/debian/patches/0001_dlg-package-installer-fix-memory-leak.patch 
engrampa-1.26.0/debian/patches/0001_dlg-package-installer-fix-memory-leak.patch
--- 
engrampa-1.26.0/debian/patches/0001_dlg-package-installer-fix-memory-leak.patch 
    1970-01-01 01:00:00.000000000 +0100
+++ 
engrampa-1.26.0/debian/patches/0001_dlg-package-installer-fix-memory-leak.patch 
    2023-12-29 08:03:51.000000000 +0100
@@ -0,0 +1,38 @@
+From da64dd31f77a8082650d0904da19a21dfc400ae1 Mon Sep 17 00:00:00 2001
+From: rbuj <robert....@gmail.com>
+Date: Thu, 21 Oct 2021 20:12:17 +0200
+Subject: [PATCH 1/5] dlg-package-installer: fix memory leak
+
+Signed-off-by: Mike Gabriel <mike.gabr...@das-netzwerkteam.de>
+---
+ src/dlg-package-installer.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/dlg-package-installer.c b/src/dlg-package-installer.c
+index 0b18441..3cda168 100644
+--- a/src/dlg-package-installer.c
++++ b/src/dlg-package-installer.c
+@@ -305,9 +305,11 @@ dlg_package_installer (FrWindow  *window,
+       {
+               char      *secondary_text;
+               GtkWidget *dialog;
++              char      *description;
+ 
++              description = g_content_type_get_description 
(idata->archive->content_type);
+               secondary_text = g_strdup_printf (_("There is no command 
installed for %s files.\nDo you want to search for a command to open this 
file?"),
+-                                                
g_content_type_get_description (idata->archive->content_type));
++                                                description);
+               dialog = _gtk_message_dialog_new (GTK_WINDOW (idata->window),
+                                                 GTK_DIALOG_MODAL,
+                                                 "dialog-error",
+@@ -328,6 +330,7 @@ dlg_package_installer (FrWindow  *window,
+               g_signal_connect (dialog, "response", G_CALLBACK 
(confirm_search_dialog_response_cb), idata);
+               gtk_widget_show (dialog);
+ 
++              g_free (description);
+               g_free (secondary_text);
+       }
+ 
+-- 
+2.39.2
+
diff -Nru engrampa-1.26.0/debian/patches/0002_fr-window-fix-memory-leak.patch 
engrampa-1.26.0/debian/patches/0002_fr-window-fix-memory-leak.patch
--- engrampa-1.26.0/debian/patches/0002_fr-window-fix-memory-leak.patch 
1970-01-01 01:00:00.000000000 +0100
+++ engrampa-1.26.0/debian/patches/0002_fr-window-fix-memory-leak.patch 
2023-12-29 08:03:51.000000000 +0100
@@ -0,0 +1,81 @@
+From c0fadd464f227e7ebbfefd3fa54e578f1bb9998b Mon Sep 17 00:00:00 2001
+From: rbuj <robert....@gmail.com>
+Date: Thu, 21 Oct 2021 21:34:05 +0200
+Subject: [PATCH 2/5] fr-window: fix memory leak
+
+Signed-off-by: Mike Gabriel <mike.gabr...@das-netzwerkteam.de>
+---
+ src/fr-window.c | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/src/fr-window.c b/src/fr-window.c
+index 9a30f5e..b5b5cff 100644
+--- a/src/fr-window.c
++++ b/src/fr-window.c
+@@ -560,6 +560,7 @@ fr_window_free_private_data (FrWindow *window)
+       g_free (window->priv->add_default_dir);
+       g_free (window->priv->extract_default_dir);
+       g_free (window->priv->archive_uri);
++      g_free (window->priv->working_archive);
+ 
+       g_free (window->priv->password);
+       g_free (window->priv->password_for_paste);
+@@ -981,7 +982,7 @@ sort_by_type (gconstpointer  ptr1,
+       FileData    *fdata1 = *((FileData **) ptr1);
+       FileData    *fdata2 = *((FileData **) ptr2);
+       int          result;
+-      const char  *desc1, *desc2;
++      char        *desc1, *desc2;
+ 
+       if (file_data_is_dir (fdata1) != file_data_is_dir (fdata2)) {
+               if (file_data_is_dir (fdata1))
+@@ -996,6 +997,9 @@ sort_by_type (gconstpointer  ptr1,
+       desc2 = g_content_type_get_description (fdata2->content_type);
+ 
+       result = strcasecmp (desc1, desc2);
++      g_free (desc1);
++      g_free (desc2);
++
+       if (result == 0)
+               return sort_by_name (ptr1, ptr2);
+       else
+@@ -1560,7 +1564,7 @@ fr_window_populate_file_list (FrWindow  *window,
+                       char       *utf8_path;
+                       char       *s_size;
+                       char       *s_time;
+-                      const char *desc;
++                      char       *desc;
+ 
+                       utf8_path = g_filename_display_name (fdata->path);
+ 
+@@ -1583,6 +1587,7 @@ fr_window_populate_file_list (FrWindow  *window,
+                       g_free (utf8_path);
+                       g_free (s_size);
+                       g_free (s_time);
++                      g_free (desc);
+               }
+               g_free (utf8_name);
+               if (icon != NULL)
+@@ -2414,9 +2419,10 @@ fr_window_working_archive_cb (FrCommand  *command,
+                             FrWindow   *window)
+ {
+       g_free (window->priv->working_archive);
+-      window->priv->working_archive = NULL;
+       if (archive_filename != NULL)
+               window->priv->working_archive = g_strdup (archive_filename);
++      else
++              window->priv->working_archive = NULL;
+       progress_dialog_update_action_description (window);
+ 
+       return TRUE;
+@@ -2875,6 +2881,7 @@ fr_window_add_to_recent_list (FrWindow *window,
+               recent_data->app_exec = "engrampa";
+               gtk_recent_manager_add_full (gtk_recent_manager_get_default (), 
uri, recent_data);
+ 
++              g_free (recent_data->mime_type);
+               g_free (recent_data);
+       }
+       else
+-- 
+2.39.2
+
diff -Nru engrampa-1.26.0/debian/patches/0003_file-data-fix-memory-leak.patch 
engrampa-1.26.0/debian/patches/0003_file-data-fix-memory-leak.patch
--- engrampa-1.26.0/debian/patches/0003_file-data-fix-memory-leak.patch 
1970-01-01 01:00:00.000000000 +0100
+++ engrampa-1.26.0/debian/patches/0003_file-data-fix-memory-leak.patch 
2023-12-29 08:03:51.000000000 +0100
@@ -0,0 +1,55 @@
+From 073c06814e0dcbb7bbdcecb867fc8c15d3fdddfa Mon Sep 17 00:00:00 2001
+From: rbuj <robert....@gmail.com>
+Date: Fri, 22 Oct 2021 10:30:10 +0200
+Subject: [PATCH 3/5] file-data: fix memory leak
+
+Signed-off-by: Mike Gabriel <mike.gabr...@das-netzwerkteam.de>
+---
+ src/file-data.c      | 11 ++++++++---
+ src/fr-command-tar.c |  7 +++++--
+ 2 files changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/src/file-data.c b/src/file-data.c
+index 911a5e9..cc0832f 100644
+--- a/src/file-data.c
++++ b/src/file-data.c
+@@ -103,10 +103,15 @@ file_data_get_type (void)
+ void
+ file_data_update_content_type (FileData *fdata)
+ {
+-      if (fdata->dir)
++      if (fdata->dir) {
+               fdata->content_type = MIME_TYPE_DIRECTORY;
+-      else
+-              fdata->content_type = get_static_string (g_content_type_guess 
(fdata->full_path, NULL, 0, NULL));
++      } else {
++              char *content_type;
++
++              content_type = g_content_type_guess (fdata->full_path, NULL, 0, 
NULL);
++              fdata->content_type = get_static_string (content_type);
++              g_free (content_type);
++      }
+ }
+ 
+ 
+diff --git a/src/fr-command-tar.c b/src/fr-command-tar.c
+index 50aae1a..6f7943f 100644
+--- a/src/fr-command-tar.c
++++ b/src/fr-command-tar.c
+@@ -140,8 +140,11 @@ process_line (char     *line,
+       }
+       g_free (name);
+       name = g_filename_from_utf8 (fdata->original_path, -1, NULL, NULL, 
NULL);
+-      if (name)
+-              fdata->original_path = name;
++      if (name) {
++              fdata->original_path = g_strdup (name);
++              fdata->free_original_path = TRUE;
++      }
++      g_free (name);
+ 
+       if (fields[1] != NULL)
+               fdata->link = g_strdup (fields[1]);
+-- 
+2.39.2
+
diff -Nru 
engrampa-1.26.0/debian/patches/0004_Fix-archive-file-save-as-function.patch 
engrampa-1.26.0/debian/patches/0004_Fix-archive-file-save-as-function.patch
--- engrampa-1.26.0/debian/patches/0004_Fix-archive-file-save-as-function.patch 
1970-01-01 01:00:00.000000000 +0100
+++ engrampa-1.26.0/debian/patches/0004_Fix-archive-file-save-as-function.patch 
2023-12-29 08:03:51.000000000 +0100
@@ -0,0 +1,107 @@
+From a27a7a6de2d47f6d3ca558f6f980b03376ae5044 Mon Sep 17 00:00:00 2001
+From: zhuyaliang <15132211...@163.com>
+Date: Wed, 15 Mar 2023 10:57:07 +0800
+Subject: [PATCH 4/5] Fix archive file save as function
+
+Signed-off-by: Mike Gabriel <mike.gabr...@das-netzwerkteam.de>
+---
+ src/actions.c   | 20 ++++++++++++++++++--
+ src/dlg-new.c   |  2 ++
+ src/dlg-new.h   |  1 +
+ src/fr-window.c |  2 +-
+ 4 files changed, 22 insertions(+), 3 deletions(-)
+
+diff --git a/src/actions.c b/src/actions.c
+index b55cab1..08bf4e0 100644
+--- a/src/actions.c
++++ b/src/actions.c
+@@ -203,6 +203,22 @@ get_archive_filename_from_selector (DlgNewData *data)
+     }
+     g_object_unref (info);
+     g_object_unref (dir);
++    if ((data->original_file != NULL) && (g_file_equal (file, 
data->original_file))) {
++        GtkWidget *dialog;
++        dialog = _gtk_error_dialog_new (GTK_WINDOW (data->dialog),
++                        GTK_DIALOG_MODAL,
++                        NULL,
++                        _("Could not create the archive"),
++                        "%s",
++                        _("New name is the same as old one, please type other 
name."));
++        gtk_dialog_run (GTK_DIALOG (dialog));
++
++        gtk_widget_destroy (GTK_WIDGET (dialog));
++        g_object_unref (info);
++        g_object_unref (file);
++
++        return NULL;
++    }
+ 
+     /* if the user did not specify a valid extension use the filetype 
combobox current type
+      * or tar.gz if automatic is selected. */
+@@ -465,11 +481,11 @@ activate_action_save_as (GtkAction *action,
+ {
+     FrWindow   *window = callback_data;
+     DlgNewData *data;
++    GFile      *file = NULL;
+     char       *archive_name = NULL;
+ 
+     if (fr_window_get_archive_uri (window)) {
+         const char *uri;
+-        GFile      *file;
+         GFileInfo  *info;
+         GError     *err = NULL;
+ 
+@@ -487,10 +503,10 @@ activate_action_save_as (GtkAction *action,
+             archive_name = g_strdup (g_file_info_get_display_name (info));
+ 
+         g_object_unref (info);
+-        g_object_unref (file);
+     }
+ 
+     data = dlg_save_as (window, archive_name);
++    data->original_file = file;
+     g_signal_connect (G_OBJECT (data->dialog),
+               "response",
+               G_CALLBACK (save_file_response_cb),
+diff --git a/src/dlg-new.c b/src/dlg-new.c
+index 8b78561..2214574 100644
+--- a/src/dlg-new.c
++++ b/src/dlg-new.c
+@@ -42,6 +42,8 @@ static void
+ destroy_cb (GtkWidget  *widget,
+           DlgNewData *data)
+ {
++      if (data->original_file != NULL)
++              g_object_unref (data->original_file);
+       g_free (data);
+ }
+ 
+diff --git a/src/dlg-new.h b/src/dlg-new.h
+index f4e0424..92f9194 100644
+--- a/src/dlg-new.h
++++ b/src/dlg-new.h
+@@ -36,6 +36,7 @@ typedef struct {
+       gboolean    can_create_volumes;
+       GtkBuilder *builder;
+ 
++      GFile      *original_file;
+       GtkWidget  *dialog;
+       /*GtkWidget  *n_archive_type_combo_box;*/
+       GtkWidget  *n_other_options_expander;
+diff --git a/src/fr-window.c b/src/fr-window.c
+index b5b5cff..e098f54 100644
+--- a/src/fr-window.c
++++ b/src/fr-window.c
+@@ -6363,8 +6363,8 @@ fr_window_archive_save_as (FrWindow   *window,
+                                    NULL,
+                                    window->priv->convert_data.temp_dir,
+                                    NULL,
+-                                   TRUE,
+                                    FALSE,
++                                   TRUE,
+                                    FALSE,
+                                    window->priv->password);
+       fr_process_start (window->archive->process);
+-- 
+2.39.2
+
diff -Nru engrampa-1.26.0/debian/patches/0005_fr-process-fix-memory-leak.patch 
engrampa-1.26.0/debian/patches/0005_fr-process-fix-memory-leak.patch
--- engrampa-1.26.0/debian/patches/0005_fr-process-fix-memory-leak.patch        
1970-01-01 01:00:00.000000000 +0100
+++ engrampa-1.26.0/debian/patches/0005_fr-process-fix-memory-leak.patch        
2023-12-29 08:03:51.000000000 +0100
@@ -0,0 +1,92 @@
+From a74093d29170f1ce62038c43a1ba7449fb6030be Mon Sep 17 00:00:00 2001
+From: rbuj <robert....@gmail.com>
+Date: Sun, 30 Jan 2022 11:59:09 +0100
+Subject: [PATCH 5/5] fr-process: fix memory leak
+
+Signed-off-by: Mike Gabriel <mike.gabr...@das-netzwerkteam.de>
+---
+ src/fr-process.c | 35 +++++++++--------------------------
+ 1 file changed, 9 insertions(+), 26 deletions(-)
+
+diff --git a/src/fr-process.c b/src/fr-process.c
+index 892aaae..fa361e7 100644
+--- a/src/fr-process.c
++++ b/src/fr-process.c
+@@ -88,22 +88,16 @@ fr_command_info_new (void)
+ 
+ 
+ static void
+-fr_command_info_free (FrCommandInfo *info)
++fr_command_info_free (gpointer data)
+ {
++      FrCommandInfo *info = data;
++
+       if (info == NULL)
+               return;
+ 
+-      if (info->args != NULL) {
+-              g_list_free_full (info->args, g_free);
+-              info->args = NULL;
+-      }
+-
+-      if (info->dir != NULL) {
+-              g_free (info->dir);
+-              info->dir = NULL;
+-      }
+-
+-      g_free (info);
++      g_list_free_full (info->args, g_free);
++      g_free (info->dir);
++      g_clear_pointer (&info, g_free);
+ }
+ 
+ 
+@@ -304,7 +298,7 @@ fr_process_init (FrProcess *process)
+ 
+       process->term_on_stop = TRUE;
+ 
+-      process->priv->comm = g_ptr_array_new ();
++      process->priv->comm = g_ptr_array_new_with_free_func 
(fr_command_info_free);
+       process->priv->n_comm = -1;
+       process->priv->current_comm = -1;
+ 
+@@ -347,9 +341,8 @@ fr_process_finalize (GObject *object)
+       process = FR_PROCESS (object);
+ 
+       fr_process_stop_priv (process, FALSE);
+-      fr_process_clear (process);
+ 
+-      g_ptr_array_free (process->priv->comm, FALSE);
++      g_ptr_array_free (process->priv->comm, TRUE);
+ 
+       fr_channel_data_free (&process->out);
+       fr_channel_data_free (&process->err);
+@@ -397,9 +390,7 @@ fr_process_begin_command_at (FrProcess  *process,
+       process->priv->current_comm = index;
+ 
+       old_c_info = g_ptr_array_index (process->priv->comm, index);
+-
+-      if (old_c_info != NULL)
+-              fr_command_info_free (old_c_info);
++      fr_command_info_free (old_c_info);
+ 
+       info = fr_command_info_new ();
+       info->args = g_list_prepend (NULL, g_strdup (arg));
+@@ -592,14 +583,6 @@ fr_process_clear (FrProcess *process)
+ 
+       g_return_if_fail (process != NULL);
+ 
+-      for (i = 0; i <= process->priv->n_comm; i++) {
+-              FrCommandInfo *info;
+-
+-              info = g_ptr_array_index (process->priv->comm, i);
+-              fr_command_info_free (info);
+-              g_ptr_array_index (process->priv->comm, i) = NULL;
+-      }
+-
+       for (i = 0; i <= process->priv->n_comm; i++)
+               g_ptr_array_remove_index_fast (process->priv->comm, 0);
+ 
+-- 
+2.39.2
+
diff -Nru engrampa-1.26.0/debian/patches/series 
engrampa-1.26.0/debian/patches/series
--- engrampa-1.26.0/debian/patches/series       1970-01-01 01:00:00.000000000 
+0100
+++ engrampa-1.26.0/debian/patches/series       2023-12-29 08:12:05.000000000 
+0100
@@ -0,0 +1,5 @@
+0001_dlg-package-installer-fix-memory-leak.patch
+0002_fr-window-fix-memory-leak.patch
+0003_file-data-fix-memory-leak.patch
+0004_Fix-archive-file-save-as-function.patch
+0005_fr-process-fix-memory-leak.patch

Reply via email to