unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#54844: 29.0.50; pgtk: with --daemon, DISPLAY gets set to "wayland-0"
@ 2022-04-10 21:50 Sean Whitton
  2022-04-11  1:03 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 7+ messages in thread
From: Sean Whitton @ 2022-04-10 21:50 UTC (permalink / raw)
  To: 54844; +Cc: luangruo

In a terminal emulator where DISPLAY is ":0",

1. src/emacs --daemon -Q
2. lib-src/emacsclient -c
3. M-: (getenv "DISPLAY") RET

Value is "wayland-0" instead of ":0".  This is under Sway on Debian.
The problem does not occur if you launch without --daemon and then use
M-x server-start.

Seems similar to #53969.  I tried commenting out the only other Lisp
code which does (setenv "DISPLAY" ...) but that does not help.  So seems
like it is in C somewhere.

-- 
Sean Whitton





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#54844: 29.0.50; pgtk: with --daemon, DISPLAY gets set to "wayland-0"
  2022-04-10 21:50 bug#54844: 29.0.50; pgtk: with --daemon, DISPLAY gets set to "wayland-0" Sean Whitton
@ 2022-04-11  1:03 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-04-11  1:10   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 7+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-04-11  1:03 UTC (permalink / raw)
  To: Sean Whitton; +Cc: 54844

Sean Whitton <spwhitton@spwhitton.name> writes:

> In a terminal emulator where DISPLAY is ":0",
>
> 1. src/emacs --daemon -Q
> 2. lib-src/emacsclient -c
> 3. M-: (getenv "DISPLAY") RET
>
> Value is "wayland-0" instead of ":0".  This is under Sway on Debian.
> The problem does not occur if you launch without --daemon and then use
> M-x server-start.
>
> Seems similar to #53969.  I tried commenting out the only other Lisp
> code which does (setenv "DISPLAY" ...) but that does not help.  So seems
> like it is in C somewhere.

Yep, this is in the multi-TTY code.  I'll fix that.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#54844: 29.0.50; pgtk: with --daemon, DISPLAY gets set to "wayland-0"
  2022-04-11  1:03 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-04-11  1:10   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-04-11 18:46     ` Sean Whitton
  0 siblings, 1 reply; 7+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-04-11  1:10 UTC (permalink / raw)
  To: Sean Whitton; +Cc: 54844

Po Lu <luangruo@yahoo.com> writes:

> Yep, this is in the multi-TTY code.  I'll fix that.

Does this fix the problem?

diff --git a/src/callproc.c b/src/callproc.c
index 0922e10f01..1e74836682 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -85,6 +85,10 @@ #define _P_NOWAIT 1	/* from process.h */
 #include "nsterm.h"
 #endif
 
+#ifdef HAVE_PGTK
+#include "pgtkterm.h"
+#endif
+
 /* Pattern used by call-process-region to make temp files.  */
 static Lisp_Object Vtemp_file_name_pattern;
 
@@ -1812,6 +1816,18 @@ make_environment_block (Lisp_Object current_dir)
     if (NILP (display))
       {
 	Lisp_Object tmp = Fframe_parameter (selected_frame, Qdisplay);
+
+#ifdef HAVE_PGTK
+	/* The only time GDK actually returns correct information is
+	   when it's running under X Windows.  DISPLAY shouldn't be
+	   set to a Wayland display either, since that's an X specific
+	   variable.  */
+	if (FRAME_WINDOW_P (SELECTED_FRAME ())
+	    && strcmp (G_OBJECT_TYPE_NAME (FRAME_X_DISPLAY (SELECTED_FRAME ())),
+		       "GdkX11Display"))
+	  tmp = Qnil;
+#endif
+
 	if (!STRINGP (tmp) && CONSP (Vinitial_environment))
 	  /* If still not found, Look for DISPLAY in Vinitial_environment.  */
 	  tmp = Fgetenv_internal (build_string ("DISPLAY"),





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#54844: 29.0.50; pgtk: with --daemon, DISPLAY gets set to "wayland-0"
  2022-04-11  1:10   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-04-11 18:46     ` Sean Whitton
  2022-04-12  1:22       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 7+ messages in thread
