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




commit bc96e6ee9684305890fdeacdd852341703aa718a
Author: Christian Persch <chpe src gnome org>
Date:   Thu Aug 26 20:01:30 2021 +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)
    (cherry picked from commit 16bd9f6a4181d37af2769e7ca5a1f9a1211cfaac)
    (cherry picked from commit ff0ca88c1ccef6e0eaeaa642951937d4410e228b)

 src/terminal-screen.cc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/terminal-screen.cc b/src/terminal-screen.cc
index 382ac296..e2e7d2bc 100644
--- a/src/terminal-screen.cc
+++ b/src/terminal-screen.cc
@@ -266,7 +266,8 @@ exec_data_new (void)
 }
 
 static ExecData *
-exec_data_clone (ExecData *data)
+exec_data_clone (ExecData *data,
+                 gboolean preserve_argv)
 {
   if (data == nullptr)
     return nullptr;
@@ -276,7 +277,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 != nullptr) {
+  if (!preserve_argv ||
+      data->fd_list != nullptr) {
     clone->as_shell = TRUE;
     return clone;
   }
@@ -854,6 +856,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,
@@ -863,7 +866,7 @@ terminal_screen_reexec_from_screen (TerminalScreen *screen,
                          cwd);
 
   return terminal_screen_reexec_from_exec_data (screen,
-                                                nullptr /* exec data */,
+                                                data,
                                                 nullptr /* envv */,
                                                 cwd,
                                                 cancellable,
@@ -1582,7 +1585,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]