Debian Bug report logs - #501133
please add patch to allow keeping fds open

version graph

Package: vte; Maintainer for vte is Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>;

Reported by: Thomas Viehmann <tv@beamnet.de>

Date: Sat, 4 Oct 2008 14:27:02 UTC

Severity: important

Found in version 1:0.16.14-3

Done: Thomas Viehmann <tv@beamnet.de>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, 493353@bugs.debian.org, gpastore@debian.org (Guilherme de S. Pastore):
Bug#501133; Package vte. (Sat, 04 Oct 2008 14:27:06 GMT) (full text, mbox, link).


Acknowledgement sent to Thomas Viehmann <tv@beamnet.de>:
New Bug report received and forwarded. Copy sent to 493353@bugs.debian.org, gpastore@debian.org (Guilherme de S. Pastore). (Sat, 04 Oct 2008 14:27:06 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Thomas Viehmann <tv@beamnet.de>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: please add patch to allow keeping fds open
Date: Sat, 04 Oct 2008 15:50:15 +0200
[Message part 1 (text/plain, inline)]
Package: vte
Version: 1:0.16.14-3
Severity: important
X-Debbugs-CC: 493353@bugs.debian.org

Hi Loic, Sebastian, Gnome Maintainers,

as witnessed by #493353, the GTK frontend to gdebi is completely broken
because it relies on a patch to vtk that provides a way to keep dpkg's
status-fd open. The patch looks fairly sane to me.
In terms of the lenny release, we seem to have three options
1) patch vtk as attached,
2) remove gdebi-gtk (or gdebi),
3) work around the problem (e.g. open a named pipe and invoke a dpkg
   wrapper that proxies that to the dpkg status-fd).

At this point, the easiest path seems to be 1), with the main argument
against it being that upstream 0.17 does not seem to have incorporated
the patch.

Opinions? I'd be happy to actually do the upload, but I would prefer an
explicit OK for it, either here or on IRC.

Kind regards

