2007-05-20 Marcus Brinkmann <marcus@g10code.de>
authorMarcus Brinkmann <mb@g10code.com>
Sun, 20 May 2007 21:15:59 +0000 (21:15 +0000)
committerMarcus Brinkmann <mb@g10code.com>
Sun, 20 May 2007 21:15:59 +0000 (21:15 +0000)
* patches/glib-2.12.12/01-giowin32.patch,
patches/glib-2.12.12/02-gspawn-w32.patch,
patches/glib-2.12.12/03-gspawn-w32-fixup.patch: New files.
* Makefile.am (EXTRA_DIST): Add these new files.

ChangeLog
Makefile.am
patches/glib-2.12.12/01-giowin32.patch [new file with mode: 0755]
patches/glib-2.12.12/02-gspawn-w32.patch [new file with mode: 0755]
patches/glib-2.12.12/03-gspawn-w32-fixup.patch [new file with mode: 0755]

index 314d742..e3656d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2007-05-20  Marcus Brinkmann  <marcus@g10code.de>
 
+       * patches/glib-2.12.12/01-giowin32.patch,
+       patches/glib-2.12.12/02-gspawn-w32.patch,
+       patches/glib-2.12.12/03-gspawn-w32-fixup.patch: New files.
+       * Makefile.am (EXTRA_DIST): Add these new files.
+
        * src/gpgwrap.c (build_commandline): New function.
        (main): Quote argument vector.
 
index 660cf0c..6504ffa 100644 (file)
@@ -29,6 +29,9 @@ EXTRA_DIST = autogen.sh README.SVN \
         patches/glib-2.9.2-wk1/02-gspawn-w32.patch \
         patches/glib-2.9.2-wk1/03-gspawn-w32-fixup.patch \
         patches/glib-2.9.2-wk1/04-gspawn-w32-buffering.patch \
+        patches/glib-2.12.12/01-giowin32.patch \
+        patches/glib-2.12.12/02-gspawn-w32.patch \
+        patches/glib-2.12.12/03-gspawn-w32-fixup.patch \
        patches/sylpheed-claws-2.3.1/01-locale-dir.patch \
        patches/sylpheed-claws-2.3.1/02-fix-plugin-dir.patch \
        patches/sylpheed-claws-2.3.1/03-std-plugins.patch \
