Bug 142886

Summary: [maintainer-update] games/ioquake3 (backport VM patch)
Product: Ports & Packages Reporter: kamikaze
Component: Individual Port(s)Assignee: Dmitry Marakasov <amdmi3>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description kamikaze 2010-01-16 17:30:01 UTC
The ioq3 1.36 release contains a 64bit bug in its VM code, which causes it to crash on all non-GNU platforms (unless playing with native libraries, which is not recommended):
http://lists.ioquake.org/htdig.cgi/ioquake3-ioquake.org/2010-January/003760.html

This update backports the patch from SVN r1772.

I'm sorry for updating so frequently, but I consider this a pretty fatal bug.

Fix: Patch attached with submission follows:
Comment 1 Dmitry Marakasov freebsd_committer freebsd_triage 2010-01-16 19:27:45 UTC
Responsible Changed
From-To: freebsd-ports-bugs->amdmi3

I'll take it.
Comment 2 kamikaze 2010-01-19 08:14:08 UTC
New version of the patch that takes care of build problems on the
FreeBSD 6 branch:
http://pointyhat.freebsd.org/errorlogs/i386-errorlogs/a.6.20100117082456/ioquake3-devel-1.36.s1771.log


diff -Nur ports/games/ioquake3.orig/Makefile ports/games/ioquake3/Makefile
--- ports/games/ioquake3.orig/Makefile	2010-01-16 13:43:31.000000000 +0100
+++ ports/games/ioquake3/Makefile	2010-01-16 13:49:38.000000000 +0100
@@ -7,7 +7,7 @@
 
 PORTNAME?=	ioquake3
 DISTVERSION?=	1.36
-PORTREVISION?=	1
+PORTREVISION?=	2
 CATEGORIES=	games
 MASTER_SITES?=	http://ioquake3.org/files/${DISTVERSION}/
 