T.
-- 
Thomas Viehmann, http://thomas.viehmann.net/
[vte-keep-fds.diff (text/x-patch, inline)]
diff -u vte-0.16.14/debian/changelog vte-0.16.14/debian/changelog
--- vte-0.16.14/debian/changelog
+++ vte-0.16.14/debian/changelog
@@ -1,3 +1,10 @@
+vte (1:0.16.14-3.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Add patch from Ubuntu to allow children to keep fds open.
+
+ -- Thomas Viehmann <tv@beamnet.de>  Sat, 04 Oct 2008 15:23:04 +0200
+
 vte (1:0.16.14-3) unstable; urgency=low
 
   * Fix 1:0.16.14-2 changelog entry.
only in patch2:
unchanged:
--- vte-0.16.14.orig/debian/patches/91_keep_fds.patch
+++ vte-0.16.14/debian/patches/91_keep_fds.patch
@@ -0,0 +1,110 @@
+diff -Nur vte-0.16.0/src/pty.c vte-0.16.0.new/src/pty.c
+--- vte-0.16.0/src/pty.c	2007-02-26 22:05:14.000000000 +0100
++++ vte-0.16.0.new/src/pty.c	2007-03-16 10:15:20.000000000 +0100
+@@ -160,7 +160,27 @@
+ 		const char *name;
+ 		int fd;
+ 	} tty;
++	int keep_fd;
+ };
++
++static int
++_vte_pty_keep_fd(char **env_add)
++{
++   int i, res = -1;
++   if(env_add == NULL)
++      return res;
++
++   const gchar *needle="VTE_PTY_KEEP_FD=";
++   for(i=0; env_add[i] != NULL; i++) {
++      gchar *s = strstr(env_add[i],needle);
++      if(s != NULL) {
++	 res = atoi(&s[strlen(needle)]);
++	 break;
++      }
++   }
++   return res;
++}
++
+ static void
+ vte_pty_child_setup (gpointer arg)
+ {
+@@ -185,7 +205,6 @@
+ 			"Setting up child pty: name = %s, fd = %d\n",
+ 				tty ? tty : "(none)", fd);
+ 
+-
+ 	/* Start a new session and become process-group leader. */
+ #if defined(HAVE_SETSID) && defined(HAVE_SETPGID)
+ 	_vte_debug_print (VTE_DEBUG_PTY, "Starting new session\n");
+@@ -253,6 +272,20 @@
+ 		close(fd);
+ 	}
+ 
++	int i;
++	int keep_fd = data->keep_fd;
++	if(keep_fd > 0) {
++	   /* Close most descriptors. */
++	   for (i = 0; i < sysconf(_SC_OPEN_MAX); i++) {
++	      if (i != keep_fd &&
++		  i != fd && 
++		  i != STDOUT_FILENO && 
++		  i != STDIN_FILENO && 
++		  i != STDERR_FILENO) {
++		 close(i);
++	      }
++	   }
++	}
+ 
+ 	/* Reset our signals -- our parent may have done any number of
+ 	 * weird things to them. */
+@@ -345,13 +378,16 @@
+ 			g_printerr ("    directory: %s\n",
+ 					directory ? directory : "(none)");
+ 		}
+-
++ 		GSpawnFlags flags = (G_SPAWN_CHILD_INHERITS_STDIN |
++  				     G_SPAWN_FILE_AND_ARGV_ZERO |
++  				     G_SPAWN_SEARCH_PATH |
++  				     G_SPAWN_DO_NOT_REAP_CHILD);
++		if(argv)
++		   flags |= G_SPAWN_FILE_AND_ARGV_ZERO;
++  		if (data->keep_fd > 0)
++  		   flags |= G_SPAWN_LEAVE_DESCRIPTORS_OPEN;
+ 		ret = g_spawn_async_with_pipes (directory,
+-				arg2, envp2,
+-				G_SPAWN_CHILD_INHERITS_STDIN |
+-				G_SPAWN_SEARCH_PATH |
+-				G_SPAWN_DO_NOT_REAP_CHILD |
+-				(argv ? G_SPAWN_FILE_AND_ARGV_ZERO : 0),
++				arg2, envp2, flags,
+ 				vte_pty_child_setup, data,
+ 				pid,
+ 				NULL, NULL, NULL,
+@@ -407,6 +443,10 @@
+ 	return ret;
+ }
+ 
++
++
++
++
+ /* Open the named PTY slave, fork off a child (storing its PID in child),
+  * and exec the named command in its own session as a process group leader */
+ static gboolean
+@@ -419,6 +459,7 @@
+ 
+ 	data.mode = TTY_OPEN_BY_NAME;
+ 	data.tty.name = path;
++	data.keep_fd = _vte_pty_keep_fd(envp);
+ 
+ 	if (!_vte_pty_run_on_pty(&data,
+ 			command, argv, envp, directory,
+@@ -443,6 +484,7 @@
+ 
+ 	data.mode = TTY_OPEN_BY_FD;
+ 	data.tty.fd = fd;
++	data.keep_fd = _vte_pty_keep_fd(envp);
+ 
+ 	if (!_vte_pty_run_on_pty(&data,
+ 				command, argv, envp, directory,

Reply sent to Thomas Viehmann <tv@beamnet.de>:
You have taken responsibility. (Sat, 04 Oct 2008 14:42:04 GMT) (full text, mbox, link).


Notification sent to Thomas Viehmann <tv@beamnet.de>:
Bug acknowledged by developer. (Sat, 04 Oct 2008 14:42:04 GMT) (full text, mbox, link).


Message #10 received at 501133-done@bugs.debian.org (full text, mbox, reply):

From: Thomas Viehmann <tv@beamnet.de>
To: 501133-done@bugs.debian.org
Subject: on a second thought...
Date: Sat, 04 Oct 2008 16:37:34 +0200
... fixing gdebi to not rely on funny stuff seems the better solution.
In particular, it avoids a versioned dependency of gdebi on libvteX.

Kind regards

T.
-- 
Thomas Viehmann, http://thomas.viehmann.net/




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sun, 02 Nov 2008 07:26:34 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Fri Jan 12 03:09:00 2018; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.