diff options
Diffstat (limited to '')
6 files changed, 401 insertions, 0 deletions
diff --git a/debian/patches/01_onlyshowin.patch b/debian/patches/01_onlyshowin.patch new file mode 100644 index 0000000..57b3432 --- /dev/null +++ b/debian/patches/01_onlyshowin.patch @@ -0,0 +1,20 @@ +From: Josselin Mouette <joss@debian.org> +Date: Mon, 1 Jun 2009 09:48:55 +0000 +Subject: Only show gnome-terminal in GNOME menus + +--- + org.gnome.Terminal.desktop.in.in | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/org.gnome.Terminal.desktop.in.in b/org.gnome.Terminal.desktop.in.in +index 4148c30..7fd2a43 100644 +--- a/org.gnome.Terminal.desktop.in.in ++++ b/org.gnome.Terminal.desktop.in.in +@@ -11,6 +11,7 @@ Categories=GNOME;GTK;System;TerminalEmulator; + StartupNotify=true + StartupWMClass=Gnome-terminal + X-GNOME-SingleWindow=false ++OnlyShowIn=GNOME;Unity; + Actions=new-window;preferences; + + [Desktop Action new-window] diff --git a/debian/patches/Provide-fallback-for-reading-current-directory-if-OS.patch b/debian/patches/Provide-fallback-for-reading-current-directory-if-OS.patch new file mode 100644 index 0000000..1702183 --- /dev/null +++ b/debian/patches/Provide-fallback-for-reading-current-directory-if-OS.patch @@ -0,0 +1,100 @@ +From: Martin Pitt <martinpitt@gnome.org> +Date: Sun, 31 May 2015 17:09:28 +0000 +Subject: 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(+) + +diff --git a/src/terminal-screen.c b/src/terminal-screen.c +index 10d052f..00cb825 100644 +--- a/src/terminal-screen.c ++++ b/src/terminal-screen.c +@@ -353,6 +353,63 @@ terminal_screen_clear_exec_data (TerminalScreen *screen, + + 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) + { +@@ -1817,12 +1874,21 @@ terminal_screen_button_press (GtkWidget *widget, + 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; ++ } ++ } ++ + ExecData *data = screen->priv->exec_data; + if (data && data->cwd) + return g_strdup (data->cwd); diff --git a/debian/patches/client-Filter-out-some-more-env-variables.patch b/debian/patches/client-Filter-out-some-more-env-variables.patch new file mode 100644 index 0000000..dd7600f --- /dev/null +++ b/debian/patches/client-Filter-out-some-more-env-variables.patch @@ -0,0 +1,22 @@ +From: Christian Persch <chpe@src.gnome.org> +Date: Fri, 25 Dec 2020 18:01:12 +0100 +Subject: client: Filter out some more env variables + +Origin: upstream, 3.39.0, commit:28c35c6017e7264b7b4ecd2883e5a0141bac614c +--- + src/terminal-client-utils.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/terminal-client-utils.c b/src/terminal-client-utils.c +index 55f56ab..ae6c2ea 100644 +--- a/src/terminal-client-utils.c ++++ b/src/terminal-client-utils.c +@@ -110,6 +110,8 @@ terminal_client_get_environment_filters (void) + "EXIT_STATUS", + "GIO_LAUNCHED_DESKTOP_FILE", + "GIO_LAUNCHED_DESKTOP_FILE_PID", ++ "GJS_DEBUG_OUTPUT", ++ "GJS_DEBUG_TOPICS", + "GNOME_DESKTOP_ICON", + "INVOCATION_ID", + "JOURNAL_STREAM", diff --git a/debian/patches/screen-Manually-handle-env-inheritance.patch b/debian/patches/screen-Manually-handle-env-inheritance.patch new file mode 100644 index 0000000..0d41e1d --- /dev/null +++ b/debian/patches/screen-Manually-handle-env-inheritance.patch @@ -0,0 +1,69 @@ +From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com> +Date: Fri, 25 Dec 2020 18:01:12 +0100 +Subject: screen: Manually handle env inheritance + +Don't let VTE handle merging the environment; build the merged block +ourselves. This avoids confusion when we reuse the exec data. + +Bug: https://gitlab.gnome.org/GNOME/gnome-terminal/-/issues/303 +Bug-Debian: https://bugs.debian.org/973918 +Origin: upstream, 3.39.0, commit:aa45ba5c83d8e8940dc20e24397dc4475a72441d +--- + src/terminal-screen.c | 29 ++++++++++++++++------------- + 1 file changed, 16 insertions(+), 13 deletions(-) + +diff --git a/src/terminal-screen.c b/src/terminal-screen.c +index 0e447ae..10d052f 100644 +--- a/src/terminal-screen.c ++++ b/src/terminal-screen.c +@@ -946,9 +946,7 @@ terminal_screen_exec (TerminalScreen *screen, + &shell); + + gboolean preserve_cwd = FALSE; +- GSpawnFlags spawn_flags = G_SPAWN_SEARCH_PATH_FROM_ENVP; +- if (initial_envv) +- spawn_flags |= VTE_SPAWN_NO_PARENT_ENVV; ++ GSpawnFlags spawn_flags = G_SPAWN_SEARCH_PATH_FROM_ENVP | VTE_SPAWN_NO_PARENT_ENVV; + gs_strfreev char **exec_argv = NULL; + if (!terminal_screen_get_child_command (screen, + argv, +@@ -1435,6 +1433,7 @@ terminal_screen_get_child_environment (TerminalScreen *screen, + { + TerminalApp *app = terminal_app_get (); + char **env; ++ gs_strfreev char** current_environ = NULL; + char *e, *v; + GHashTable *env_table; + GHashTableIter iter; +@@ -1443,17 +1442,21 @@ terminal_screen_get_child_environment (TerminalScreen *screen, + + env_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + +- env = initial_envv; +- if (env) ++ if (initial_envv) ++ env = initial_envv; ++ else { ++ env = current_environ = g_get_environ (); ++ /* Remove this variable which we set in server.c:main() */ ++ env = g_environ_unsetenv (env, "G_ENABLE_DIAGNOSTIC"); ++ } ++ ++ for (i = 0; env[i]; ++i) + { +- for (i = 0; env[i]; ++i) +- { +- v = strchr (env[i], '='); +- if (v) +- g_hash_table_replace (env_table, g_strndup (env[i], v - env[i]), g_strdup (v + 1)); +- else +- g_hash_table_replace (env_table, g_strdup (env[i]), NULL); +- } ++ v = strchr (env[i], '='); ++ if (v) ++ g_hash_table_replace (env_table, g_strndup (env[i], v - env[i]), g_strdup (v + 1)); ++ else ++ g_hash_table_replace (env_table, g_strdup (env[i]), NULL); + } + + /* Remove unwanted env variables */ diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..af0a5f4 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,5 @@ +server-Filter-environment-variables-in-the-server-too.patch +client-Filter-out-some-more-env-variables.patch +screen-Manually-handle-env-inheritance.patch +01_onlyshowin.patch +Provide-fallback-for-reading-current-directory-if-OS.patch diff --git a/debian/patches/server-Filter-environment-variables-in-the-server-too.patch b/debian/patches/server-Filter-environment-variables-in-the-server-too.patch new file mode 100644 index 0000000..8e61b61 --- /dev/null +++ b/debian/patches/server-Filter-environment-variables-in-the-server-too.patch @@ -0,0 +1,185 @@ +From: Christian Persch <chpe@src.gnome.org> +Date: Fri, 25 Dec 2020 18:01:12 +0100 +Subject: server: Filter environment variables in the server too + +Origin: upstream, 3.39.0, commit:8979ac4cbfbaa11237ddaf5132393f6a99d0c6ea +--- + src/Makefile.am | 2 ++ + src/terminal-client-utils.c | 88 ++++++++++++++++++++++++++++++--------------- + src/terminal-client-utils.h | 6 +++- + src/terminal-screen.c | 19 +++------- + 4 files changed, 72 insertions(+), 43 deletions(-) + +diff --git a/src/Makefile.am b/src/Makefile.am +index 2ea3d93..4583cfc 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -45,6 +45,8 @@ gnome_terminal_server_SOURCES = \ + terminal-accels.h \ + terminal-app.c \ + terminal-app.h \ ++ terminal-client-utils.c \ ++ terminal-client-utils.h \ + terminal-debug.c \ + terminal-debug.h \ + terminal-defines.h \ +diff --git a/src/terminal-client-utils.c b/src/terminal-client-utils.c +index e929281..55f56ab 100644 +--- a/src/terminal-client-utils.c ++++ b/src/terminal-client-utils.c +@@ -99,6 +99,65 @@ terminal_client_append_create_instance_options (GVariantBuilder *builder, + "fullscreen-window", g_variant_new_boolean (TRUE)); + } + ++char const* const* ++terminal_client_get_environment_filters (void) ++{ ++ static char const* filters[] = { ++ "COLORTERM", ++ "COLUMNS", ++ "DESKTOP_STARTUP_ID", ++ "EXIT_CODE", ++ "EXIT_STATUS", ++ "GIO_LAUNCHED_DESKTOP_FILE", ++ "GIO_LAUNCHED_DESKTOP_FILE_PID", ++ "GNOME_DESKTOP_ICON", ++ "INVOCATION_ID", ++ "JOURNAL_STREAM", ++ "LINES", ++ "LISTEN_FDNAMES", ++ "LISTEN_FDS", ++ "LISTEN_PID", ++ "MAINPID", ++ "MANAGERPID", ++ "NOTIFY_SOCKET", ++ "NOTIFY_SOCKET", ++ "PIDFILE", ++ "PWD", ++ "REMOTE_ADDR", ++ "REMOTE_PORT", ++ "SERVICE_RESULT", ++ "TERM", ++ "VTE_VERSION", ++ "WATCHDOG_PID", ++ "WATCHDOG_USEC", ++ "WINDOWID", ++ NULL ++ }; ++ ++ return filters; ++} ++ ++/** ++ * terminal_client_filter_environment: ++ * @envv: (transfer full): the environment ++ * ++ * Filters unwanted variables from @envv, and returns it. ++ * ++ * Returns: (transfer full): the filtered environment ++ */ ++char** ++terminal_client_filter_environment (char** envv) ++{ ++ if (envv == NULL) ++ return NULL; ++ ++ char const* const* filters = terminal_client_get_environment_filters (); ++ for (unsigned i = 0; filters[i]; ++i) ++ envv = g_environ_unsetenv (envv, filters[i]); ++ ++ return envv; ++} ++ + /** + * terminal_client_append_exec_options: + * @builder: a #GVariantBuilder of #GVariantType "a{sv}" +@@ -122,34 +181,7 @@ terminal_client_append_exec_options (GVariantBuilder *builder, + gs_strfreev char **envv; + + envv = g_get_environ (); +- envv = g_environ_unsetenv (envv, "COLORTERM"); +- envv = g_environ_unsetenv (envv, "COLUMNS"); +- envv = g_environ_unsetenv (envv, "DESKTOP_STARTUP_ID"); +- envv = g_environ_unsetenv (envv, "EXIT_CODE"); +- envv = g_environ_unsetenv (envv, "EXIT_STATUS"); +- envv = g_environ_unsetenv (envv, "GIO_LAUNCHED_DESKTOP_FILE"); +- envv = g_environ_unsetenv (envv, "GIO_LAUNCHED_DESKTOP_FILE_PID"); +- envv = g_environ_unsetenv (envv, "GNOME_DESKTOP_ICON"); +- envv = g_environ_unsetenv (envv, "INVOCATION_ID"); +- envv = g_environ_unsetenv (envv, "JOURNAL_STREAM"); +- envv = g_environ_unsetenv (envv, "LINES"); +- envv = g_environ_unsetenv (envv, "LISTEN_FDNAMES"); +- envv = g_environ_unsetenv (envv, "LISTEN_FDS"); +- envv = g_environ_unsetenv (envv, "LISTEN_PID"); +- envv = g_environ_unsetenv (envv, "MAINPID"); +- envv = g_environ_unsetenv (envv, "MANAGERPID"); +- envv = g_environ_unsetenv (envv, "NOTIFY_SOCKET"); +- envv = g_environ_unsetenv (envv, "NOTIFY_SOCKET"); +- envv = g_environ_unsetenv (envv, "PIDFILE"); +- envv = g_environ_unsetenv (envv, "PWD"); +- envv = g_environ_unsetenv (envv, "REMOTE_ADDR"); +- envv = g_environ_unsetenv (envv, "REMOTE_PORT"); +- envv = g_environ_unsetenv (envv, "SERVICE_RESULT"); +- envv = g_environ_unsetenv (envv, "TERM"); +- envv = g_environ_unsetenv (envv, "VTE_VERSION"); +- envv = g_environ_unsetenv (envv, "WATCHDOG_PID"); +- envv = g_environ_unsetenv (envv, "WATCHDOG_USEC"); +- envv = g_environ_unsetenv (envv, "WINDOWID"); ++ envv = terminal_client_filter_environment (envv); + + envv = g_environ_unsetenv (envv, TERMINAL_ENV_SERVICE_NAME); + envv = g_environ_unsetenv (envv, TERMINAL_ENV_SCREEN); +diff --git a/src/terminal-client-utils.h b/src/terminal-client-utils.h +index 0a70637..19a0a2b 100644 +--- a/src/terminal-client-utils.h ++++ b/src/terminal-client-utils.h +@@ -47,7 +47,11 @@ void terminal_client_append_exec_options (GVariantBuilder *builder, + gsize fd_array_len, + gboolean shell); + +-char * terminal_client_get_fallback_startup_id (void); ++char * terminal_client_get_fallback_startup_id (void) G_GNUC_MALLOC; ++ ++char const* const* terminal_client_get_environment_filters (void); ++ ++char** terminal_client_filter_environment (char** envv) G_GNUC_MALLOC; + + G_END_DECLS + +diff --git a/src/terminal-screen.c b/src/terminal-screen.c +index 0c4ee50..0e447ae 100644 +--- a/src/terminal-screen.c ++++ b/src/terminal-screen.c +@@ -21,6 +21,7 @@ + #include "terminal-pcre2.h" + #include "terminal-regex.h" + #include "terminal-screen.h" ++#include "terminal-client-utils.h" + + #include <errno.h> + #include <string.h> +@@ -1455,20 +1456,10 @@ terminal_screen_get_child_environment (TerminalScreen *screen, + } + } + +- g_hash_table_remove (env_table, "COLUMNS"); +- g_hash_table_remove (env_table, "LINES"); +- g_hash_table_remove (env_table, "GNOME_DESKTOP_ICON"); +- +- /* WINDOWID does not work correctly ever since we don't use a native +- * GdkWindow anymore, and it also becomes incorrect if the screen is +- * moved to a different window, or the window unrealized and re-realized. +- * Additionally, it cannot ever work on non-X11 displays like wayland. +- * And on X11, the only use for this is broken foreign drawing on the +- * window (w3m etc), and trying to find the focused screen (brltty), +- * which can now be done correctly using DECSET 1004. +- * Therefore we do not set WINDOWID, and remove an existing variable. +- */ +- g_hash_table_remove (env_table, "WINDOWID"); ++ /* Remove unwanted env variables */ ++ char const* const* filters = terminal_client_get_environment_filters (); ++ for (i = 0; filters[i]; ++i) ++ g_hash_table_remove (env_table, filters[i]); + + terminal_util_add_proxy_env (env_table); + |