Had the same assertion in vte_terminal_spawn_sync, happens in Upstream too.

Dug around the envv Pointer, _vte_pty_check_envv does not like empty entries.

src/notebook.c is constructing the envv Pointer in environ_str and later copies it to new_environs.

Around line 150 there is a '\t' being pushed into environ_str but the following append of the TERM envvar is eventually ifdef'ed. When COLORTERM is forced-pushed into environ_str another '\t' will be prefixed without checking environ_str again.

So unless you compile with ENABLE_SET_EMULATION there will be a lone '\t' in environ_str which will later be translated into an empty envv entry.

I supposed the check for non-empty environ_str should be within the ifdef as well before the COLORTERM append.
I attached a quick'n'dirty patch.

But now that I look at it again (7 hours later), it would also work to leave the code as is but hardcode a '\t' after the TERM append and remove the hardcoded '\t' from COLORTERM instead.
E.g.:
g_string_append_printf (environ_str, "TERM=xterm"); to g_string_append_printf (environ_str, "TERM=xterm\t"); etc
and
g_string_append_printf (environ_str, "\tCOLORTERM=lilyterm"); to g_string_append_printf (environ_str, "COLORTERM=lilyterm");

I'll leave that for upstream to figure out ;-)

Hope this helps someone.


Description: Prevent empty environ_str entry

Author: Philipp Wolski <philipp.wol...@kisters.de>
Bug-Debian: https://bugs.debian.org/970419
Last-Update: 2020-10-14

Index: lilyterm-0.9.9.4+git20150208.f600c0/src/notebook.c
===================================================================
--- lilyterm-0.9.9.4+git20150208.f600c0.orig/src/notebook.c
+++ lilyterm-0.9.9.4+git20150208.f600c0/src/notebook.c
@@ -148,14 +148,14 @@ struct Page *add_page(struct Window *win
 			environ_str = g_string_append(environ_str, "\t");
 		g_string_append_printf (environ_str, "%s", user_environ);
 	}
+
+#ifdef ENABLE_SET_EMULATION
 #ifdef SAFEMODE
 	if (environ_str && environ_str->len)
 #else
 	if (environ_str->len)
 #endif
 		environ_str = g_string_append(environ_str, "\t");
-
-#ifdef ENABLE_SET_EMULATION
 #  ifdef SAFEMODE
 	if (win_data->emulate_term == NULL)
 		g_string_append_printf (environ_str, "TERM=xterm");
@@ -163,8 +163,15 @@ struct Page *add_page(struct Window *win
 #  endif
 		g_string_append_printf (environ_str, "TERM=%s", win_data->emulate_term);
 #endif
+
+#ifdef SAFEMODE
+	if (environ_str && environ_str->len)
+#else
+	if (environ_str->len)
+#endif
+		environ_str = g_string_append(environ_str, "\t");
 	// set colorterm
-	g_string_append_printf (environ_str, "\tCOLORTERM=lilyterm");
+	g_string_append_printf (environ_str, "COLORTERM=lilyterm");
 
 // ---- Setting the VTE_CJK_WIDTH environment ---- //
 

Reply via email to