Bug 71591 - audio/funktrackergold segfaults
Summary: audio/funktrackergold segfaults
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: markp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-11 15:30 UTC by Shawn K. Quinn
Modified: 2005-04-14 21:54 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shawn K. Quinn 2004-09-11 15:30:20 UTC
	Compiling audio/funktrackergold appears to work fine, but the program 
will segfault on startup.

Fix: 

Beyond my abilities, but I figured I'd at least make it known. This is
old and probably not well used in light of audio/cheesetracker being an
alternative. I hate to suggest this but it's possible this port is end-of-life.
How-To-Repeat: 	# cd /usr/ports/audio/funktrackergold ; make install ; funktrackergold

and wait for the inevitable. Do realize this is an i386-only port.
Comment 1 Simon Barner 2004-09-11 16:29:05 UTC
[ Maintainer Cc:ed ]
The reason for this is that getenv ("OSTYPE") returns NULL.

The following patch works around the problem (IMHO, OS detection at build
time is fine when a program build from the FreeBSD ports collection)

----- snip -----
--- funkgold_misc.c.orig	Sun Jun 21 08:26:46 1998
+++ funkgold_misc.c	Sat Sep 11 17:17:44 2004
@@ -30,22 +29,7 @@
 
 void get_environment(void)
 {
-  char *os_type = getenv("OSTYPE");
-  register int x;
-  char *os_tt[] = {
-    "Linux",
-    "FreeBSD"
-  };
-
-  for(x = 0;x < SO_TT_SIZE;x++)
-    if(strcmp(os_tt[x],os_type) == 0)
-      break;
-  switch(x)
-  {
-    case 0:  funk_info.funk_cpu_type = FKCPU_LINUX; break;
-    case 1:  funk_info.funk_cpu_type = FKCPU_FREEBSD; break;
-    default: funk_info.funk_cpu_type = FKCPU_UNKNOWN; break;
-  }
+    funk_info.funk_cpu_type = FKCPU_FREEBSD;
 }
 
 /***************************************************************************
----- snip -----

The more interesting point is why the following little C program fails
(please forgive me if I am overlooking something really stupid ;-)

(please note that this works fine for other environment variables like
HOME, PAGER, ...)

int main (int argc, char* argv[]) {
	char *os = (char*)getenv ("OSTYPE");
	printf ("%s\n", os);

	return 0;
}
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2004-09-11 20:38:53 UTC
Responsible Changed
From-To: freebsd-ports-bugs->markp

Over to maintainer.
Comment 3 Jean-Yves Lefort freebsd_committer 2005-04-14 21:54:04 UTC
State Changed
From-To: open->closed

Committed, thanks!