Re: unbreak games/supertux [Was: Re: games/supertux startup error]

2021-05-16 Thread Nam Nguyen
Nam Nguyen writes:

Ping. Diff is inline for convenience.

> Nam Nguyen writes:
>
>> Here is a diff for unbreaking games/supertux, which segfaults on
>> startup. I opened an issue explaining the bug here:
>> https://github.com/SuperTux/supertux/issues/1726
>
> Here is a fresh diff for games/supertux 0.6.2, released on May 14,
> 2020.
>
> Changelogs:
> https://github.com/SuperTux/supertux/releases/tag/v0.6.2
> https://github.com/SuperTux/supertux/releases/tag/v0.6.1
>
> This diff:
> - updates to 0.6.2
> - backports proper fix for out-of-bounds memory read. see:
>   
> https://github.com/SuperTux/supertux/commit/e1b89118f370f8a2ab8703ae98f5e3e9c3f4387d
>   
> https://github.com/SuperTux/supertux/commit/1241e3361dd8443306fe37eae7de6badaf8c3aef
> - does not use fixed tux-statue.png
>   
> https://github.com/SuperTux/supertux/commit/20eae9e21f42c46e8c336dd8394cbf86249405a0
>
>>
>> I bisected and found a commit from 2.0.10 that caused this segfault:
>> https://github.com/libsdl-org/SDL/commit/670f3d3327912b299e8e5ea9de4f01bd833414cc
>>
>> It reads out of bounds memory due to usage of SIMD functions since SDL
>> 2.0.10. My workaround is to make the resolution larger for the affected
>> image. I get the same backtrace on startup.
>>
>> Tests and feedback are welcome. OK? I would like to get this in to
>> unbreak games/supertux, but it is almost ports lock.
>
> To display FPS in the terminal:
> $ LIBGL_SHOW_FPS=1 supertux2
>
> I found some quirks while testing:
> - level music will eventually stop looping. restarting level in the menu
>   fixes this.
> - performance stays at 60 FPS most of the time
> - ps4 controller works with right analog stick used to pan the camera
>   (equivalent to home/end/pgdn/pgup)
> - Performance randomly drops sometimes to 40 fps after I get killed or
>   switch window focus. It eventually recovers. Fullscreen seems to give
>   more stable framerate. This is likely due to other processes running, as
>   noticed in top(1).
>
> This is for after ports-unlock. As suggested by sthen@ I would like to
> commit to -stable at that time.
>
> I received OK pascal@ for previous workaround diff:
> Pascal Stumpf writes:
>
>> This is working for me.  OK.
>
> Feedback and tests are welcome. Previously, Marcus MERIGHI and pascal@
> tested the workaround diff. OK?

Index: Makefile
===
RCS file: /cvs/ports/games/supertux/Makefile,v
retrieving revision 1.23
diff -u -p -u -p -r1.23 Makefile
--- Makefile25 Feb 2021 22:26:02 -  1.23
+++ Makefile20 Apr 2021 00:46:35 -
@@ -2,10 +2,9 @@
 
 COMMENT =  jump 'n' run game
 
-V =0.6.0
+V =0.6.2
 DISTNAME = SuperTux-v${V}-Source
 PKGNAME =  supertux-$V
-REVISION = 2
 
 CATEGORIES =   games
 