diff --git a/patches/glib-2.12.12/01-giowin32.patch b/patches/glib-2.12.12/01-giowin32.patch
new file mode 100755 (executable)
index 0000000..23b35b6
--- /dev/null
@@ -0,0 +1,48 @@
+#! /bin/sh
+patch -p1 -f $* < $0
+exit $?
+
+Fix a couple of buglets in the I/O channel implementation.
+
+(no changelog yet)
+
+diff -rup glib-2.12.12-old/glib/giowin32.c glib-2.12.12/glib/giowin32.c
+--- glib-2.12.12-old/glib/giowin32.c   2007-05-20 19:02:40.000000000 +0200
++++ glib-2.12.12/glib/giowin32.c       2007-05-20 19:02:40.000000000 +0200
+@@ -385,7 +385,7 @@
+ {
+   GIOWin32Channel *channel = parameter;
+   guchar *buffer;
+-  guint nbytes;
++  gint nbytes;
+   g_io_channel_ref ((GIOChannel *)channel);
+@@ -457,7 +457,7 @@
+       if (nbytes <= 0)
+       break;
+-
++ 
+       channel->wrp = (channel->wrp + nbytes) % BUFFER_SIZE;
+       if (channel->debug)
+       g_print ("read_thread %#x: rdp=%d, wrp=%d, setting data_avail\n",
+@@ -496,7 +496,7 @@
+ {
+   GIOWin32Channel *channel = parameter;
+   guchar *buffer;
+-  guint nbytes;
++  gint nbytes;
+   g_io_channel_ref ((GIOChannel *)channel);
+@@ -1975,7 +1975,7 @@
+       fd->fd = (gint) win32_channel->data_avail_event;
+-      if (win32_channel->thread_id == 0 && (condition & G_IO_IN))
++      if (win32_channel->thread_id == 0)
+       {
+         if (condition & G_IO_IN)
+           create_thread (win32_channel, condition, read_thread);
+
diff --git a/patches/glib-2.12.12/02-gspawn-w32.patch b/patches/glib-2.12.12/02-gspawn-w32.patch
new file mode 100755 (executable)
index 0000000..ef09310
--- /dev/null
@@ -0,0 +1,68 @@
+#! /bin/sh
+patch -p1 -f $* < $0
+exit $?
+
+Fix calling of the spawn helper for W32.
+
+2006-01-12  Werner Koch  <wk@g10code.com>
+
+       * glib/gspawn-win32.c (do_spawn_with_pipes): First try to load the
+       helper from the module's directory.
+
+
+diff -upr glib-2.9.2-wk1/glib/gspawn-win32.c glib/glib/gspawn-win32.c
+--- glib-2.9.2-wk1/glib/gspawn-win32.c 2005-09-07 12:10:49.000000000 +0200
++++ glib/glib/gspawn-win32.c   2006-01-13 09:14:48.000000000 +0100
+@@ -632,6 +632,7 @@ do_spawn_with_pipes (gint               
+   GError *conv_error = NULL;
+   gint conv_error_index;
+   gchar *helper_process;
++  gchar *helper_process_buf = NULL;
+   CONSOLE_CURSOR_INFO cursor_info;
+   
+   SETUP_DEBUG();
+@@ -678,6 +679,23 @@ do_spawn_with_pipes (gint               
+     helper_process = HELPER_PROCESS "-console.exe";
+   else
+     helper_process = HELPER_PROCESS ".exe";
++
++  /* We better check whether the helper process is available in the
++     same directory as this library.  Only if this is not the case we
++     try it without a path and hope that it can be found n PATH. */
++  helper_process_buf = g_malloc (MAX_PATH + 50 + strlen (helper_process));
++  if ( GetModuleFileNameA (0, helper_process_buf, MAX_PATH + 50) )
++    {
++      char *p = strrchr (helper_process_buf, '\\');
++      if (!p)
++        p = helper_process_buf;
++      else
++        p++;
++      strcpy (p, helper_process);
++      if (!g_access (helper_process_buf, X_OK))
++        helper_process = helper_process_buf; /* Yes, use that one. */
++    }
++
+   new_argv[0] = helper_process;
+   _g_sprintf (args[ARG_CHILD_ERR_REPORT], "%d", child_err_report_pipe[1]);
+   new_argv[ARG_CHILD_ERR_REPORT] = args[ARG_CHILD_ERR_REPORT];
+@@ -944,6 +962,7 @@ do_spawn_with_pipes (gint               
+   if (rc != -1)
+     CloseHandle ((HANDLE) rc);
+   
++  g_free (helper_process_buf);
+   return TRUE;
+  cleanup_and_fail:
+@@ -965,6 +984,7 @@ do_spawn_with_pipes (gint               
+     close (stderr_pipe[0]);
+   if (stderr_pipe[1] != -1)
+     close (stderr_pipe[1]);
++  g_free (helper_process_buf);
+   return FALSE;
+ }
+
+
+
+
+
diff --git a/patches/glib-2.12.12/03-gspawn-w32-fixup.patch b/patches/glib-2.12.12/03-gspawn-w32-fixup.patch
new file mode 100755 (executable)
index 0000000..2445974
--- /dev/null
@@ -0,0 +1,65 @@
+#! /bin/sh
+patch -p1 -f $* < $0
+exit $?
+
+This patch is needed to complete 02-gspawn-w32.patch by Werner: When
+the complete path is used, it may contain spaces, and thus it needs to
+be quoted.
+
+2006-05-29  Marcus Brinkmann  <marcus@g10code.com>
+
+       * glib/gspawn-win32.c (do_spawn_with_pipes): Protect the first
+       argument by quotes.
+
+diff -ru glib-2.9.2-wk1-orig/glib/gspawn-win32.c glib-2.9.2-wk1/glib/gspawn-win32.c
+--- glib-2.9.2-wk1-orig/glib/gspawn-win32.c    2006-05-29 00:12:10.000000000 +0200
++++ glib-2.9.2-wk1/glib/gspawn-win32.c 2006-05-29 00:13:16.000000000 +0200
+@@ -696,7 +696,7 @@
+         helper_process = helper_process_buf; /* Yes, use that one. */
+     }
+-  new_argv[0] = helper_process;
++  new_argv[0] = protect_argv_string (helper_process);
+   _g_sprintf (args[ARG_CHILD_ERR_REPORT], "%d", child_err_report_pipe[1]);
+   new_argv[ARG_CHILD_ERR_REPORT] = args[ARG_CHILD_ERR_REPORT];
+   
+@@ -800,6 +800,7 @@
+         g_error_free (conv_error);
+         g_strfreev (protected_argv);
+         g_free (new_argv[ARG_WORKING_DIRECTORY]);
++        g_free (new_argv[0]);
+         g_free (new_argv);
+         g_free (whelper);
+         
+@@ -814,6 +815,7 @@
+         g_error_free (conv_error);
+         g_strfreev (protected_argv);
+         g_free (new_argv[ARG_WORKING_DIRECTORY]);
++        g_free (new_argv[0]);
+         g_free (new_argv);
+         g_free (whelper);
+         g_strfreev ((gchar **) wargv);
+@@ -855,6 +857,7 @@
+         g_error_free (conv_error);
+         g_strfreev (protected_argv);
+         g_free (new_argv[ARG_WORKING_DIRECTORY]);
++        g_free (new_argv[0]);
+         g_free (new_argv);
+         
+         return FALSE;
+@@ -868,6 +871,7 @@
+         g_error_free (conv_error);
+         g_strfreev (protected_argv);
+         g_free (new_argv[ARG_WORKING_DIRECTORY]);
++        g_free (new_argv[0]);
+         g_free (new_argv);
+         g_strfreev (cpargv);
+         
+@@ -899,6 +903,7 @@
+   g_strfreev (protected_argv);
+   g_free (new_argv[ARG_WORKING_DIRECTORY]);
++  g_free (new_argv[0]);
+   g_free (new_argv);
+   /* Check if gspawn-win32-helper couldn't be run */