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

Bug#596122: unblock: gvfs/1.6.3-2



Le mercredi 08 septembre 2010 à 19:56 +0100, Adam D. Barratt a écrit : 
> block 596122 by 590274
> thanks
> 
> On Wed, 2010-09-08 at 20:32 +0200, Josselin Mouette wrote:
> > please unblock gvfs for squeeze, it is only a trivial RC bug fix.
> > 
> > gvfs (1.6.3-2) unstable; urgency=low
> >  .
> >    * Depend on fuse-utils 2.8.4. Closes: #585648.
> 
> While the gvfs fix is indeed trivial, fuse 2.8.4-1 is unable to migrate
> due to a FTBFS on kfreebsd-* (#590274); marking this bug as blocked by
> that.

So, the situation has evolved.

First, fuse has been fixed in the meantime by a NMU. It’s just needing
an unblock.

Second, gvfs has been updated again. This update is appropriate for
squeeze, but the timing is unfortunate. It is solely a new upstream
release.

Major changes in 1.6.4 
======================
* Lots of translation updates
* afc: Add support for photo thumbnails on iOS4
* daemons: Move GConf initialization from backend constructor
* sftp: Use poll() to cope with openssh-5.6 changes

The OpenSSH change is not necessary per se since we ship 5.5, but the
GConf one fixes a deadlock, and iOS4 support really looks like a good
idea.

Non-translation changes attached.

Cheers,
-- 
 .''`.      Josselin Mouette
: :' :
`. `'  “If you behave this way because you are blackmailed by someone,
  `-    […] I will see what I can do for you.”  -- Jörg Schilling
--- gvfs-1.6.3/daemon/gvfsbackendafc.c	2010-07-12 15:22:38.000000000 +0000
+++ gvfs-1.6.4/daemon/gvfsbackendafc.c	2010-09-27 14:51:51.000000000 +0000
@@ -43,6 +43,14 @@
 #define AFC_E_INVALID_ARG AFC_E_INVALID_ARGUMENT
 #endif /* !AFC_E_INVALID_ARG */
 
+typedef enum {
+  IOS_UNKNOWN = 0,
+  IOS1,
+  IOS2,
+  IOS3,
+  IOS4
+} HostOSVersion;
+
 struct _GVfsBackendAfc {
   GVfsBackend backend;
 
@@ -50,6 +58,7 @@
   char *service;
   char *model;
   gboolean connected;
+  HostOSVersion version;
 
   idevice_t dev;
   afc_client_t afc_cli;
@@ -391,6 +400,42 @@
       g_vfs_backend_set_icon_name (G_VFS_BACKEND(self), "phone-apple-iphone");
     }
 
+  /* Get the major OS version */
+  value = NULL;
+  self->version = IOS_UNKNOWN;
+  if (G_LIKELY(g_vfs_backend_lockdownd_check (lockdownd_get_value (lockdown_cli, NULL, "ProductVersion", &value), G_VFS_JOB(job)) == 0))
+    {
+      if (plist_get_node_type(value) == PLIST_STRING)
+        {
+          char *version_string = NULL;
+
+          plist_get_string_val(value, &version_string);
+          if (version_string)
+            {
+              /* parse version */
+              int maj = 0;
+              int min = 0;
+              int rev = 0;
+
+              sscanf(version_string, "%d.%d.%d", &maj, &min, &rev);
+              free(version_string);
+
+              switch (maj)
+                {
+                case 2:
+                  self->version = IOS2;
+                  break;
+                case 3:
+                  self->version = IOS3;
+                  break;
+                case 4:
+                  self->version = IOS4;
+                  break;
+                }
+            }
+        }
+    }
+
   lockdownd_client_free (lockdown_cli);
   lockdown_cli = NULL;
 
@@ -1026,33 +1071,98 @@
       strlen (basename) > 4 &&
       basename[strlen(basename) - 4] == '.')
     {
-      char *thumb_uri, *thumb_base, *thumb_path;
-      char *parent, *ptr, *no_suffix;
+      char *thumb_uri, *thumb_path;
+      char *no_suffix;
       char **thumb_afcinfo;
       GFile *thumb_file;
+      const char *suffix;
 
       GMountSpec *mount_spec;
       const char *port;
 
-      /* Parent directory */
-      ptr = strrchr (path, '/');
-      if (ptr == NULL)
-        return;
-      parent = g_strndup (path, ptr - path);
+      /* Handle thumbnails for movies as well */
+      if (g_str_has_suffix (path, ".MOV"))
+        suffix = "JPG";
+      else
+        suffix = "THM";
 
-      /* Basename with suffix replaced */
-      no_suffix = g_strndup (basename, strlen (basename) - 3);
-      thumb_base = g_strdup_printf ("%s%s", no_suffix, "THM");
-      g_free (no_suffix);
+      if (self->version == IOS2)
+        {
+          /* The thumbnails are side-by-side with the
+           * THM files in iOS2 */
 
-      /* Full thumbnail path */
-      thumb_path = g_build_filename (parent, ".MISC", thumb_base, NULL);
+          /* Remove the suffix */
+          no_suffix = g_strndup (path, strlen (path) - 3);
+          /* Replace with THM */
+          thumb_path = g_strdup_printf ("%s%s", no_suffix, suffix);
+          g_free (no_suffix);
+        }
+      else if (self->version == IOS3)
+        {
+          char *parent, *ptr;
+          char *thumb_base;
 
-      g_free (parent);
-      g_free (thumb_base);
+          /* The thumbnails are in the .MISC sub-directory, relative to the
+           * image itself, so:
+           * afc://xxx/DCIM/100APPLE/IMG_0001.JPG
+           * =>
+           * afc://xxx/DCIM/100APPLE/.MISC/IMG_0001.THM
+           */
+
+          /* Parent directory */
+          ptr = strrchr (path, '/');
+          if (ptr == NULL)
+                return;
+          parent = g_strndup (path, ptr - path);
+
+          /* Basename with suffix replaced */
+          no_suffix = g_strndup (basename, strlen (basename) - 3);
+          thumb_base = g_strdup_printf ("%s%s", no_suffix, suffix);
+          g_free (no_suffix);
+
+          /* Full thumbnail path */
+          thumb_path = g_build_filename (parent, ".MISC", thumb_base, NULL);
+
+          g_free (parent);
+          g_free (thumb_base);
+        }
+      else if (self->version == IOS4)
+        {
+          char **components;
+
+          /* The thumbnails are in the PhotoData/ so:
+           * afc://xxx/DCIM/100APPLE/IMG_0001.JPG
+           * =>
+           * afc://xxx/PhotoData/100APPLE/IMG_0001.THM
+           */
+
+          /* Replace the JPG by THM */
+          no_suffix = g_strndup (path, strlen (path) - 3);
+          thumb_path = g_strdup_printf ("%s%s", no_suffix, suffix);
+          g_free (no_suffix);
+
+          /* Replace DCIM with PhotoData */
+          components = g_strsplit (thumb_path, "/", -1);
+          g_free (thumb_path);
+          for (i = 0; components[i] != NULL; i++)
+            {
+              if (g_str_equal (components[i], "DCIM"))
+                {
+                  g_free (components[i]);
+                  components[i] = g_strdup ("PhotoData");
+                }
+            }
+          thumb_path = g_strjoinv ("/", components);
+          g_strfreev (components);
+        }
+      else
+        {
+          thumb_path = NULL;
+        }
 
       thumb_afcinfo = NULL;
-      if (afc_get_file_info (self->afc_cli, thumb_path, &thumb_afcinfo) != 0)
+      if (thumb_path == NULL ||
+          afc_get_file_info (self->afc_cli, thumb_path, &thumb_afcinfo) != 0)
         {
           g_strfreev (thumb_afcinfo);
           g_free (thumb_path);
@@ -1064,6 +1174,7 @@
       mount_spec = g_vfs_backend_get_mount_spec (G_VFS_BACKEND (self));
       port = g_mount_spec_get (mount_spec, "port");
       thumb_uri = g_strdup_printf ("afc://%s%s%s", self->uuid, port ? port : "", thumb_path);
+      g_free (thumb_path);
       thumb_file = g_file_new_for_uri (thumb_uri);
       g_free (thumb_uri);
 
--- gvfs-1.6.3/daemon/gvfsbackendsftp.c	2010-07-12 15:22:38.000000000 +0000
+++ gvfs-1.6.4/daemon/gvfsbackendsftp.c	2010-09-27 14:52:28.000000000 +0000
@@ -24,6 +24,7 @@
 #include <config.h>
 
 #include <stdlib.h>
+#include <sys/poll.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>
@@ -837,10 +838,9 @@
   GVfsBackendSftp *op_backend = G_VFS_BACKEND_SFTP (backend);
   GInputStream *prompt_stream;
   GOutputStream *reply_stream;
-  fd_set ifds;
-  struct timeval tv;
   int ret;
   int prompt_fd;
+  struct pollfd fds[2];
   char buffer[1024];
   gsize len;
   gboolean aborted = FALSE;
@@ -864,14 +864,12 @@
   ret_val = TRUE;
   while (1)
     {
-      FD_ZERO (&ifds);
-      FD_SET (stdout_fd, &ifds);
-      FD_SET (prompt_fd, &ifds);
-      
-      tv.tv_sec = SFTP_READ_TIMEOUT;
-      tv.tv_usec = 0;
+      fds[0].fd = stdout_fd;
+      fds[0].events = POLLIN;
+      fds[1].fd = prompt_fd;
+      fds[1].events = POLLIN;
       
-      ret = select (MAX (stdout_fd, prompt_fd)+1, &ifds, NULL, NULL, &tv);
+      ret = poll(fds, 2, SFTP_READ_TIMEOUT);
       
       if (ret <= 0)
         {
@@ -882,11 +880,11 @@
           break;
         }
       
-      if (FD_ISSET (stdout_fd, &ifds))
+      if (fds[0].revents)
         break; /* Got reply to initial INIT request */
       
-      g_assert (FD_ISSET (prompt_fd, &ifds));
-      
+      if (!(fds[1].revents & POLLIN))
+        continue;
       
       len = g_input_stream_read (prompt_stream,
                                  buffer, sizeof (buffer) - 1,
@@ -955,16 +953,18 @@
               g_free (new_password);
               
               if (op_backend->user_specified)
-                /* Translators: the first %s is the username, the second the host name */
                 if (strcmp (authtype, "publickey") == 0)
+                  /* Translators: the first %s is the username, the second the host name */
                   prompt = g_strdup_printf (_("Enter passphrase for key for ssh as %s on %s"), op_backend->user, op_backend->host);
                 else
+                  /* Translators: the first %s is the username, the second the host name */
                   prompt = g_strdup_printf (_("Enter password for ssh as %s on %s"), op_backend->user, op_backend->host);
               else
-                /* translators: %s here is the hostname */
                 if (strcmp (authtype, "publickey") == 0)
+                  /* Translators: %s is the hostname */
                   prompt = g_strdup_printf (_("Enter passphrase for key for ssh on %s"), op_backend->host);
                 else
+                  /* Translators: %s is the hostname */
                   prompt = g_strdup_printf (_("Enter password for ssh on %s"), op_backend->host);
 
               if (!g_mount_source_ask_password (mount_source,
--- gvfs-1.6.3/daemon/gvfsbackendsmbbrowse.c	2010-02-11 06:32:21.000000000 +0000
+++ gvfs-1.6.4/daemon/gvfsbackendsmbbrowse.c	2010-09-27 14:51:51.000000000 +0000
@@ -247,11 +247,35 @@
 static void
 g_vfs_backend_smb_browse_init (GVfsBackendSmbBrowse *backend)
 {
+#ifdef HAVE_GCONF
+  GConfClient *gclient;
+#endif
+
   backend->entries_lock = g_mutex_new ();
   backend->update_cache_lock = g_mutex_new ();
 
   if (mount_tracker == NULL)
     mount_tracker = g_mount_tracker_new (NULL);
+
+#ifdef HAVE_GCONF
+  gclient = gconf_client_get_default ();
+  if (gclient)
+    {
+      char *workgroup;
+
+      workgroup = gconf_client_get_string (gclient,
+					   PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL);
+
+      if (workgroup && workgroup[0])
+	default_workgroup = workgroup;
+      else
+	g_free (workgroup);
+
+      g_object_unref (gclient);
+    }
+#endif
+
+  DEBUG ("g_vfs_backend_smb_browse_init: default workgroup = '%s'\n", default_workgroup ? default_workgroup : "NULL");
 }
 
 /**
@@ -1456,9 +1480,6 @@
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GVfsBackendClass *backend_class = G_VFS_BACKEND_CLASS (klass);
-#ifdef HAVE_GCONF
-  GConfClient *gclient;
-#endif
   
   gobject_class->finalize = g_vfs_backend_smb_browse_finalize;
 
@@ -1475,26 +1496,6 @@
   backend_class->try_query_info = try_query_info;
   backend_class->enumerate = do_enumerate;
   backend_class->try_enumerate = try_enumerate;
-
-#ifdef HAVE_GCONF
-  gclient = gconf_client_get_default ();
-  if (gclient)
-    {
-      char *workgroup;
-      
-      workgroup = gconf_client_get_string (gclient, 
-					   PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL);
-
-      if (workgroup && workgroup[0])
-	default_workgroup = workgroup;
-      else
-	g_free (workgroup);
-      
-      g_object_unref (gclient);
-    }
-#endif
-
-  DEBUG ("g_vfs_backend_smb_browse_class_init - default workgroup = '%s'\n", default_workgroup ? default_workgroup : "NULL");
 }
 
 void
--- gvfs-1.6.3/daemon/gvfsbackendsmb.c	2010-02-11 06:32:25.000000000 +0000
+++ gvfs-1.6.4/daemon/gvfsbackendsmb.c	2010-09-27 14:51:51.000000000 +0000
@@ -121,6 +121,27 @@
 static void
 g_vfs_backend_smb_init (GVfsBackendSmb *backend)
 {
+#ifdef HAVE_GCONF
+  GConfClient *gclient;
+#endif
+
+#ifdef HAVE_GCONF
+  gclient = gconf_client_get_default ();
+  if (gclient)
+    {
+      char *workgroup;
+
+      workgroup = gconf_client_get_string (gclient,
+					   PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL);
+
+      if (workgroup && workgroup[0])
+	default_workgroup = workgroup;
+      else
+	g_free (workgroup);
+
+      g_object_unref (gclient);
+    }
+#endif
 }
 
 /**
@@ -2109,9 +2130,6 @@
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GVfsBackendClass *backend_class = G_VFS_BACKEND_CLASS (klass);
-#ifdef HAVE_GCONF
-  GConfClient *gclient;
-#endif
   
   gobject_class->finalize = g_vfs_backend_smb_finalize;
 
@@ -2138,25 +2156,6 @@
   backend_class->move = do_move;
   backend_class->try_query_settable_attributes = try_query_settable_attributes;
   backend_class->set_attribute = do_set_attribute;
-
-#ifdef HAVE_GCONF
-  gclient = gconf_client_get_default ();
-  if (gclient)
-    {
-      char *workgroup;
-      
-      workgroup = gconf_client_get_string (gclient, 
-					   PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL);
-
-      if (workgroup && workgroup[0])
-	default_workgroup = workgroup;
-      else
-	g_free (workgroup);
-      
-      g_object_unref (gclient);
-    }
-#endif
-
 }
 
 void

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: