ports/69195: [PATCH] misc/wmweather+ causes FP exception (divide by zero) on -CURRENT boxes

Wille Harald harald.wille at students.jku.at
Sat Jul 24 09:40:28 UTC 2004


The following reply was made to PR ports/69195; it has been noted by GNATS.

From: Wille Harald <harald.wille at students.jku.at>
To: Volker Stolz <vs at freebsd.org>
Cc: freebsd-gnats-submit at freebsd.org, mhsin at mhsin.org,
	harald.wille at students.jku.at
Subject: Re: ports/69195: [PATCH] misc/wmweather+ causes FP exception (divide by zero) on -CURRENT boxes
Date: Sat, 24 Jul 2004 11:36:35 +0200

 --IS0zKkzwUGydFO0o
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Hello !
 
 First i apologize for the late review, but i had some ISP problems.
 
 NAN is only defined in math.h on -CURRENT, not on the 4.x Releases.
 So you have to define NAN yourself (or additionally include math.h).
 
 NAN 0/0 segfaults, cause of the usage of gcc 3.x (also on STABLE if you use
 gcc 3.x).
 
 NAN (0.0/0.0) works on both gcc versions. (POSIX definition)
 
 The math.h version on STABLE does not have the C99 definitions like on CURRENT.
 I already worked on the newest wmweather+ version (2.9).
 
 math.h is already included in the new port version, but nevertheless you have
 to define NAN cause of the missing C99 definitions on STABLE (and i dont know
 when it will be MFC). 
 
 I attached the patch for this problem and sent an upgrade PR for version 2.9
 (see http://www.freebsd.org/cgi/query-pr.cgi?pr=69523 for the new 2.9)
 
 Delete the file "files/patch-convert.h" (not used any more cause math.h is
 already defined in convert.c and apply the patch.
  
 Greets, Harald
 
 --IS0zKkzwUGydFO0o
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="patch-Makefile.diff"
 
 --- wmweather+/Makefile.orig	Wed Feb  4 06:07:46 2004
 +++ wmweather+/Makefile	Sat Jul 24 10:49:51 2004
 @@ -6,7 +6,7 @@
  
  PORTNAME=	wmweather+
  PORTVERSION=	2.4
 -PORTREVISION=	2
 +PORTREVISION=	3
  CATEGORIES=	misc windowmaker
  MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
  MASTER_SITE_SUBDIR=	wmweatherplus
 
 --IS0zKkzwUGydFO0o
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="patch_wmp24.diff"
 
 --- wmweather+/files/patch-convert.c.orig	Fri Apr 11 22:37:09 2003
 +++ wmweather+/files/patch-convert.c	Fri Jul 23 00:26:46 2004
 @@ -1,6 +1,16 @@
  --- convert.c.orig	Sun Sep 22 22:00:53 2002
 -+++ convert.c	Fri Apr 11 02:07:44 2003
 -@@ -52,7 +52,7 @@
 ++++ convert.c	Thu Jul 22 23:46:02 2004
 +@@ -18,6 +18,9 @@
 + */
 + 
 + #include <math.h>
 ++#ifndef NAN
 ++#define NAN (0.0/0.0)
 ++#endif
 + #if TM_IN_SYS_TIME
 + # if TIME_WITH_SYS_TIME
 + #  include <sys/time.h>
 +@@ -52,7 +55,7 @@
       if(temp_C==999 || dewpt_C==999) return 999;
   
       f=1782.75*(dewpt_C-temp_C)/((237.7+dewpt_C)*(237.7+temp_C));
 @@ -9,7 +19,7 @@
   }
   
   int rh_F(int temp_F, int dewpt_F){
 -@@ -61,7 +61,7 @@
 +@@ -61,7 +64,7 @@
       if(temp_F==999 || dewpt_F==999) return 999;
   
       f=3208.95*(dewpt_F-temp_F)/((395.86+dewpt_F)*(395.86+temp_F));
 @@ -18,7 +28,7 @@
   }
   
   int heatindex_C(int temp_C, int rh){
 -@@ -75,7 +75,7 @@
 +@@ -75,7 +78,7 @@
   
       temp2=temp_C*temp_C;
       rh2=rh*rh;
 @@ -27,7 +37,7 @@
   #endif
   }
   
 -@@ -88,9 +88,9 @@
 +@@ -88,9 +91,9 @@
       temp3=temp2*temp_F;
       rh2=rh*rh;
       rh3=rh2*rh;
 @@ -39,7 +49,7 @@
   #endif
   }
   
 -@@ -106,14 +106,14 @@
 +@@ -106,14 +109,14 @@
   
       ret=35.74 + 0.6215*temp_F + (-35.75 + 0.4275*temp_F)*pow(windspeed*50292/57875.0, 0.16);
       if(ret>temp_F) return temp_F;
 @@ -56,7 +66,7 @@
   }
   
   float m2mi(int meters){
 -@@ -125,27 +125,27 @@
 +@@ -125,27 +128,27 @@
   
   int knots2mph(int knots){
       if(knots<0) return knots;
 @@ -89,7 +99,7 @@
   }
   
   int knots2beaufort(int knots){
 -@@ -170,12 +170,12 @@
 +@@ -170,12 +173,12 @@
   
   int temp_C2F(int temp_C){
       if(temp_C==999) return 999;
 
 --IS0zKkzwUGydFO0o--



More information about the freebsd-ports-bugs mailing list