[gnome-terminal/gnome-3-38] Revert "screen: Use clean env when creating new tab"



commit 16bd9f6a4181d37af2769e7ca5a1f9a1211cfaac
Author: Christian Persch <chpe src gnome org>
Date:   Thu Sep 17 17:10:47 2020 +0200

    Revert "screen: Use clean env when creating new tab"
    
    The patch is correct, but it exposes a deficiency in the desktop
    environment in that the WM/shell's environment contains necessary
    env vars (e.g. ssh-agent variables) that are missing from the
    systemd --user / d-bus activation environment.  The desktop will
    need to update the activation environment, but until that is done,
    reverting the patch will revert gnome-terminal to the previous
    behaviour of effectively using the environment of the client
    of the first terminal created for all new terminals opened via
    new terminal/tab/window.
    
    This reverts commit 9bb94e3aab84ecc4e7733d0ee001ee50256bd273.
    
    https://gitlab.gnome.org/GNOME/gnome-terminal/-/issues/253
    (cherry picked from commit 57ea15c4bdf15247f1d403aa24fb18efe23cd8a7)

 src/terminal-screen.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index 844b563c..0c4ee503 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -264,7 +264,8 @@ exec_data_new (void)
 }
 
 static ExecData *
-exec_data_clone (ExecData *data)
+exec_data_clone (ExecData *data,
+                 gboolean preserve_argv)
 {
   if (data == NULL)
     return NULL;
@@ -274,7 +275,8 @@ exec_data_clone (ExecData *data)
   clone->cwd = g_strdup (data->cwd);
 
   /* If FDs were passed, cannot repeat argv. Return data only for env and cwd */
-  if (data->fd_list != NULL) {
+  if (!preserve_argv ||
+      data->fd_list != NULL) {
     clone->as_shell = TRUE;
     return clone;
   }
@@ -846,6 +848,7 @@ terminal_screen_reexec_from_screen (TerminalScreen *screen,
 
   g_return_val_if_fail (TERMINAL_IS_SCREEN (parent_screen), FALSE);
 
+  terminal_unref_exec_data ExecData* data = exec_data_clone (parent_screen->priv->exec_data, FALSE);
   gs_free char* cwd = terminal_screen_get_current_dir (parent_screen);
 
   _terminal_debug_print (TERMINAL_DEBUG_PROCESSES,
@@ -855,7 +858,7 @@ terminal_screen_reexec_from_screen (TerminalScreen *screen,
                          cwd);
 
   return terminal_screen_reexec_from_exec_data (screen,
-                                                NULL /* exec data */,
+                                                data,
                                                 NULL /* envv */,
                                                 cwd,
                                                 cancellable,
@@ -1578,7 +1581,7 @@ spawn_result_cb (VteTerminal *terminal,
   }
 
   /* Retain info for reexec, if possible */
-  ExecData *new_exec_data = exec_data_clone (exec_data);
+  ExecData *new_exec_data = exec_data_clone (exec_data, TRUE);
   terminal_screen_clear_exec_data (screen, FALSE);
   priv->exec_data = new_exec_data;
 


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