Index | Thread | Search

From:
Thomas Frohwein <tfrohwein@fastmail.com>
Subject:
Re: 0ad: double datasize to avoid crashes
To:
Klemens Nanni <kn@openbsd.org>
Cc:
ports@openbsd.org
Date:
Mon, 20 May 2024 21:41:19 -0400

Download raw body.

Thread
On Mon, May 20, 2024 at 09:33:25PM +0000, Klemens Nanni wrote:
> 20.05.2024 00:13, Thomas Frohwein пишет:
> > Can we do the same check for -lt like with chromium? The reason is that
> > I don't think the datasize should be reduced if the user has set it
> > higher than the 2G.
> 
> Ah yes, of course.
> OK kn if you want to commit that with op's '0.A.D.' -> '0 A.D.' fix,
> otherwise I can do that in a few days (given OKs).
> 
> Thanks.

I went ahead and committed it.

> > As in this counter diff:
> > 
> > Index: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/games/0ad/base/Makefile,v
> > retrieving revision 1.51
> > diff -u -p -r1.51 Makefile
> > --- Makefile	6 May 2024 12:23:33 -0000	1.51
> > +++ Makefile	19 May 2024 21:12:33 -0000
> > @@ -2,7 +2,7 @@ COMMENT =		historical real-time strategy
> >  
> >  DISTNAME =		0ad-${V}-alpha-unix-build
> >  PKGNAME =		0ad-${V}
> > -REVISION =		6
> > +REVISION =		7
> >  
> >  USE_WXNEEDED =		Yes
> >  USE_NOBTCFI =		Yes
> > @@ -105,7 +105,7 @@ do-install:
> >  	cp -R ${WRKDIST}/binaries/data/* ${PREFIX}/share/0ad
> >  	${INSTALL_DATA} ${WRKDIST}/binaries/system/lib* ${PREFIX}/lib
> >  	${INSTALL_PROGRAM} ${WRKDIST}/binaries/system/pyrogenesis ${PREFIX}/bin
> > -	${INSTALL_SCRIPT} ${WRKDIST}/build/resources/0ad.sh ${PREFIX}/bin/0ad
> > +	${SUBST_PROGRAM} ${WRKDIST}/build/resources/0ad.sh ${PREFIX}/bin/0ad
> >  	${INSTALL_DATA_DIR} ${PREFIX}/share/applications
> >  	${INSTALL_DATA} ${WRKDIST}/build/resources/0ad.desktop \
> >  		${PREFIX}/share/applications/
> > Index: patches/patch-build_resources_0ad_sh
> > ===================================================================
> > RCS file: patches/patch-build_resources_0ad_sh
> > diff -N patches/patch-build_resources_0ad_sh
> > --- /dev/null	1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-build_resources_0ad_sh	19 May 2024 21:12:33 -0000
> > @@ -0,0 +1,22 @@
> > +Try to crank datasize to 2G to avoid ENOMEM crashes during big games
> > +
> > +Index: build/resources/0ad.sh
> > +--- build/resources/0ad.sh.orig
> > ++++ build/resources/0ad.sh
> > +@@ -2,6 +2,16 @@
> > + 
> > + pyrogenesis=$(which pyrogenesis 2> /dev/null)
> > + if [ -x "$pyrogenesis" ] ; then
> > ++  DATASIZE=$((2 * 1024 * 1024))
> > ++  if [ $(ulimit -Sd) -lt ${DATASIZE} ]; then
> > ++    ulimit -Sd ${DATASIZE} || \
> > ++      ${X11BASE}/bin/xmessage -file - -center -buttons yes:0,no:1 -default no <<- _EOF
> > ++	Cannot increase datasize-cur to at least ${DATASIZE}
> > ++	Do you want to run 0.A.D. anyway?
> > ++	(If so, it may run out of memory and crash.)
> > ++	_EOF
> > ++    [ $? -eq 0 ] || exit
> > ++  fi
> > +   "$pyrogenesis" "$@"
> > + else
> > +   echo "Error: pyrogenesis not found in ($PATH)"
> > 
>