On Fri, 5 Apr 2019 15:55:03 +0200
Charlene Wendling <[email protected]> wrote:

> Here is a diff that fixes it on amd64, i can't test on macppc
> at the moment as it's building x11/qt4.

sthen@ committed the diff as supertux-0.6.0p1.  I built it on amd64.
I believe that it fixes the PREFIX error but not the /usr/obj error,
so I now propose a second diff.

The /usr/obj error happens with the snapshot package (0.6.0p0).  It
doesn't happen with my own build of 0.6.0p1.  It does happen with my
own build if I do this:

    opa$ doas chmod -x /usr/ports/pobj
    opa$ supertux2                                                              
   
    [FATAL] /usr/ports/pobj/supertux-0.6.0/SuperTux-v0.6.0-Source/src/
    supertux/main.cpp:601 Unexpected exception: boost::filesystem::sta
    tus: Permission denied: "/usr/ports/pobj/supertux-0.6.0/SuperTux-v
    0.6.0-Source/data/credits.stxt"

The error from the snapshot package was,

    opa$ supertux2
    [FATAL] /usr/obj/ports/supertux-0.6.0/SuperTux-v0.6.0-Source/src/s
    upertux/main.cpp:601 Unexpected exception: boost::filesystem::stat
    us: Permission denied: "/usr/obj/ports/supertux-0.6.0/SuperTux-v0.
    6.0-Source/data/credits.stxt"

This is my guess: SuperTux looks for its data files in its source
directory.  If credits.stxt doesn't exist there, then SuperTux tries
the installed data files.  When I build SuperTux, the source directory
is in /usr/ports/pobj (_pbuild:_pbuild u=rwx,g=rx,o=rx ), where any
user can enter and check if credits.stxt exists.  When I use the
snapshot package, the source directory is in /usr/obj (build:wobj
u=rwx,g=rwx,o= ), where most users can't enter.

Hours ago, I opened this pull request to ignore "Permission denied":
https://github.com/SuperTux/supertux/pull/1085

Here is the same as a ports diff:

Index: Makefile
===================================================================
RCS file: /cvs/ports/games/supertux/Makefile,v
retrieving revision 1.20
diff -u -p -r1.20 Makefile
--- Makefile    5 Apr 2019 08:07:23 -0000       1.20
+++ Makefile    6 Apr 2019 03:58:20 -0000
@@ -5,7 +5,7 @@ COMMENT =               jump 'n' run game
 V =                    0.6.0
 DISTNAME =             SuperTux-v${V}-Source
 PKGNAME =              supertux-$V
-REVISION =             1
+REVISION =             2
 
 CATEGORIES =           games
 
Index: patches/patch-src_util_file_system_cpp
===================================================================
RCS file: patches/patch-src_util_file_system_cpp
diff -N patches/patch-src_util_file_system_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_util_file_system_cpp      6 Apr 2019 03:58:20 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+Prevent fatal error "Permission denied" when SuperTux checks for its
+source directory, so it can switch to the installed data files.
+
+https://github.com/SuperTux/supertux/pull/1085
+
+Index: src/util/file_system.cpp
+--- src/util/file_system.cpp.orig
++++ src/util/file_system.cpp
+@@ -39,8 +39,11 @@ namespace FileSystem {
+ bool exists(const std::string& path)
+ {
+   fs::path location(path);
++  boost::system::error_code ec;
+ 
+-  return fs::exists(location);
++  // If we get an error (such as "Permission denied"), then ignore it
++  // and pretend that the path doesn't exist.
++  return fs::exists(location, ec);
+ }
+ 
+ bool is_directory(const std::string& path)

Reply via email to