Index: distinfo
===
RCS file: /cvs/ports/games/supertux/distinfo,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 distinfo
--- distinfo4 Feb 2019 10:02:07 -   1.4
+++ distinfo20 Apr 2021 00:46:35 -
@@ -1,2 +1,2 @@
-SHA256 (SuperTux-v0.6.0-Source.tar.gz) = 
xMPl+m+Q6HuMWtayKheempg5v5l+fyGeIrvNHJciOsA=
-SIZE (SuperTux-v0.6.0-Source.tar.gz) = 131203604
+SHA256 (SuperTux-v0.6.2-Source.tar.gz) = 
JqnlbqLShBSISfMjkXfXd92ltnWhCrLXbuZYVMkf9Zg=
+SIZE (SuperTux-v0.6.2-Source.tar.gz) = 174295862
Index: patches/patch-CMakeLists_txt
===
RCS file: /cvs/ports/games/supertux/patches/patch-CMakeLists_txt,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 patch-CMakeLists_txt
--- patches/patch-CMakeLists_txt4 Feb 2019 10:02:07 -   1.4
+++ patches/patch-CMakeLists_txt20 Apr 2021 00:46:35 -
@@ -11,7 +11,7 @@ Index: CMakeLists.txt
  
  set(BUILD_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data")
  set(BUILD_CONFIG_DATA_DIR "${CMAKE_BINARY_DIR}/data")
-@@ -249,7 +249,8 @@ if(NOT USE_SYSTEM_PHYSFS)
+@@ -256,7 +256,8 @@ if(NOT USE_SYSTEM_PHYSFS)
  -DLIB_SUFFIX=${LIB_SUFFIX}
  -DPHYSFS_BUILD_SHARED=${PHYSFS_BUILD_SHARED}
  -DPHYSFS_BUILD_STATIC=${PHYSFS_BUILD_STATIC}
@@ -21,7 +21,7 @@ Index: CMakeLists.txt
  
if(WIN32)
  add_library(physfs_lib SHARED IMPORTED)
-@@ -392,7 +393,9 @@ ExternalProject_Add(squirrel
+@@ -404,7 +405,9 @@ ExternalProject_Add(squirrel
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_INSTALL_PREFIX=${SQUIRREL_PREFIX}
@@ -32,7 +32,7 @@ Index: CMakeLists.txt
  
  if(WIN32)
add_library(squirrel_lib SHARED IMPORTED)
-@@ -435,7 +438,8 @@ ExternalProject_Add(tinygettext
+@@ -454,7 +457,8 @@ ExternalProject_Add(tinygettext
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DSDL2_LIBRARIES=${SDL2_LIBRARIES}
-DSDL2_INCLUDE_DIRS=${SDL2_INCLUDE_DIRS}
@@ -42,7 +42,7 @@ Index: CMakeLists.txt
  
  add_library(tinygettext_lib STATIC IMPORTED)
  

Re: unbreak games/supertux [Was: Re: games/supertux startup error]

2021-04-19 Thread Nam Nguyen
Nam Nguyen writes:

> Here is a diff for unbreaking games/supertux, which segfaults on
> startup. I opened an issue explaining the bug here:
> https://github.com/SuperTux/supertux/issues/1726

Here is a fresh diff for games/supertux 0.6.2, released on May 14,
2020.

Changelogs:
https://github.com/SuperTux/supertux/releases/tag/v0.6.2
https://github.com/SuperTux/supertux/releases/tag/v0.6.1

This diff:
- updates to 0.6.2
- backports proper fix for out-of-bounds memory read. see:
  
https://github.com/SuperTux/supertux/commit/e1b89118f370f8a2ab8703ae98f5e3e9c3f4387d
  
https://github.com/SuperTux/supertux/commit/1241e3361dd8443306fe37eae7de6badaf8c3aef
- does not use fixed tux-statue.png
  
https://github.com/SuperTux/supertux/commit/20eae9e21f42c46e8c336dd8394cbf86249405a0

>
> I bisected and found a commit from 2.0.10 that caused this segfault:
> https://github.com/libsdl-org/SDL/commit/670f3d3327912b299e8e5ea9de4f01bd833414cc
>
> It reads out of bounds memory due to usage of SIMD functions since SDL
> 2.0.10. My workaround is to make the resolution larger for the affected
> image. I get the same backtrace on startup.
>
> Tests and feedback are welcome. OK? I would like to get this in to
> unbreak games/supertux, but it is almost ports lock.

To display FPS in the terminal:
$ LIBGL_SHOW_FPS=1 supertux2

I found some quirks while testing:
- level music will eventually stop looping. restarting level in the menu
  fixes this.
- performance stays at 60 FPS most of the time
- ps4 controller works with right analog stick used to pan the camera
  (equivalent to home/end/pgdn/pgup)
- Performance randomly drops sometimes to 40 fps after I get killed or
  switch window focus. It eventually recovers. Fullscreen seems to give
  more stable framerate. This is likely due to other processes running, as
  noticed in top(1).

This is for after ports-unlock. As suggested by sthen@ I would like to
commit to -stable at that time.

I received OK pascal@ for previous workaround diff:
Pascal Stumpf writes:

> This is working for me.  OK.

Feedback and tests are welcome. Previously, Marcus MERIGHI and pascal@
tested the workaround diff. OK?

Index: Makefile
===
RCS file: /cvs/ports/games/supertux/Makefile,v
retrieving revision 1.23
diff -u -p -u -p -r1.23 Makefile
--- Makefile25 Feb 2021 22:26:02 -  1.23
+++ Makefile20 Apr 2021 00:46:35 -
@@ -2,10 +2,9 @@
 
 COMMENT =  jump 'n' run game
 
-V =0.6.0
+V =0.6.2
 DISTNAME = SuperTux-v${V}-Source
 PKGNAME =  supertux-$V
-REVISION = 2
 
 CATEGORIES =   games
 
Index: distinfo
===
RCS file: /cvs/ports/games/supertux/distinfo,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 distinfo
--- distinfo4 Feb 2019 10:02:07 -   1.4
+++ distinfo20 Apr 2021 00:46:35 -
@@ -1,2 +1,2 @@
-SHA256 (SuperTux-v0.6.0-Source.tar.gz) = 
xMPl+m+Q6HuMWtayKheempg5v5l+fyGeIrvNHJciOsA=
-SIZE (SuperTux-v0.6.0-Source.tar.gz) = 131203604
+SHA256 (SuperTux-v0.6.2-Source.tar.gz) = 
JqnlbqLShBSISfMjkXfXd92ltnWhCrLXbuZYVMkf9Zg=
+SIZE (SuperTux-v0.6.2-Source.tar.gz) = 174295862
Index: patches/patch-CMakeLists_txt
===
RCS file: /cvs/ports/games/supertux/patches/patch-CMakeLists_txt,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 patch-CMakeLists_txt
--- patches/patch-CMakeLists_txt4 Feb 2019 10:02:07 -   1.4
+++ patches/patch-CMakeLists_txt20 Apr 2021 00:46:35 -
@@ -11,7 +11,7 @@ Index: CMakeLists.txt
  
  set(BUILD_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data")
  set(BUILD_CONFIG_DATA_DIR "${CMAKE_BINARY_DIR}/data")
-@@ -249,7 +249,8 @@ if(NOT USE_SYSTEM_PHYSFS)
+@@ -256,7 +256,8 @@ if(NOT USE_SYSTEM_PHYSFS)
  -DLIB_SUFFIX=${LIB_SUFFIX}
  -DPHYSFS_BUILD_SHARED=${PHYSFS_BUILD_SHARED}
  -DPHYSFS_BUILD_STATIC=${PHYSFS_BUILD_STATIC}
@@ -21,7 +21,7 @@ Index: CMakeLists.txt
  
if(WIN32)
  add_library(physfs_lib SHARED IMPORTED)
-@@ -392,7 +393,9 @@ ExternalProject_Add(squirrel
+@@ -404,7 +405,9 @@ ExternalProject_Add(squirrel
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_INSTALL_PREFIX=${SQUIRREL_PREFIX}
@@ -32,7 +32,7 @@ Index: CMakeLists.txt
  
  if(WIN32)
add_library(squirrel_lib SHARED IMPORTED)
-@@ -435,7 +438,8 @@ ExternalProject_Add(tinygettext
+@@ -454,7 +457,8 @@ ExternalProject_Add(tinygettext
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DSDL2_LIBRARIES=${SDL2_LIBRARIES}
-DSDL2_INCLUDE_DIRS=${SDL2_INCLUDE_DIRS}
@@ -42,7 +42,7 @@ Index: CMakeLists.txt
  
  add_library(tinygettext_lib STATIC IMPORTED)
  set_target_properties(tinygettext_lib PROPERTIES IMPORTED_LOCATION 

Re: unbreak games/supertux [Was: Re: games/supertux startup error]

2021-04-18 Thread Marcus MERIGHI
Hello!

Works for me, thank you!

I removed sthen@'s patches by removing games/supertux and running "cvs
up". Then I applied your patch and 
"make PKG_CREATE_NO_CHECKS=Yes package" 
got me a working package.

Marcus

n...@berkeley.edu (Nam Nguyen), 2021.04.17 (Sat) 15:08 (CEST):
> Here is a diff for unbreaking games/supertux, which segfaults on
> startup. I opened an issue explaining the bug here:
> https://github.com/SuperTux/supertux/issues/1726
> 
> I bisected and found a commit from 2.0.10 that caused this segfault:
> https://github.com/libsdl-org/SDL/commit/670f3d3327912b299e8e5ea9de4f01bd833414cc
> 
> It reads out of bounds memory due to usage of SIMD functions since SDL
> 2.0.10. My workaround is to make the resolution larger for the affected
> image. I get the same backtrace on startup.
> 
> Tests and feedback are welcome. OK? I would like to get this in to
> unbreak games/supertux, but it is almost ports lock.
> 
> Index: Makefile
> ===
> RCS file: /cvs/ports/games/supertux/Makefile,v
> retrieving revision 1.23
> diff -u -p -u -p -r1.23 Makefile
> --- Makefile  25 Feb 2021 22:26:02 -  1.23
> +++ Makefile  17 Apr 2021 12:34:44 -
> @@ -5,7 +5,10 @@ COMMENT =jump 'n' run game
>  V =  0.6.0
>  DISTNAME =   SuperTux-v${V}-Source
>  PKGNAME =supertux-$V
> -REVISION =   2
> +REVISION =   3
> +
> +DISTFILES += ${DISTNAME}${EXTRACT_SUFX}
> +DISTFILES += tux-statue${EXTRACT_SUFX}:0
>  
>  CATEGORIES = games
>  
> @@ -22,6 +25,7 @@ WANTLIB += c curl freetype m ogg openal 
>  WANTLIB += z
>  
>  MASTER_SITES =   
> https://github.com/SuperTux/supertux/releases/download/v${V}/
> +MASTER_SITES0 =  https://namtsui.com/source/
>  
>  FIX_CRLF_FILES = external/squirrel/CMakeLists.txt
>  
> @@ -46,5 +50,7 @@ NO_TEST =   Yes
>  
>  pre-configure:
>   ${SUBST_CMD} ${WRKSRC}/src/supertux/main.cpp
> +# fixes segfault. see: https://github.com/SuperTux/supertux/issues/1726
> + @mv ${WRKDIR}/tux-statue.png ${WRKSRC}/data/images/tiles/doodads
>  
>  .include 
> Index: distinfo
> ===
> RCS file: /cvs/ports/games/supertux/distinfo,v
> retrieving revision 1.4
> diff -u -p -u -p -r1.4 distinfo
> --- distinfo  4 Feb 2019 10:02:07 -   1.4
> +++ distinfo  17 Apr 2021 12:34:44 -
> @@ -1,2 +1,4 @@
>  SHA256 (SuperTux-v0.6.0-Source.tar.gz) = 
> xMPl+m+Q6HuMWtayKheempg5v5l+fyGeIrvNHJciOsA=
> +SHA256 (tux-statue.tar.gz) = pklNyse27KSCvf8xR41Y4DQ8OCJQu36Z2PtooYJ1Ad4=
>  SIZE (SuperTux-v0.6.0-Source.tar.gz) = 131203604
> +SIZE (tux-statue.tar.gz) = 10385
> 



Re: unbreak games/supertux [Was: Re: games/supertux startup error]

2021-04-17 Thread Mikolaj Kucharski
On Sat, Apr 17, 2021 at 06:08:39AM -0700, Nam Nguyen wrote:
> --- distinfo  4 Feb 2019 10:02:07 -   1.4
> +++ distinfo  17 Apr 2021 12:34:44 -
> @@ -1,2 +1,4 @@
>  SHA256 (SuperTux-v0.6.0-Source.tar.gz) = 
> xMPl+m+Q6HuMWtayKheempg5v5l+fyGeIrvNHJciOsA=
> +SHA256 (tux-statue.tar.gz) = pklNyse27KSCvf8xR41Y4DQ8OCJQu36Z2PtooYJ1Ad4=
>  SIZE (SuperTux-v0.6.0-Source.tar.gz) = 131203604
> +SIZE (tux-statue.tar.gz) = 10385

I would make this filename more unique with a date, version
number or an ID of GitHub issue.

-- 
Regards,
 Mikolaj



unbreak games/supertux [Was: Re: games/supertux startup error]

2021-04-17 Thread Nam Nguyen
Here is a diff for unbreaking games/supertux, which segfaults on
startup. I opened an issue explaining the bug here:
https://github.com/SuperTux/supertux/issues/1726

I bisected and found a commit from 2.0.10 that caused this segfault:
https://github.com/libsdl-org/SDL/commit/670f3d3327912b299e8e5ea9de4f01bd833414cc

It reads out of bounds memory due to usage of SIMD functions since SDL
2.0.10. My workaround is to make the resolution larger for the affected
image. I get the same backtrace on startup.

Tests and feedback are welcome. OK? I would like to get this in to
unbreak games/supertux, but it is almost ports lock.

Index: Makefile
===
RCS file: /cvs/ports/games/supertux/Makefile,v
retrieving revision 1.23
diff -u -p -u -p -r1.23 Makefile
--- Makefile25 Feb 2021 22:26:02 -  1.23
+++ Makefile17 Apr 2021 12:34:44 -
@@ -5,7 +5,10 @@ COMMENT =  jump 'n' run game
 V =0.6.0
 DISTNAME = SuperTux-v${V}-Source
 PKGNAME =  supertux-$V
-REVISION = 2
+REVISION = 3
+
+DISTFILES +=   ${DISTNAME}${EXTRACT_SUFX}
+DISTFILES +=   tux-statue${EXTRACT_SUFX}:0
 
 CATEGORIES =   games
 
@@ -22,6 +25,7 @@ WANTLIB += c curl freetype m ogg openal 
 WANTLIB += z
 
 MASTER_SITES = 
https://github.com/SuperTux/supertux/releases/download/v${V}/
+MASTER_SITES0 =https://namtsui.com/source/
 
 FIX_CRLF_FILES =   external/squirrel/CMakeLists.txt
 
@@ -46,5 +50,7 @@ NO_TEST = Yes
 
 pre-configure:
${SUBST_CMD} ${WRKSRC}/src/supertux/main.cpp
+# fixes segfault. see: https://github.com/SuperTux/supertux/issues/1726
+   @mv ${WRKDIR}/tux-statue.png ${WRKSRC}/data/images/tiles/doodads
 
 .include 
Index: distinfo
===
RCS file: /cvs/ports/games/supertux/distinfo,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 distinfo
--- distinfo4 Feb 2019 10:02:07 -   1.4
+++ distinfo17 Apr 2021 12:34:44 -
@@ -1,2 +1,4 @@
 SHA256 (SuperTux-v0.6.0-Source.tar.gz) = 
xMPl+m+Q6HuMWtayKheempg5v5l+fyGeIrvNHJciOsA=
+SHA256 (tux-statue.tar.gz) = pklNyse27KSCvf8xR41Y4DQ8OCJQu36Z2PtooYJ1Ad4=
 SIZE (SuperTux-v0.6.0-Source.tar.gz) = 131203604
+SIZE (tux-statue.tar.gz) = 10385