Spider crashes with a segfault in movelog.c in the record() function after grow_cache() is called from there the first time (i.e. when move_index reaches 50): record(from, dest, num_cards, exposed) int from, dest, num_cards; Bool exposed; { int val; val = 11 * ( 11 * ((exposed ? 1 : 0) * 14 + num_cards) + dest) + from; move_cache[move_index++] = val; if (move_index >= cache_size) grow_cache(); } So there has to be something weird happening in grow_cache(). Ive got no idea what it is. Usage of realloc() seems ok to me. :( grow_cache() { int *new; cache_size += CACHE_SIZE; new = (int *) realloc((char *)move_cache, (unsigned)(cache_size * sizeof(int))); if (new == (int *) NULL) { (void)fprintf(stderr,"realloc failed\n"); exit(-1); } move_cache = new; } As a dirty workaround, one could just increase the initial CACHE_SIZE.
Responsible Changed From-To: freebsd-ports-bugs->Pascal.Stumpf Submitter has GNATS access (via the GNATS Auto Assign Tool)
Responsible Changed From-To: Pascal.Stumpf->freebsd-ports-bugs Submitter mis-entered email address: fix.
Responsible Changed From-To: freebsd-ports-bugs->shaun Grab.
Forwarding to GNATS audit-trail. ----- Forwarded message from Pascal Stumpf <Pascal.Stumpf@cubes.de> ----- From: Pascal Stumpf <Pascal.Stumpf@cubes.de> Subject: [PATCH] ports/150287: Segfault: games/spider crashes after 51 moves To: freebsd-ports-bugs@freebsd.org Date: Tue, 7 Sep 2010 00:16:19 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.1-PRERELEASE; KDE/4.5.1; amd64; ; ) X-Spam-Level: * Ok, found the problem. The *alloc functions are declared in global.h. These declarations have been removed by a local patch which adds #ifndef __FreeBSD__, However, it has been forgotten to #include <stdlib.h> in those files that use any of the *alloc functions, which apparently leads to problems on amd64. I???ve patched all of these files just to be sure. (This includes the already existing patch for movelog.c) --- movelog.c.orig 1991-09-28 19:46:17.000000000 +0200 +++ movelog.c 2010-09-07 00:00:30.000000000 +0200 @@ -16,6 +16,7 @@ #include "defs.h" #include "globals.h" +#include <stdlib.h> #include <string.h> #include <sys/file.h> #include <ctype.h> @@ -33,6 +34,9 @@ extern int cheat_count; +static int card_to_int(CardPtr card); +static int restore_game(char *str, char *str2); + make_deck_cache() { CardPtr tmp; --- util.c.orig 2010-09-07 00:01:46.000000000 +0200 +++ util.c 2010-09-07 00:02:35.000000000 +0200 @@ -23,6 +23,7 @@ #include "xaw_ui.h" #endif /* XAW */ #include <ctype.h> +#include <stdlib.h> #include <string.h> #include <pwd.h> --- xv_stubs.c.orig 2010-09-07 00:01:59.000000000 +0200 +++ xv_stubs.c 2010-09-07 00:03:01.000000000 +0200 @@ -10,6 +10,7 @@ * @(#)xv_stubs.c 2.2 90/04/27 */ #include <stdio.h> +#include <stdlib.h> #include <X11/Xlib.h> #include <xview/xview.h> #include <xview/panel.h> --- xv_ui.c.orig 2010-09-07 00:02:12.000000000 +0200 +++ xv_ui.c 2010-09-07 00:03:29.000000000 +0200 @@ -16,6 +16,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <xview/xview.h> #include <xview/canvas.h> #include <xview/icon_load.h> --- gfx.c.orig 2010-09-07 00:01:08.000000000 +0200 +++ gfx.c 2010-09-07 00:01:25.000000000 +0200 @@ -15,6 +15,7 @@ */ #include "defs.h" #include "globals.h" +#include <stdlib.h> #ifdef ROUND_CARDS #include <X11/Xmu/Drawing.h> _______________________________________________ freebsd-ports-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs To unsubscribe, send any mail to "freebsd-ports-bugs-unsubscribe@freebsd.org" ----- End forwarded message -----
Forwarding to GNATS audit trail. ----- Forwarded message from Pascal Stumpf <Pascal.Stumpf@cubes.de> ----- From: Pascal Stumpf <Pascal.Stumpf@cubes.de> Subject: [PATCH No. 2] ports/150287: Segfault: games/spider crashes after 51 moves To: freebsd-ports-bugs@freebsd.org Date: Tue, 7 Sep 2010 00:37:51 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.1-PRERELEASE; KDE/4.5.1; amd64; ; ) X-Spam-Level: * Ok; while we???re here, we can do some more cleanup. :-) --- spider.c.orig 2010-09-07 00:00:48.000000000 +0200 +++ spider.c 2010-09-07 00:22:34.000000000 +0200 @@ -17,6 +17,7 @@ #include "defs.h" #include "globals.h" #include <ctype.h> +#include <stdlib.h> static void fix_coords(); @@ -619,7 +620,7 @@ return (type_names[type]); } -#endif DEBUG +#endif /* DEBUG */ /* --- movelog.c.orig 1991-09-28 19:46:17.000000000 +0200 +++ movelog.c 2010-09-07 00:00:30.000000000 +0200 @@ -16,6 +16,7 @@ #include "defs.h" #include "globals.h" +#include <stdlib.h> #include <string.h> #include <sys/file.h> #include <ctype.h> @@ -33,6 +34,9 @@ extern int cheat_count; +static int card_to_int(CardPtr card); +static int restore_game(char *str, char *str2); + make_deck_cache() { CardPtr tmp; --- gfx.c.orig 2010-09-07 00:01:08.000000000 +0200 +++ gfx.c 2010-09-07 00:21:23.000000000 +0200 @@ -15,6 +15,7 @@ */ #include "defs.h" #include "globals.h" +#include <stdlib.h> #ifdef ROUND_CARDS #include <X11/Xmu/Drawing.h> @@ -166,7 +167,7 @@ gcflags |= GCFont; textgc = XCreateGC(dpy, RootWindow(dpy, screen), gcflags, &gcv); -#endif KITLESS +#endif /* KITLESS */ tmpmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen), logo_bits, logo_width, logo_height); @@ -1321,7 +1322,7 @@ XDrawImageString(dpy, message_win, textgc, MESSAGE_X, message_y, last_message, strlen(last_message)); } -#endif KITLESS +#endif /* KITLESS */ void card_message(str, card) --- util.c.orig 2010-09-07 00:01:46.000000000 +0200 +++ util.c 2010-09-07 00:02:35.000000000 +0200 @@ -23,6 +23,7 @@ #include "xaw_ui.h" #endif /* XAW */ #include <ctype.h> +#include <stdlib.h> #include <string.h> #include <pwd.h> --- xv_stubs.c.orig 2010-09-07 00:01:59.000000000 +0200 +++ xv_stubs.c 2010-09-07 00:03:01.000000000 +0200 @@ -10,6 +10,7 @@ * @(#)xv_stubs.c 2.2 90/04/27 */ #include <stdio.h> +#include <stdlib.h> #include <X11/Xlib.h> #include <xview/xview.h> #include <xview/panel.h> --- xv_ui.c.orig 2010-09-07 00:02:12.000000000 +0200 +++ xv_ui.c 2010-09-07 00:03:29.000000000 +0200 @@ -16,6 +16,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <xview/xview.h> #include <xview/canvas.h> #include <xview/icon_load.h> --- defs.h.orig 2010-09-07 00:19:00.000000000 +0200 +++ defs.h 2010-09-07 00:20:09.000000000 +0200 @@ -31,7 +31,7 @@ typedef enum {Faceup, Facedown, Joker} Type; -#else DEBUG +#else /* DEBUG */ typedef char Suit; typedef char Rank; @@ -60,7 +60,7 @@ #define Facedown 1 #define Joker 2 -#endif DEBUG +#endif /* DEBUG */ #define NUM_DECKS 2 #define NUM_PILES 8 --- globals.h.orig 2010-09-07 00:21:42.000000000 +0200 +++ globals.h 2010-09-07 00:22:04.000000000 +0200 @@ -90,7 +90,7 @@ void button_press(); void button_release(); void do_expand(); -#endif KITLESS +#endif /* KITLESS */ #ifdef XAW Bool can_get_help_files(); --- windows.c.orig 2010-09-07 00:23:35.000000000 +0200 +++ windows.c 2010-09-07 00:24:05.000000000 +0200 @@ -116,7 +116,7 @@ XMapWindow(dpy, message_win); XMapWindow(dpy, table); } -#endif KITLESS +#endif /* KITLESS */ #ifndef KITLESS table_init(win) @@ -140,4 +140,4 @@ } XChangeWindowAttributes(dpy, table, winmask, &winattr); } -#endif KITLESS +#endif /* KITLESS */ --- events.c.orig 2010-09-07 00:24:57.000000000 +0200 +++ events.c 2010-09-07 00:26:21.000000000 +0200 @@ -16,6 +16,7 @@ #include "defs.h" #include "globals.h" +#include <stdlib.h> extern int cheat_count; --- xaw_ui.c.orig 2010-09-07 00:27:06.000000000 +0200 +++ xaw_ui.c 2010-09-07 00:27:28.000000000 +0200 @@ -19,6 +19,7 @@ #include "xaw_ui.h" #include "spider.bm" +#include <stdlib.h> static XtAppContext spider_con; Widget toplevel; _______________________________________________ freebsd-ports-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs To unsubscribe, send any mail to "freebsd-ports-bugs-unsubscribe@freebsd.org" ----- End forwarded message -----
It=E2=80=99s been almost two months now. Can someone please commit the patc= h?=20 Spider is broken on amd64 without it.
Responsible Changed From-To: shaun->freebsd-ports-bugs Let someone else handle this.
Responsible Changed From-To: freebsd-ports-bugs->stephen This port seems to have lnaguished for a long time. I'll have a go at taking it.
State Changed From-To: open->feedback The committer has more questions for the submitter.
Dear Pascal, I am going to suggest this very simple patch. Simply replace spider/files/patch-ad with the attached file. I would test it, but I find that I am so unskilled at this game, that I am unable to get to 51 moves. So can you try it out? If it works, I'll go ahead and commit it. Thanks, Stephen
On Thu, Jun 30, 2011 at 10:48:53PM -0500, Stephen Montgomery-Smith wrote: > Dear Pascal, > > I am going to suggest this very simple patch. Simply replace > spider/files/patch-ad with the attached file. > > I would test it, but I find that I am so unskilled at this game, > that I am unable to get to 51 moves. So can you try it out? If it > works, I'll go ahead and commit it. > > Thanks, Stephen Yes, works for me. Thanks! > --- globals.h.orig 1991-09-28 17:46:20.000000000 +0000 > +++ globals.h 2011-07-01 03:25:27.000000000 +0000 > @@ -96,6 +96,10 @@ > Bool can_get_help_files(); > #endif > > +#ifndef __FreeBSD__ > extern char *malloc(); > extern char *calloc(); > extern char *realloc(); > +#else > +#include <stdlib.h> > +#endif
State Changed From-To: feedback->closed Committed, thanks!
stephen 2011-07-06 05:18:35 UTC FreeBSD ports repository Modified files: games/spider Makefile games/spider/files patch-ad Log: - Fix segfault on amd64. - Bump portrevision. PR: ports/150287 Submitted by: Pascal Stumpf <Pascal.Stumpf@cubes.de> and Shaun Amott <shaun@FreeBSD.org> Approved by: maho (mentor) Revision Changes Path 1.16 +1 -1 ports/games/spider/Makefile 1.2 +5 -3 ports/games/spider/files/patch-ad _______________________________________________ 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"