[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RFC: gThumb upload for Lenny



Hello,
bug #420195, "gthumb: Drag and Drop from Folders Pane Causes Copying Loop", was
reported more than a year ago. Unfortunately, I had a look at it only very
recently, on Feb, 12. I underestimated it, leaving it at priority "normal",
while it's a "critical" bug -- sorry for having missed Lenny in a so clamorous
way :/.

The specific bug is as follows: if a user browses to a directory, gThumb shows
also ".." on top of subdirectories. The user then could drag ".." and drop it
in the main window. This will cause an infinite copying of directories, which
might reach filesystem's limits.

Example:

$ mkdir -p /tmp/example/
$ gthumb
[ browse to /tmp/example/, drag ".." and drop it into the right pane... you'll
end up with /tmp/example/tmp/example/tmp/... ]

I managed to make a patch (attached), and would also like to include a fix for
a missing include (attached as well) -- but I believe the latter could be
avoided too.

After an ACK from RM, I'll prepare an upload of gthumb 3:2.10.8-1~lenny1 for
proposed-updates, and report the debdiff here before effectively uploading.

Kindly,
David Paleino

-- 
 . ''`.  Debian maintainer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://snipr.com/qa_page
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
Author: David Paleino <d.paleino@gmail.com>
Reason: when dragging ".." from the left pane to the main widget (where thumbnails 
appear), the parent directory is infinitely copied in a loop. Example:

$ mkdir -p /tmp/example/
$ gthumb
[ go in /tmp/example/ and drag ".." into the main window ]
[ at this point, you'll end up with /tmp/example/tmp/example/tmp/example/... ]

See Debian bug #420195.
---
 src/gth-browser.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- gthumb.orig/src/gth-browser.c
+++ gthumb/src/gth-browser.c
@@ -3968,6 +3968,16 @@ image_list_drag_data_received  (GtkWidge
 		return;
 	}
 
+	// Fix infinite loop when dragging ../ into CWD
+	const gchar *dragged = (gchar*) data->data;
+	const gchar *current = (gchar*) priv->dir_list->path;
+	const gchar *parent = (gchar*) g_path_get_dirname(current);
+	if (strcmp(dragged, parent) == 0) {
+		g_print ("Cannot drag .. into the current folder\n");
+		return;
+	}
+	g_free(parent);
+
 	if (! ((data->length >= 0) && (data->format == 8))
 	    || (((context->action & GDK_ACTION_COPY) != GDK_ACTION_COPY)
 		&& ((context->action & GDK_ACTION_MOVE) != GDK_ACTION_MOVE))) {
---
 src/dlg-photo-importer.c |    4 ++++
 1 file changed, 4 insertions(+)

--- gthumb.orig/src/dlg-photo-importer.c
+++ gthumb/src/dlg-photo-importer.c
@@ -23,6 +23,10 @@
 
 #include <config.h>
 
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 #ifdef HAVE_LIBGPHOTO
 
 #include <string.h>

Attachment: signature.asc
Description: PGP signature


Reply to: