kenz-gelsoft / Inari

0 stars 0 forks source link

error: no DISPLAY environment variable specified #36

Closed kenz-gelsoft closed 1 month ago

kenz-gelsoft commented 1 year ago
~/src/firefox-102.9.0> ./mach run
 0:01.10 /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/firefox -no-remote -profile /boot/home/src/firefox-102.9.0/obj-ff-dbg/tmp/profile-default
TS_tfopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/dependentlibs.list
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/liblgpllibs.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libmozsqlite3.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libmozgtk.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libmozwayland.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libxul.so

(firefox-default:67634): Gtk-WARNING **: 22:43:37.295: Locale not supported by C library.
        Using the fallback 'C' locale.
Error: no DISPLAY environment variable specified
[67634, Unnamed thread 1130f7debc40] WARNING: XPCOM object nsStringBuffer released from static ctor/dtor: file /boot/home/src/firefox-102.9.0/xpcom/base/nsTraceRefcnt.cpp:206
nsStringStats
 => mAllocCount:              9
 => mReallocCount:            0
 => mFreeCount:               8  --  LEAKED 1 !!!
 => mShareCount:              2
 => mAdoptCount:              0
 => mAdoptFreeCount:          0
 => Process ID: 67634, Thread ID: 854153218176
~/src/firefox-102.9.0> 
kenz-gelsoft commented 1 year ago
~/src/firefox-102.9.0> ./mach run
 0:01.10 /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/firefox -no-remote -profile /boot/home/src/firefox-102.9.0/obj-ff-dbg/tmp/profile-default
TS_tfopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/dependentlibs.list
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/liblgpllibs.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libmozsqlite3.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libmozgtk.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libmozwayland.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libxul.so
wl_ips_client_connected
display: 0x1154fafe6f40
client: 0x1154fafa7f80
Error parsing B_ARGV_RECEIVED message. Message:
BMessage('_ARG') {
        argc = int32(0x4 or 4)
        argv[0] = string("/boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/firefox", 59 bytes)
        argv[1] = string("-profile", 9 bytes)
        argv[2] = string("/boot/home/src/firefox-102.9.0/obj-ff-dbg/tmp/profile-default", 62 bytes)
        cwd = string("/boot/home/src/firefox-102.9.0", 31 bytes)
}
[1495, Main Thread] WARNING: Failed to create file monitor for /boot/home/config/settings/glib-2.0/settings/keyfile: Unable to find default local file monitor type: 'glib warning', file /boot/home/src/firefox-102.9.0/toolkit/xre/nsSigHandlers.cpp:167

(firefox-default:1495): GLib-GIO-WARNING **: 00:59:42.067: Failed to create file monitor for /boot/home/config/settings/glib-2.0/settings/keyfile: Unable to find default local file monitor type
~/src/firefox-102.9.0> 
kenz-gelsoft commented 1 year ago

glib warning message from here

https://github.com/GNOME/glib/blob/de2ff264540b892a7eac26805010cf27fbb28a39/gio/gkeyfilesettingsbackend.c#L765

kenz-gelsoft commented 1 year ago

cause message from here

https://github.com/GNOME/glib/blob/de2ff264540b892a7eac26805010cf27fbb28a39/gio/glocalfilemonitor.c#L881

kenz-gelsoft commented 1 year ago

https://discuss.haiku-os.org/t/gtk-apps-currently-broken/12641

https://discuss.haiku-os.org/t/port-of-gnome-web-epiphany/12464/149

these warnings are not real problem (at least, ignorable?)

kenz-gelsoft commented 1 year ago

Is this terminate cause?

Error parsing B_ARGV_RECEIVED message. Message:
BMessage('_ARG') {
        argc = int32(0x4 or 4)
        argv[0] = string("/boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/firefox", 59 bytes)
        argv[1] = string("-profile", 9 bytes)
        argv[2] = string("/boot/home/src/firefox-102.9.0/obj-ff-dbg/tmp/profile-default", 62 bytes)
        cwd = string("/boot/home/src/firefox-102.9.0", 31 bytes)
}
kenz-gelsoft commented 1 year ago

Message from here

https://cgit.haiku-os.org/haiku/tree/src/kits/app/Application.cpp?h=r1beta4#n1616

but, this won't cause terminate.

kenz-gelsoft commented 1 year ago

it looks we reached to here

https://searchfox.org/mozilla-esr102/source/toolkit/xre/nsAppRunner.cpp#3919

kenz-gelsoft commented 1 year ago

Haiku user is superuser, so we may be rejected here

// [Bug 1323302](https://bugzilla.mozilla.org/show_bug.cgi?id=1323302): refuse to run under sudo or similar.
static bool CheckForUserMismatch() {
  static char const* const kVars[] = {
      "HOME",
#  ifdef MOZ_WIDGET_GTK
      "XDG_RUNTIME_DIR",
#  endif
#  ifdef MOZ_X11
      "XAUTHORITY",
#  endif
  };

  const uid_t euid = geteuid();
  if (euid != 0) {
    // On Linux it's possible to have superuser capabilities with a
    // nonzero uid, but anyone who knows enough to make that happen
    // probably knows enough to debug the resulting problems.
    // Otherwise, a non-root user can't cause the problems we're
    // concerned about.
    return false;
  }

  for (const auto var : kVars) {
    if (const auto path = PR_GetEnv(var)) {
      struct stat st;
      if (stat(path, &st) == 0) {
        if (st.st_uid != euid) {
          const auto owner = FormatUid(st.st_uid);
          Output(true,
                 "Running " MOZ_APP_DISPLAYNAME
                 " as root in a regular"
                 " user's session is not supported.  ($%s is %s which is"
                 " owned by %s.)\n",
                 var, path, owner.get());
          return true;
        }
      }
    }
  }
  return false;
}
#else  // !XP_UNIX || ANDROID
static bool CheckForUserMismatch() { return false; }
#endif
kenz-gelsoft commented 1 year ago

