Subject: pkg/8224: PR#5815 broke xcdplayer
To: None <gnats-bugs@gnats.netbsd.org>
From: chuck <chuck@test.research.att.com>
List: netbsd-bugs
Date: 08/18/1999 07:54:26
>Number:         8224
>Category:       pkg
>Synopsis:       PR#5815 broke xcdplayer
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager (NetBSD software packages system bug manager)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 18 07:50:01 1999
>Last-Modified:
>Originator:     chuck
>Organization:
attlabs
>Release:        1.4J (-current)
>Environment:
		1.4J/i386

>Description:
	garbled's (untested) 64-bit alpha fix in PR#5815 broke xcdplayer.
	the fix in 5815 uses string constants for default values in an
	XtResource array rather than pointers like it used to.  Xt expects
	pointers of the proper type... for example, for XtRFloat it
	expects a float*, not a char* (it is wrong, even if the char* 
	points to a string containing "187.0" ... it doesn't do anything 
	like an atof() so you end up getting garbage in your default value).

	on the i386 this corrupts the value of the boolean 
	app_data.display_timer and causes a core dump.   
	

>How-To-Repeat:
	compile xcdplayer from pkg.   hit play to get core dump.

>Fix:


*** top_setup.c_ORIG	Mon Aug  9 10:43:28 1999
--- top_setup.c	Mon Aug  9 10:50:39 1999
***************
*** 50,78 ****
  	{ "device", "Device", XtRString, sizeof(String), XtOffsetOf(AppData,device),
  		  XtRString, (caddr_t) NULL },
  	{ "debug", "Debug", XtRBoolean, sizeof(Boolean), XtOffsetOf(AppData,debug),
! 		  XtRBoolean, "False" },
  	{ "displayTimer", "DisplayTimer", XtRBoolean, sizeof(Boolean),
  		  XtOffsetOf(AppData,display_timer), XtRBoolean,
! 		  "True" },
  	{ "volBase", "VolBase", XtRFloat, sizeof(float),
! 		  XtOffsetOf(AppData,volbase), XtRFloat, "187.0" },
  	{ "volPcent", "VolPcent", XtRFloat, sizeof(float),
! 		  XtOffsetOf(AppData,volpcent), XtRFloat, ".267" },
  	{ "replayThreshold", "replayThreshold", XtRInt, sizeof(int),
  		  XtOffsetOf(AppData,replayThreshold), XtRInt, 
! 		  "4" },
  	{ "scanSkipInterval", "scanSkipInterval", XtRInt, sizeof(int),
  		  XtOffsetOf(AppData,scanSkipInterval), XtRInt, 
! 		  "1" },
  	{ "scanPauseInterval", "scanPauseInterval", XtRFloat, sizeof(float),
  		  XtOffsetOf(AppData,scanPauseInterval), XtRFloat, 
! 		  ".062" },
  	{ "pauseSkipInterval", "pauseSkipInterval", XtRInt, sizeof(int),
  		  XtOffsetOf(AppData,pauseSkipInterval), XtRInt, 
! 		  "15" },
  	{ "pausePauseInterval", "pausePauseInterval", XtRFloat, sizeof(float),
  		  XtOffsetOf(AppData,pausePauseInterval), XtRFloat, 
! 		  ".500" },
  	{ "cdInfoDir", "cdInfoDir", XtRString, sizeof(String), 
  		  XtOffsetOf(AppData,cdInfoDir), XtRString, (caddr_t) NULL },
  };
--- 50,78 ----
  	{ "device", "Device", XtRString, sizeof(String), XtOffsetOf(AppData,device),
  		  XtRString, (caddr_t) NULL },
  	{ "debug", "Debug", XtRBoolean, sizeof(Boolean), XtOffsetOf(AppData,debug),
! 		  XtRBoolean, &app_data.debug },
  	{ "displayTimer", "DisplayTimer", XtRBoolean, sizeof(Boolean),
  		  XtOffsetOf(AppData,display_timer), XtRBoolean,
! 		  &app_data.display_timer },
  	{ "volBase", "VolBase", XtRFloat, sizeof(float),
! 		  XtOffsetOf(AppData,volbase), XtRFloat, &app_data.volbase },
  	{ "volPcent", "VolPcent", XtRFloat, sizeof(float),
! 		  XtOffsetOf(AppData,volpcent), XtRFloat, &app_data.volpcent },
  	{ "replayThreshold", "replayThreshold", XtRInt, sizeof(int),
  		  XtOffsetOf(AppData,replayThreshold), XtRInt, 
! 		  &app_data.replayThreshold },
  	{ "scanSkipInterval", "scanSkipInterval", XtRInt, sizeof(int),
  		  XtOffsetOf(AppData,scanSkipInterval), XtRInt, 
! 		  &app_data.scanSkipInterval },
  	{ "scanPauseInterval", "scanPauseInterval", XtRFloat, sizeof(float),
  		  XtOffsetOf(AppData,scanPauseInterval), XtRFloat, 
! 		  &app_data.scanPauseInterval },
  	{ "pauseSkipInterval", "pauseSkipInterval", XtRInt, sizeof(int),
  		  XtOffsetOf(AppData,pauseSkipInterval), XtRInt, 
! 		  &app_data.pauseSkipInterval },
  	{ "pausePauseInterval", "pausePauseInterval", XtRFloat, sizeof(float),
  		  XtOffsetOf(AppData,pausePauseInterval), XtRFloat, 
! 		  &app_data.scanPauseInterval },
  	{ "cdInfoDir", "cdInfoDir", XtRString, sizeof(String), 
  		  XtOffsetOf(AppData,cdInfoDir), XtRString, (caddr_t) NULL },
  };
***************
*** 87,92 ****
--- 87,106 ----
  	Pixmap		icon_pixmap;
  	Arg		arg;
  	char		*s;
+ 
+ 	/*
+ 	 * set default values
+ 	 */
+ 
+ 	app_data.debug = False;
+ 	app_data.display_timer = True;
+ 	app_data.volbase = 187.0;
+ 	app_data.volpcent = 0.267;
+ 	app_data.replayThreshold = 4;
+ 	app_data.pauseSkipInterval = 15;
+ 	app_data.scanSkipInterval = 1;
+ 	app_data.scanPauseInterval = 0.062;
+ 	app_data.pausePauseInterval = 0.500;
  
  	XtToolkitInitialize();
  
>Audit-Trail:
>Unformatted: