Pascal Stumpf writes:

> On Fri, 22 Nov 2019 09:14:05 +0100, Solene Rapenne wrote:
>> Hi,
>> 
>> I updated openmw like I did last time, but when I start the game I don't
>> get any X window displayed, but I see an openmw process using 100% cpu.
>> Any idea?
>> 
>> openmw-launcher and openmw-wizard works.
>
> I know.  I haven't found out why yet.

I was able to reproduce Solene's reported issue. Here is a diff based on
Solene's diff that:
- Backports an upstream fix for this issue:
https://github.com/OpenMW/openmw/commit/fe69e5507df97d84d3cb29d760da78f64e41cc07
- Removes REVISION

It seems that the "crash handler" was preventing startup. If you do not
want to carry this patch it should be fixed by 0.46.0.

I tested on amd64, and it now starts normally.

$ openmw
Crash handler installed
Loading config file: /home/namtsui/.config/openmw/openmw.cfg
Loading config file: /etc/openmw/openmw.cfg
OpenMW version 0.45.0

Feedback and tests are welcome.

Index: Makefile
===================================================================
RCS file: /cvs/ports/games/openmw/Makefile,v
retrieving revision 1.20
diff -u -p -u -r1.20 Makefile
--- Makefile    12 Jul 2019 20:46:22 -0000      1.20
+++ Makefile    24 Nov 2019 05:09:04 -0000
@@ -4,9 +4,8 @@ ONLY_FOR_ARCHS =        amd64 i386
 
 COMMENT =              open source implementation of TES III: Morrowind
 
-V =                    0.44.0
+V =                    0.45.0
 DISTNAME =             openmw-$V
-REVISION =             1
 
 CATEGORIES =           games
 
Index: distinfo
===================================================================
RCS file: /cvs/ports/games/openmw/distinfo,v
retrieving revision 1.8
diff -u -p -u -r1.8 distinfo
--- distinfo    30 Jul 2018 18:51:40 -0000      1.8
+++ distinfo    24 Nov 2019 05:09:04 -0000
@@ -1,2 +1,2 @@
-SHA256 (openmw-0.44.0.tar.gz) = nn25ndPhQ0suMunmGuWo+1FqabtogPsoVsCfLJyozw0=
-SIZE (openmw-0.44.0.tar.gz) = 4976422
+SHA256 (openmw-0.45.0.tar.gz) = tjz5cfQG718oAZ9l6eK9lkGiJ0We3kXRR1YpF/Z+HGQ=
+SIZE (openmw-0.45.0.tar.gz) = 4711103
Index: patches/patch-components_crashcatcher_crashcatcher_cpp
===================================================================
RCS file: patches/patch-components_crashcatcher_crashcatcher_cpp
diff -N patches/patch-components_crashcatcher_crashcatcher_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-components_crashcatcher_crashcatcher_cpp      24 Nov 2019 
05:09:04 -0000
@@ -0,0 +1,152 @@
+$OpenBSD$
+
+Fixes game failing to start.
+Upstream commit fe69e5507df97d84d3cb29d760da78f64e41cc07
+
+Index: components/crashcatcher/crashcatcher.cpp
+--- components/crashcatcher/crashcatcher.cpp.orig
++++ components/crashcatcher/crashcatcher.cpp
+@@ -17,6 +17,7 @@
+ #include <components/debug/debuglog.hpp>
+ 
+ #include <boost/filesystem/fstream.hpp>
++#include <boost/filesystem/operations.hpp>
+ 
+ namespace bfs = boost::filesystem;
+ 
+@@ -34,9 +35,13 @@ namespace bfs = boost::filesystem;
+ 
+ #if defined(__APPLE__)
+ #include <sys/sysctl.h>
++#include <libproc.h>
+ #endif
+ 
+-#define UNUSED(x) (void)(x)
++#if defined(__FreeBSD__)
++#include <sys/sysctl.h>
++#include <sys/user.h>
++#endif
+ 
+ static const char crash_switch[] = "--cc-handle-crash";
+ 
+@@ -413,6 +418,39 @@ static void crash_handler(const char *logfile)
+     exit(0);
+ }
+ 
++static void getExecPath(char **argv)
++{
++#if defined (__FreeBSD__)
++    int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
++    size_t size = sizeof(argv0);
++
++    if (sysctl(mib, 4, argv0, &size, nullptr, 0) == 0)
++        return;
++#endif
++
++#if defined (__APPLE__)
++    if(proc_pidpath(getpid(), argv0, sizeof(argv0)) > 0)
++        return;
++#endif
++    int cwdlen;
++    const char *statusPaths[] = {"/proc/self/exe", "/proc/self/file", 
"/proc/curproc/exe", "/proc/curproc/file"};
++    memset(argv0, 0, sizeof(argv0));
++
++    for(const char *path : statusPaths)
++    {
++        if (readlink(path, argv0, sizeof(argv0)) != -1)
++            return;
++    }
++
++    if(argv[0][0] == '/')
++        snprintf(argv0, sizeof(argv0), "%s", argv[0]);
++    else if (getcwd(argv0, sizeof(argv0)) != NULL)
++    {
++        cwdlen = strlen(argv0);
++        snprintf(argv0+cwdlen, sizeof(argv0)-cwdlen, "/%s", argv[0]);
++    }
++}
++
+ int crashCatcherInstallHandlers(int argc, char **argv, int num_signals, int 
*signals, const char *logfile, int (*user_info)(char*, char*))
+ {
+     struct sigaction sa;
+@@ -424,20 +462,7 @@ int crashCatcherInstallHandlers(int argc, char **argv,
+ 
+     cc_user_info = user_info;
+ 
+-    if(argv[0][0] == '/')
+-        snprintf(argv0, sizeof(argv0), "%s", argv[0]);
+-    else
+-    {
+-        {
+-            /* we don't want to disable "ignoring return value" warnings, so 
we make
+-             * a special exception here. */
+-            char * unused;
+-            unused = getcwd(argv0, sizeof(argv0));
+-            UNUSED(unused);
+-        }
+-        retval = strlen(argv0);
+-        snprintf(argv0+retval, sizeof(argv0)-retval, "/%s", argv[0]);
+-    }
++    getExecPath(argv);
+ 
+     /* Set an alternate signal stack so SIGSEGVs caused by stack overflows
+      * still run */
+@@ -467,20 +492,24 @@ int crashCatcherInstallHandlers(int argc, char **argv,
+ 
+ static bool is_debugger_present()
+ {
+-#if !defined (__APPLE__)
+-    bfs::ifstream file((bfs::path("/proc/self/status")));
+-    while (!file.eof())
++#if defined (__linux__)
++    bfs::path procstatus = bfs::path("/proc/self/status");
++    if (bfs::exists(procstatus))
+     {
+-        std::string word;
+-        file >> word;
+-        if (word == "TracerPid:")
++        bfs::ifstream file((procstatus));
++        while (!file.eof())
+         {
++            std::string word;
+             file >> word;
+-            return word != "0";
++            if (word == "TracerPid:")
++            {
++                file >> word;
++                return word != "0";
++            }
+         }
+     }
+     return false;
+-#else
++#elif defined(__APPLE__)
+     int junk;
+     int mib[4];
+     struct kinfo_proc info;
+@@ -508,12 +537,24 @@ static bool is_debugger_present()
+     // We're being debugged if the P_TRACED flag is set.
+ 
+     return (info.kp_proc.p_flag & P_TRACED) != 0;
++#elif defined(__FreeBSD__)
++    struct kinfo_proc info;
++    size_t size = sizeof(info);
++    int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() };
++
++    if (sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) == 
0)
++        return (info.ki_flag & P_TRACED) != 0;
++    else
++        perror("Failed to retrieve process info");
++    return false;
++#else
++    return false;
+ #endif
+ }
+ 
+ void crashCatcherInstall(int argc, char **argv, const std::string 
&crashLogPath)
+ {
+-    if ((argc == 2 && strcmp(argv[1], "--cc-handle-crash") == 0) || 
!is_debugger_present())
++    if ((argc == 2 && strcmp(argv[1], crash_switch) == 0) || 
!is_debugger_present())
+     {
+         int s[5] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGABRT };
+         if (crashCatcherInstallHandlers(argc, argv, 5, s, 
crashLogPath.c_str(), nullptr) == -1)
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/games/openmw/pkg/PLIST,v
retrieving revision 1.8
diff -u -p -u -r1.8 PLIST
--- pkg/PLIST   4 Sep 2018 12:46:13 -0000       1.8
+++ pkg/PLIST   24 Nov 2019 05:09:04 -0000
@@ -127,6 +127,8 @@ share/openmw/resources/shaders/lighting.
 share/openmw/resources/shaders/objects_fragment.glsl
 share/openmw/resources/shaders/objects_vertex.glsl
 share/openmw/resources/shaders/parallax.glsl
+share/openmw/resources/shaders/s360_fragment.glsl
+share/openmw/resources/shaders/s360_vertex.glsl
 share/openmw/resources/shaders/terrain_fragment.glsl
 share/openmw/resources/shaders/terrain_vertex.glsl
 share/openmw/resources/shaders/water_fragment.glsl

Reply via email to