trying

diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
index 79baf84160..c21c38254f 100644
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -3821,7 +3821,7 @@ class XREMain {
 #endif
 };

-#if defined(XP_UNIX) && !defined(ANDROID)
+#if defined(XP_UNIX) && !defined(ANDROID) && !defined(__HAIKU__)
 static SmprintfPointer FormatUid(uid_t aId) {
   if (const auto pw = getpwuid(aId)) {
     return mozilla::Smprintf("%s", pw->pw_name);
@@ -3870,7 +3870,7 @@ static bool CheckForUserMismatch() {
   }
   return false;
 }
-#else  // !XP_UNIX || ANDROID
+#else  // !XP_UNIX || ANDROID || __HAIKU__
 static bool CheckForUserMismatch() { return false; }
 #endif
kenz-gelsoft commented 1 year ago

output didn't change

~/src/firefox-102.9.0> ./mach run
 0:02.01 /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/firefox -no-remote -profile /boot/home/src/firefox-102.9.0/obj-ff-dbg/tmp/profile-default
TS_tfopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/dependentlibs.list
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/liblgpllibs.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libmozsqlite3.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libmozgtk.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libmozwayland.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libxul.so

(firefox-default:3232): Gtk-WARNING **: 07:11:17.409: Locale not supported by C library.
        Using the fallback 'C' locale.
Error: no DISPLAY environment variable specified
[3232, Unnamed thread 114c4ac6ec40] WARNING: XPCOM object nsStringBuffer released from static ctor/dtor: file /boot/home/src/firefox-102.9.0/xpcom/base/nsTraceRefcnt.cpp:206
nsStringStats
 => mAllocCount:              9
 => mReallocCount:            0
 => mFreeCount:               8  --  LEAKED 1 !!!
 => mShareCount:              2
 => mAdoptCount:              0
 => mAdoptFreeCount:          0
 => Process ID: 3232, Thread ID: 1095247505536
~/src/firefox-102.9.0> 
kenz-gelsoft commented 1 year ago

https://discuss.haiku-os.org/t/my-progress-in-wayland-compatibility-layer/12373/42

kenz-gelsoft commented 1 year ago

we terminated on here

/*
 * XRE_main - A class based main entry point used by most platforms.
 *            Note that on OSX, aAppData->xreDirectory will point to
 *            .app/Contents/Resources.
 */
int XREMain::XRE_main(int argc, char* argv[], const BootstrapConfig& aConfig) {
//(snip)
  // startup
  result = XRE_mainStartup(&exit);
  if (result != 0 || exit) return result;
kenz-gelsoft commented 1 year ago

failed here and message from here

/*
 * XRE_mainStartup - Initializes the profile and various other services.
 * Main() will exit early if either return value != 0 or if aExitFlag is
 * true.
 */
int XREMain::XRE_mainStartup(bool* aExitFlag) {
// snip
#if defined(MOZ_WIDGET_GTK)
  if (!gfxPlatform::IsHeadless()) {
    const char* display_name = nullptr;
    bool saveDisplayArg = false;

    // display_name is owned by gdk.
    display_name = gdk_get_display_arg_name();
    // if --display argument is given make sure it's
    // also passed to ContentChild::Init() by MOZ_GDK_DISPLAY.
    if (display_name) {
      SaveWordToEnv("MOZ_GDK_DISPLAY", nsDependentCString(display_name));
      saveDisplayArg = true;
    }

    bool waylandEnabled = false;
#  if defined(MOZ_WAYLAND)
    waylandEnabled = IsWaylandEnabled();
#  endif
    // On Wayland disabled builds read X11 DISPLAY env exclusively
    // and don't care about different displays.
    if (!waylandEnabled && !display_name) {
      display_name = PR_GetEnv("DISPLAY");
      if (!display_name) {
        PR_fprintf(PR_STDERR,
                   "Error: no DISPLAY environment variable specified\n");
        return 1;
      }
    }
kenz-gelsoft commented 1 year ago
export DISPLAY=:0

and following line opened firefox BApplication by wayland-inproc-serer

https://searchfox.org/mozilla-esr102/source/toolkit/xre/nsAppRunner.cpp#4856

https://searchfox.org/mozilla-esr102/source/toolkit/xre/nsAppRunner.cpp#4884

https://searchfox.org/mozilla-esr102/source/toolkit/xre/nsAppRunner.cpp#4940

https://searchfox.org/mozilla-esr102/source/toolkit/xre/nsAppRunner.cpp#5156

https://searchfox.org/mozilla-esr102/source/toolkit/xre/nsAppRunner.cpp#5203

kenz-gelsoft commented 1 year ago

failed here

https://searchfox.org/mozilla-esr102/source/xpcom/build/XPCOMInit.cpp#328

kenz-gelsoft commented 1 year ago

chromium ipc code

kenz-gelsoft commented 1 year ago

https://searchfox.org/mozilla-esr102/source/toolkit/xre/nsAppRunner.cpp#4024

kenz-gelsoft commented 1 year ago

for wayland only build, we had to export WAYLAND_DISPLAY=:0

kenz-gelsoft commented 1 month ago

Will be handled in

https://github.com/kenz-gelsoft/gecko-dev/issues/6