From: Sean Whitton @ 2022-04-11 18:46 UTC (permalink / raw)
  To: Po Lu; +Cc: 54844

Hello,

On Mon 11 Apr 2022 at 09:10AM +08, Po Lu wrote:

> Po Lu <luangruo@yahoo.com> writes:
>
>> Yep, this is in the multi-TTY code.  I'll fix that.
>
> Does this fix the problem?

Thank you for the patch, but unfortunately I can still reproduce the
problem using my original recipe.

-- 
Sean Whitton





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#54844: 29.0.50; pgtk: with --daemon, DISPLAY gets set to "wayland-0"
  2022-04-11 18:46     ` Sean Whitton
@ 2022-04-12  1:22       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-04-12  5:21         ` Sean Whitton
  0 siblings, 1 reply; 7+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-04-12  1:22 UTC (permalink / raw)
  To: Sean Whitton; +Cc: 54844

Sean Whitton <spwhitton@spwhitton.name> writes:

> Thank you for the patch, but unfortunately I can still reproduce the
> problem using my original recipe.

I missed something, sorry, what if you apply this in addition to the
other patch?

diff --git a/src/callproc.c b/src/callproc.c
index 0922e10f01..df673311d6 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1687,6 +1687,7 @@ getenv_internal (const char *var, ptrdiff_t varlen, char **value,
   /* For DISPLAY try to get the values from the frame or the initial env.  */
   if (strcmp (var, "DISPLAY") == 0)
     {
+#ifndef HAVE_PGTK
       Lisp_Object display
 	= Fframe_parameter (NILP (frame) ? selected_frame : frame, Qdisplay);
       if (STRINGP (display))
@@ -1695,6 +1696,7 @@ getenv_internal (const char *var, ptrdiff_t varlen, char **value,
 	  *valuelen = SBYTES (display);
 	  return 1;
 	}
+#endif
       /* If still not found, Look for DISPLAY in Vinitial_environment.  */
       if (getenv_internal_1 (var, varlen, value, valuelen,
 			     Vinitial_environment))

Thanks.





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#54844: 29.0.50; pgtk: with --daemon, DISPLAY gets set to "wayland-0"
  2022-04-12  1:22       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-04-12  5:21         ` Sean Whitton
  2022-04-12  5:28           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 7+ messages in thread
From: Sean Whitton @ 2022-04-12  5:21 UTC (permalink / raw)
  To: Po Lu; +Cc: 54844

Hello,

On Tue 12 Apr 2022 at 09:22AM +08, Po Lu wrote:

> Sean Whitton <spwhitton@spwhitton.name> writes:
>
>> Thank you for the patch, but unfortunately I can still reproduce the
>> problem using my original recipe.

Looks like that fixes it, thanks again!

-- 
Sean Whitton





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#54844: 29.0.50; pgtk: with --daemon, DISPLAY gets set to "wayland-0"
  2022-04-12  5:21         ` Sean Whitton
@ 2022-04-12  5:28           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 7+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-04-12  5:28 UTC (permalink / raw)
  To: Sean Whitton; +Cc: 54844-done

Sean Whitton <spwhitton@spwhitton.name> writes:

> Looks like that fixes it, thanks again!

I installed that and am closing this bug.
Thanks for testing.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-04-12  5:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-10 21:50 bug#54844: 29.0.50; pgtk: with --daemon, DISPLAY gets set to "wayland-0" Sean Whitton
2022-04-11  1:03 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-11  1:10   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-11 18:46     ` Sean Whitton
2022-04-12  1:22       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-12  5:21         ` Sean Whitton
2022-04-12  5:28           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).