diff -Nur ports/games/ioquake3.orig/files/patch-code-qcommon-vm_interpreted.c ports/games/ioquake3/files/patch-code-qcommon-vm_interpreted.c
--- ports/games/ioquake3.orig/files/patch-code-qcommon-vm_interpreted.c	1970-01-01 01:00:00.000000000 +0100
+++ ports/games/ioquake3/files/patch-code-qcommon-vm_interpreted.c	2010-01-16 15:55:45.000000000 +0100
@@ -0,0 +1,34 @@
+--- code/qcommon/vm_interpreted.c	2009/11/01 19:58:07	1717
++++ code/qcommon/vm_interpreted.c	2010/01/16 10:55:51	1772
+@@ -516,18 +516,20 @@
+ 
+ //VM_LogSyscalls( (int *)&image[ programStack + 4 ] );
+ 				{
+-					intptr_t* argptr = (intptr_t *)&image[ programStack + 4 ];
+-				#if __WORDSIZE == 64
+-				// the vm has ints on the stack, we expect
+-				// longs so we have to convert it
+-					intptr_t argarr[16];
+-					int i;
+-					for (i = 0; i < 16; ++i) {
+-						argarr[i] = *(int*)&image[ programStack + 4 + 4*i ];
++					// the vm has ints on the stack, we expect
++					// pointers so we might have to convert it
++					if (sizeof(intptr_t) != sizeof(int)) {
++						intptr_t argarr[16];
++						int *imagePtr = (int *)&image[programStack];
++						int i;
++						for (i = 0; i < 16; ++i) {
++							argarr[i] = *(++imagePtr);
++						}
++						r = vm->systemCall( argarr );
++					} else {
++						intptr_t* argptr = (intptr_t *)&image[ programStack + 4 ];
++						r = vm->systemCall( argptr );
+ 					}
+-					argptr = argarr;
+-				#endif
+-					r = vm->systemCall( argptr );
+ 				}
+ 
+ #ifdef DEBUG_VM
diff -Nur ports/games/ioquake3.orig/pkg-message ports/games/ioquake3/pkg-message
--- ports/games/ioquake3.orig/pkg-message	2010-01-16 13:43:31.000000000 +0100
+++ ports/games/ioquake3/pkg-message	2010-01-16 17:58:54.000000000 +0100
@@ -1,14 +1,11 @@
 ==============================================================================
 
-The input devices are now handled by SDL. Some mouse buttons will have
-different aliases and the mouse speed needs to be readjusted.
+Should the game freeze when entering a match, try to change the value of
+com_zoneMegs (e.g. to 48).
 
 The configuration files are saved to ~/.ioquake3 instead of ~/.q3a because
 they have additional variables which would be removed if other engines
 overwrite them. But you can safely copy the original directory to the new one
 for the first time.
 
-Should you encounter freezes when playing a demo or single player game,
-rebuild without client libraries.
-
 ==============================================================================
diff -Nur ports/games/ioquake3-devel.orig/Makefile ports/games/ioquake3-devel/Makefile
--- ports/games/ioquake3-devel.orig/Makefile	2010-01-16 13:43:22.000000000 +0100
+++ ports/games/ioquake3-devel/Makefile	2010-01-16 13:49:19.000000000 +0100
@@ -17,7 +17,7 @@
 PLIST=		${.CURDIR}/../ioquake3/pkg-plist
 PATCHDIR=	${WRKDIR}/freebsd-patchset/
 
-SVNREVISION=	1771
+SVNREVISION=	1772
 BINSUFFIX=	-devel
 
 .include "${.CURDIR}/../ioquake3/Makefile"
diff -Nur ports/games/ioquake3-devel.orig/distinfo ports/games/ioquake3-devel/distinfo
--- ports/games/ioquake3-devel.orig/distinfo	2010-01-16 13:43:22.000000000 +0100
+++ ports/games/ioquake3-devel/distinfo	2010-01-19 09:09:50.000000000 +0100
@@ -1,3 +1,3 @@
-MD5 (ioquake3-devel-1.36_SVN1771.zip) = 651a912a4cebb68f33a9f7fc63a3ec0e
-SHA256 (ioquake3-devel-1.36_SVN1771.zip) = 75aecab911f880e19d319c9e508fc4495b1d53e22207fae26d0a1b436817b4d9
-SIZE (ioquake3-devel-1.36_SVN1771.zip) = 4927089
+MD5 (ioquake3-devel-1.36_SVN1772.zip) = ea23ffb0f6abd040d992338009dff4cf
+SHA256 (ioquake3-devel-1.36_SVN1772.zip) = 56b5ced7cd99d66c82b48257f8b7b44531769de6c2043cfb49067341003c8d38
+SIZE (ioquake3-devel-1.36_SVN1772.zip) = 4927184
diff -Nur ports/games/ioquake3-devel.orig/pkg-message ports/games/ioquake3-devel/pkg-message
--- ports/games/ioquake3-devel.orig/pkg-message	2010-01-16 13:43:22.000000000 +0100
+++ ports/games/ioquake3-devel/pkg-message	2010-01-16 18:00:50.000000000 +0100
@@ -1,6 +1,6 @@
 ==============================================================================
 
-Should you encounter freezes when playing a demo or single player game,
-rebuild without client libraries.
+Should the game freeze when entering a match, try to change the value of
+com_zoneMegs (e.g. to 48).
 
 ==============================================================================
Comment 3 kamikaze 2010-01-25 23:27:19 UTC
Updated patch because of ports/142123.


diff -Nur ports/games/ioquake3.orig/Makefile ports/games/ioquake3/Makefile
--- ports/games/ioquake3.orig/Makefile	2010-01-26 00:17:33.000000000 +0100
+++ ports/games/ioquake3/Makefile	2010-01-26 00:19:01.000000000 +0100
@@ -7,7 +7,7 @@
 
 PORTNAME?=	ioquake3
 DISTVERSION?=	1.36
-PORTREVISION?=	2
+PORTREVISION?=	3
 CATEGORIES=	games
 MASTER_SITES?=	http://ioquake3.org/files/${DISTVERSION}/
 
diff -Nur ports/games/ioquake3.orig/files/patch-code-qcommon-vm_interpreted.c ports/games/ioquake3/files/patch-code-qcommon-vm_interpreted.c
--- ports/games/ioquake3.orig/files/patch-code-qcommon-vm_interpreted.c	1970-01-01 01:00:00.000000000 +0100
+++ ports/games/ioquake3/files/patch-code-qcommon-vm_interpreted.c	2010-01-26 00:17:59.000000000 +0100
@@ -0,0 +1,34 @@
+--- code/qcommon/vm_interpreted.c	2009/11/01 19:58:07	1717
++++ code/qcommon/vm_interpreted.c	2010/01/16 10:55:51	1772
+@@ -516,18 +516,20 @@
+ 
+ //VM_LogSyscalls( (int *)&image[ programStack + 4 ] );
+ 				{
+-					intptr_t* argptr = (intptr_t *)&image[ programStack + 4 ];
+-				#if __WORDSIZE == 64
+-				// the vm has ints on the stack, we expect
+-				// longs so we have to convert it
+-					intptr_t argarr[16];
+-					int i;
+-					for (i = 0; i < 16; ++i) {
+-						argarr[i] = *(int*)&image[ programStack + 4 + 4*i ];
++					// the vm has ints on the stack, we expect
++					// pointers so we might have to convert it
++					if (sizeof(intptr_t) != sizeof(int)) {
++						intptr_t argarr[16];
++						int *imagePtr = (int *)&image[programStack];
++						int i;
++						for (i = 0; i < 16; ++i) {
++							argarr[i] = *(++imagePtr);
++						}
++						r = vm->systemCall( argarr );
++					} else {
++						intptr_t* argptr = (intptr_t *)&image[ programStack + 4 ];
++						r = vm->systemCall( argptr );
+ 					}
+-					argptr = argarr;
+-				#endif
+-					r = vm->systemCall( argptr );
+ 				}
+ 
+ #ifdef DEBUG_VM
diff -Nur ports/games/ioquake3.orig/pkg-message ports/games/ioquake3/pkg-message
--- ports/games/ioquake3.orig/pkg-message	2010-01-26 00:17:33.000000000 +0100
+++ ports/games/ioquake3/pkg-message	2010-01-26 00:17:59.000000000 +0100
@@ -1,14 +1,11 @@
 ==============================================================================
 
-The input devices are now handled by SDL. Some mouse buttons will have
-different aliases and the mouse speed needs to be readjusted.
+Should the game freeze when entering a match, try to change the value of
+com_zoneMegs (e.g. to 48).
 
 The configuration files are saved to ~/.ioquake3 instead of ~/.q3a because
 they have additional variables which would be removed if other engines
 overwrite them. But you can safely copy the original directory to the new one
 for the first time.
 
-Should you encounter freezes when playing a demo or single player game,
-rebuild without client libraries.
-
 ==============================================================================
diff -Nur ports/games/ioquake3-devel.orig/Makefile ports/games/ioquake3-devel/Makefile
--- ports/games/ioquake3-devel.orig/Makefile	2010-01-26 00:17:45.000000000 +0100
+++ ports/games/ioquake3-devel/Makefile	2010-01-26 00:17:59.000000000 +0100
@@ -17,7 +17,7 @@
 PLIST=		${.CURDIR}/../ioquake3/pkg-plist
 PATCHDIR=	${WRKDIR}/freebsd-patchset/
 
-SVNREVISION=	1771
+SVNREVISION=	1772
 BINSUFFIX=	-devel
 
 .include "${.CURDIR}/../ioquake3/Makefile"
diff -Nur ports/games/ioquake3-devel.orig/distinfo ports/games/ioquake3-devel/distinfo
--- ports/games/ioquake3-devel.orig/distinfo	2010-01-26 00:17:45.000000000 +0100
+++ ports/games/ioquake3-devel/distinfo	2010-01-26 00:17:59.000000000 +0100
@@ -1,3 +1,3 @@
-MD5 (ioquake3-devel-1.36_SVN1771.zip) = 651a912a4cebb68f33a9f7fc63a3ec0e
-SHA256 (ioquake3-devel-1.36_SVN1771.zip) = 75aecab911f880e19d319c9e508fc4495b1d53e22207fae26d0a1b436817b4d9
-SIZE (ioquake3-devel-1.36_SVN1771.zip) = 4927089
+MD5 (ioquake3-devel-1.36_SVN1772.zip) = ea23ffb0f6abd040d992338009dff4cf
+SHA256 (ioquake3-devel-1.36_SVN1772.zip) = 56b5ced7cd99d66c82b48257f8b7b44531769de6c2043cfb49067341003c8d38
+SIZE (ioquake3-devel-1.36_SVN1772.zip) = 4927184
diff -Nur ports/games/ioquake3-devel.orig/pkg-message ports/games/ioquake3-devel/pkg-message
--- ports/games/ioquake3-devel.orig/pkg-message	2010-01-26 00:17:45.000000000 +0100
+++ ports/games/ioquake3-devel/pkg-message	2010-01-26 00:17:59.000000000 +0100
@@ -1,6 +1,6 @@
 ==============================================================================
 
-Should you encounter freezes when playing a demo or single player game,
-rebuild without client libraries.
+Should the game freeze when entering a match, try to change the value of
+com_zoneMegs (e.g. to 48).
 
 ==============================================================================
Comment 4 dfilter service freebsd_committer freebsd_triage 2010-01-28 00:32:12 UTC
amdmi3      2010-01-28 00:31:58 UTC

  FreeBSD ports repository

  Modified files:
    games/ioquake3-devel Makefile distinfo pkg-message 
  Log:
  - Update to 1772
  
  PR:             142886
  Submitted by:   Dominic Fandrey <kamikaze@bsdforen.de> (maintainer)
  
  Revision  Changes    Path
  1.4       +1 -1      ports/games/ioquake3-devel/Makefile
  1.4       +3 -3      ports/games/ioquake3-devel/distinfo
  1.3       +2 -2      ports/games/ioquake3-devel/pkg-message
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 5 dfilter service freebsd_committer freebsd_triage 2010-01-28 00:32:22 UTC
amdmi3      2010-01-28 00:32:01 UTC

  FreeBSD ports repository

  Modified files:
    games/ioquake3       Makefile pkg-message 
  Added files:
    games/ioquake3/files patch-code-qcommon-vm_interpreted.c 
  Log:
  - Backport a patch to fixes crashes on 64bit systems
  
  PR:             142886
  Submitted by:   Dominic Fandrey <kamikaze@bsdforen.de> (maintainer)
  
  Revision  Changes    Path
  1.20      +1 -1      ports/games/ioquake3/Makefile
  1.1       +34 -0     ports/games/ioquake3/files/patch-code-qcommon-vm_interpreted.c (new)
  1.6       +2 -5      ports/games/ioquake3/pkg-message
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 6 Dmitry Marakasov freebsd_committer freebsd_triage 2010-01-28 00:32:31 UTC
State Changed
From-To: open->closed

Committed. Thanks!