From 43e180c612cd62e1d52a92aa490018b0935516e8 Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Jun 29 2010 15:35:33 +0000 Subject: fix script-fu-ipv6 patch --- diff --git a/gimp-2.6.9-script-fu-ipv6.patch b/gimp-2.6.9-script-fu-ipv6.patch index e45e139..6386414 100644 --- a/gimp-2.6.9-script-fu-ipv6.patch +++ b/gimp-2.6.9-script-fu-ipv6.patch @@ -1,30 +1,7 @@ -From 1979c0b0e66db34e69863c89e4eb544c89e9d41a Mon Sep 17 00:00:00 2001 -From: Nils Philippsen -Date: Tue, 29 Jun 2010 16:06:45 +0200 -Subject: [PATCH] patch: script-fu-ipv6 - -Squashed commit of the following: - -commit e0ae4b85c33d4241e95594b0d9788dafb27132c6 -Author: Nils Philippsen -Date: Tue Jun 29 16:03:31 2010 +0200 - - Bug 623045 - script-fu: make server IPv6 aware - - use getnameinfo() instead of inet_ntoa() - use two sockets for IPv4, IPv6 - (manually cherry picked from commit 04538534fc581de0507ef2ec1148853ff1e96dbe) ---- - configure.in | 8 +- - plug-ins/script-fu/script-fu-server.c | 141 +++++++++++++++++++++++++------- - plug-ins/script-fu/servertest.py | 76 ++++++++++++------ - 3 files changed, 166 insertions(+), 59 deletions(-) - -diff --git a/configure.in b/configure.in -index 71f031d..a99cbe4 100644 ---- a/configure.in -+++ b/configure.in -@@ -602,14 +602,14 @@ AC_CHECK_FUNC(rint, AC_DEFINE(HAVE_RINT, 1, +diff -up gimp-2.6.9/configure.in.script-fu-ipv6 gimp-2.6.9/configure.in +--- gimp-2.6.9/configure.in.script-fu-ipv6 2010-06-21 21:20:20.000000000 +0200 ++++ gimp-2.6.9/configure.in 2010-06-29 17:28:24.153566227 +0200 +@@ -602,14 +602,14 @@ AC_CHECK_FUNC(rint, AC_DEFINE(HAVE_RINT, AC_DEFINE(HAVE_RINT)])]) @@ -43,11 +20,10 @@ index 71f031d..a99cbe4 100644 AC_CHECK_LIB(socket, socket) SOCKET_LIBS="$LIBS" -diff --git a/plug-ins/script-fu/script-fu-server.c b/plug-ins/script-fu/script-fu-server.c -index db1de13..c4776a2 100644 ---- a/plug-ins/script-fu/script-fu-server.c -+++ b/plug-ins/script-fu/script-fu-server.c -@@ -137,7 +137,8 @@ static void server_start (gint port, +diff -up gimp-2.6.9/plug-ins/script-fu/script-fu-server.c.script-fu-ipv6 gimp-2.6.9/plug-ins/script-fu/script-fu-server.c +--- gimp-2.6.9/plug-ins/script-fu/script-fu-server.c.script-fu-ipv6 2009-07-20 22:20:51.000000000 +0200 ++++ gimp-2.6.9/plug-ins/script-fu/script-fu-server.c 2010-06-29 17:28:24.154289648 +0200 +@@ -137,7 +137,8 @@ static void server_start (gin const gchar *logfile); static gboolean execute_command (SFCommand *cmd); static gint read_from_client (gint filedes); @@ -57,7 +33,7 @@ index db1de13..c4776a2 100644 static void server_log (const gchar *format, ...) G_GNUC_PRINTF (1, 2); static void server_quit (void); -@@ -151,7 +152,10 @@ static void print_socket_api_error (const gchar *api_name); +@@ -151,7 +152,10 @@ static void print_socket_api_error /* * Local variables */ @@ -166,19 +142,19 @@ index db1de13..c4776a2 100644 const gchar *logfile) { - const gchar *progress; +- +- /* First of all, create the socket and set it up to accept connections. */ +- /* This may fail if there's a server running on this port already. */ +- server_sock = make_socket (port); + struct addrinfo *ai, + *ai_curr; + struct addrinfo hints; + gint e, + sockno; + gchar *port_s; - -- /* First of all, create the socket and set it up to accept connections. */ -- /* This may fail if there's a server running on this port already. */ -- server_sock = make_socket (port); ++ + const gchar *progress; - -- if (listen (server_sock, 5) < 0) ++ + memset (&hints, 0, sizeof (hints)); + hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG; + hints.ai_socktype = SOCK_STREAM; @@ -186,7 +162,8 @@ index db1de13..c4776a2 100644 + port_s = g_strdup_printf ("%d", port); + e = getaddrinfo (NULL, port_s, &hints, &ai); + g_free (port_s); -+ + +- if (listen (server_sock, 5) < 0) + if (e != 0) { - print_socket_api_error ("listen"); @@ -264,7 +241,7 @@ index db1de13..c4776a2 100644 { print_socket_api_error ("bind"); gimp_quit (); -@@ -672,7 +746,12 @@ script_fu_server_shutdown_fd (gpointer key, +@@ -672,7 +746,12 @@ script_fu_server_shutdown_fd (gpointer k static void server_quit (void) { @@ -278,111 +255,3 @@ index db1de13..c4776a2 100644 if (clients) { -diff --git a/plug-ins/script-fu/servertest.py b/plug-ins/script-fu/servertest.py -index b636557..5fb673a 100644 ---- a/plug-ins/script-fu/servertest.py -+++ b/plug-ins/script-fu/servertest.py -@@ -2,38 +2,66 @@ - - import readline, socket, sys - --if len (sys.argv) == 1: -- HOST = 'localhost' -- PORT = 10008 --elif len (sys.argv) == 3: -- HOST = sys.argv[1] -- PORT = int (sys.argv[2]) --else: -- print >> sys.stderr, "Usage: %s " % sys.argv[0] -- print >> sys.stderr, " (if omitted connect to localhost, port 10008)" -- sys.exit () -+if len(sys.argv) < 1 or len(sys.argv) > 3: -+ print >>sys.stderr, "Usage: %s " % sys.argv[0] -+ print >>sys.stderr, " (if omitted connect to localhost, port 10008)" -+ sys.exit(1) - -+HOST = "localhost" -+PORT = 10008 - --sock = socket.socket (socket.AF_INET, socket.SOCK_STREAM) --sock.connect ((HOST, PORT)) -+try: -+ HOST = sys.argv[1] -+ try: -+ PORT = int(sys.argv[2]) -+ except IndexError: -+ pass -+except IndexError: -+ pass -+ -+addresses = socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket.SOCK_STREAM) -+ -+connected = False -+ -+for addr in addresses: -+ (family, socktype, proto, canonname, sockaddr) = addr -+ -+ numeric_addr = sockaddr[0] -+ -+ if canonname: -+ print "Trying %s ('%s')." % (numeric_addr, canonname) -+ else: -+ print "Trying %s." % numeric_addr -+ -+ try: -+ sock = socket.socket(family, socket.SOCK_STREAM) -+ sock.connect((HOST, PORT)) -+ connected = True -+ break -+ except: -+ pass -+ -+if not connected: -+ print "Failed." -+ sys.exit(1) - - try: -- cmd = raw_input ("Script-Fu-Remote - Testclient\n> ") -+ cmd = raw_input("Script-Fu-Remote - Testclient\n> ") - -- while len (cmd) > 0: -- sock.send ('G%c%c%s' % (len (cmd) / 256, len (cmd) % 256, cmd)) -+ while len(cmd) > 0: -+ sock.send('G%c%c%s' % (len(cmd) / 256, len(cmd) % 256, cmd)) - - data = "" -- while len (data) < 4: -- data += sock.recv (4 - len (data)) -+ while len(data) < 4: -+ data += sock.recv(4 - len(data)) - -- if len (data) >= 4: -+ if len(data) >= 4: - if data[0] == 'G': -- l = ord (data[2]) * 256 + ord (data[3]) -+ l = ord(data[2]) * 256 + ord(data[3]) - msg = "" -- while len (msg) < l: -- msg += sock.recv (l - len (msg)) -- if ord (data[1]): -+ while len(msg) < l: -+ msg += sock.recv(l - len(msg)) -+ if ord(data[1]): - print "(ERR):", msg - else: - print " (OK):", msg -@@ -41,9 +69,9 @@ try: - print "invalid magic: %s\n" % data - else: - print "short response: %s\n" % data -- cmd = raw_input ("> ") -+ cmd = raw_input("> ") - - except EOFError: - print - --sock.close -+sock.close() --- -1.7.0.1 -