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

Bug#788612: jessie-pu: package gnome-terminal/3.14.1-1+deb8u1



Package: release.debian.org
Severity: normal
Tags: jessie
User: release.debian.org@packages.debian.org
Usertags: pu

Hi,

gnome-terminal 3.8 introduced an annoying regression compared to what
was shipped as 3.4 in wheezy. New tabs/terminals are always opened in
$HOME instead of cwd. The upstream fix for this issue unfortunately
does not work on Debian (see the patch header for more details)

The attached patch restores the functionality from 3.4 as fallback back.
It has been applied to unstable and is now in testing and I'd like to
see this fix make it into jessie as well.

Full debdiff is attached.

Cheers,
Michael

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.0.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Index: debian/changelog
===================================================================
--- debian/changelog	(Revision 45061)
+++ debian/changelog	(Arbeitskopie)
@@ -1,3 +1,13 @@
+gnome-terminal (3.14.1-1+deb8u1) jessie; urgency=medium
+
+  * Provide fallback for reading current directory if OSC 7 fails. In Debian
+    there is no mechanism (yet) to source scripts for non-login interactive
+    shells so we can't rely on /etc/profile.d/vte*.sh but instead fallback to
+    reading /proc to determine the working directory of the current tab.
+    (Closes: #706065)
+
+ -- Michael Biebl <biebl@debian.org>  Sat, 13 Jun 2015 12:48:09 +0200
+
 gnome-terminal (3.14.1-1) unstable; urgency=medium
 
   * New upstream release.
Index: debian/control
===================================================================
--- debian/control	(Revision 45061)
+++ debian/control	(Arbeitskopie)
@@ -6,7 +6,7 @@
 Section: gnome
 Priority: optional
 Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
-Uploaders: Andreas Henriksson <andreas@fatal.se>, Emilio Pozuelo Monfort <pochu@debian.org>, Sjoerd Simons <sjoerd@debian.org>
+Uploaders: Andreas Henriksson <andreas@fatal.se>, Emilio Pozuelo Monfort <pochu@debian.org>, Michael Biebl <biebl@debian.org>, Sjoerd Simons <sjoerd@debian.org>
 Standards-Version: 3.9.5
 Build-Depends: cdbs (>= 0.4.41),
                debhelper (>= 8),
Index: debian/patches/Provide-fallback-for-reading-current-directory-if-OS.patch
===================================================================
--- debian/patches/Provide-fallback-for-reading-current-directory-if-OS.patch	(Revision 0)
+++ debian/patches/Provide-fallback-for-reading-current-directory-if-OS.patch	(Arbeitskopie)
@@ -0,0 +1,99 @@
+From: Martin Pitt <martinpitt@gnome.org>
+Subject: [PATCH] Provide fallback for reading current directory if OSC 7 fails
+
+Bug: https://bugzilla.gnome.org/show_bug.cgi?id=697475
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=712628
+---
+ src/terminal-screen.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 66 insertions(+)
+
+Index: gnome-terminal-3.14.1/src/terminal-screen.c
+===================================================================
+--- gnome-terminal-3.14.1.orig/src/terminal-screen.c	2015-06-13 12:46:52.883120561 +0200
++++ gnome-terminal-3.14.1/src/terminal-screen.c	2015-06-13 12:46:52.879120497 +0200
+@@ -216,6 +216,63 @@
+ 
+ G_DEFINE_TYPE (TerminalScreen, terminal_screen, VTE_TYPE_TERMINAL)
+ 
++static char *
++cwd_of_pid (int pid)
++{
++  static const char patterns[][18] = {
++    "/proc/%d/cwd",         /* Linux */
++    "/proc/%d/path/cwd",    /* Solaris >= 10 */
++  };
++  guint i;
++
++  if (pid == -1)
++    return NULL;
++
++  /* Try to get the working directory using various OS-specific mechanisms */
++  for (i = 0; i < G_N_ELEMENTS (patterns); ++i)
++    {
++      char cwd_file[64];
++      char buf[PATH_MAX + 1];
++      int len;
++
++      /* disable "format not a string literal" error, we know what we are doing */
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
++      g_snprintf (cwd_file, sizeof (cwd_file), patterns[i], pid);
++#pragma GCC diagnostic pop
++      len = readlink (cwd_file, buf, sizeof (buf) - 1);
++
++      if (len > 0 && buf[0] == '/')
++        return g_strndup (buf, len);
++
++      /* If that didn't do it, try this hack */
++      if (len <= 0)
++        {
++          char *cwd, *working_dir = NULL;
++
++          cwd = g_get_current_dir ();
++          if (cwd != NULL)
++            {
++              /* On Solaris, readlink returns an empty string, but the
++               * link can be used as a directory, including as a target
++               * of chdir().
++               */
++              if (chdir (cwd_file) == 0)
++                {
++                  working_dir = g_get_current_dir ();
++                  (void) chdir (cwd);
++                }
++              g_free (cwd);
++            }
++
++          if (working_dir)
++            return working_dir;
++        }
++    }
++
++  return NULL;
++}
++
+ static void
+ free_tag_data (TagData *tagdata)
+ {
+@@ -1534,12 +1591,21 @@
+ char *
+ terminal_screen_get_current_dir (TerminalScreen *screen)
+ {
++  TerminalScreenPrivate *priv = screen->priv;
+   const char *uri;
+ 
+   uri = vte_terminal_get_current_directory_uri (VTE_TERMINAL (screen));
+   if (uri != NULL)
+     return g_filename_from_uri (uri, NULL, NULL);
+ 
++  if (priv->child_pid > 0) {
++    char *cwd = cwd_of_pid (priv->child_pid);
++    if (cwd != NULL) {
++      g_debug ("terminal_screen_get_current_dir: VTE current dir n/a, reading from /proc: %s", cwd);
++      return cwd;
++    }
++  }
++
+   if (screen->priv->initial_working_directory)
+     return g_strdup (screen->priv->initial_working_directory);
+ 
Index: debian/patches/series
===================================================================
--- debian/patches/series	(Revision 45061)
+++ debian/patches/series	(Arbeitskopie)
@@ -2,3 +2,4 @@
 01_onlyshowin.patch
 10_kfreebsd-f_dupfd_cloexec.patch
 Don-t-allow-the-theme-to-set-black-on-black.patch
+Provide-fallback-for-reading-current-directory-if-OS.patch

Reply to: