From mats@dufberg.se  Sun Feb 22 16:36:53 2004
Return-Path: <mats@dufberg.se>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 07A9516A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 22 Feb 2004 16:36:53 -0800 (PST)
Received: from mail.home.narnia.pp.se (as1-6-2.has.s.bonet.se [194.236.120.231])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 4F92943D1D
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 22 Feb 2004 16:36:52 -0800 (PST)
	(envelope-from mats@dufberg.se)
Received: from kafka.home.narnia.pp.se (kafka.home.narnia.pp.se [172.25.25.56])
	by mail.home.narnia.pp.se (Postfix) with ESMTP id 70FFBB887
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 23 Feb 2004 01:36:50 +0100 (CET)
Message-Id: <20040223012215.R45548@kafka.home.narnia.pp.se>
Date: Mon, 23 Feb 2004 01:36:50 +0100 (CET)
From: Mats Dufberg <mats@dufberg.se>
To: FreeBSD-gnats-submit@freebsd.org
Subject: ports://graphics/graphviz will not compile under 5.1

>Number:         63247
>Category:       ports
>Synopsis:       graphics/graphviz will not compile under 5.1
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    perky
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 22 16:40:20 PST 2004
>Closed-Date:    Mon May 24 15:36:33 PDT 2004
>Last-Modified:  Mon May 24 15:36:33 PDT 2004
>Originator:     Mats Dufberg
>Release:        FreeBSD 5.1-RELEASE-p8 and 4.8-RELEASE-p13 i386
>Organization:
private
>Environment:

>Description:

During compilation, graphics/graphviz runs an awk script, colortbl.awk
which is in "work/graphviz-1.10/dotneato/awk". When compile under FreeBSD
4.8, it works fine, but when I do the same thing under 5.1, it fails with
an error, where nawk says there are syntax errors.

When I run "nawk -f colortbl.awk" with exactly the same colortbl.awk in
the two versions, there is no complaint in 4.8, bur failure in 5.1.

The error is

  nawk: syntax error at source line 7 in function rgb_to_hsb source file
  colortbl.awk
   context is
                r = r / >>>  255 <<< .0; g = g / 255.0; b = b / 255.0;
   nawk: illegal statement at source line 8 in function rgb_to_hsb source
   file colortbl.awk
   nawk: syntax error at source line 21 in function rgb_to_hsb source file
   colortbl.awk

and then nawk waits forever. After updating the awk file according to the
enclosed patch, the problem seems to be removed. I do not know if the
change as any negative side effects.

These are the last lines before compilation stops when the fix is not
applied:

gmake[3]: Entering directory
`/usr/ports/graphics/graphviz/work/graphviz-1.10/dotneato/common'
/bin/sh ../../libtool --mode=compile cc -DHAVE_CONFIG_H -I. -I. -I../..
-I../../dotneato/dotgen         -I../../dotneato/neatogen
-I../../dotneato/twopigen       -I../../graph   -I../../cdt
-I../../pathplan        -I../../gd           -I/usr/local/include
-I/usr/local/include/tcl8.4 -I/usr/local/include/tk8.4
-I/usr/local/include  -O -pipe -mcpu=pentiumpro -Wall -Wno-unknown-pragmas
-c arrows.c
mkdir .libs
cc -DHAVE_CONFIG_H -I. -I. -I../.. -I../../dotneato/dotgen
-I../../dotneato/neatogen -I../../dotneato/twopigen -I../../graph
-I../../cdt -I../../pathplan -I../../gd -I/usr/local/include
-I/usr/local/include/tcl8.4 -I/usr/local/include/tk8.4
-I/usr/local/include -O -pipe -mcpu=pentiumpro -Wall -Wno-unknown-pragmas
-c arrows.c  -fPIC -DPIC -o .libs/arrows.lo
cc -DHAVE_CONFIG_H -I. -I. -I../.. -I../../dotneato/dotgen
-I../../dotneato/neatogen -I../../dotneato/twopigen -I../../graph
-I../../cdt -I../../pathplan -I../../gd -I/usr/local/include
-I/usr/local/include/tcl8.4 -I/usr/local/include/tk8.4
-I/usr/local/include -O -pipe -mcpu=pentiumpro -Wall -Wno-unknown-pragmas
-c arrows.c -o arrows.o >/dev/null 2>&1
mv -f .libs/arrows.lo arrows.lo
sed s/_//g color_names | sort +0 -1 > color_lib
nawk -f ../../dotneato/awk/colortbl.awk color_lib > colortbl.h
nawk: syntax error at source line 7 in function rgb_to_hsb source file
../../dotneato/awk/colortbl.awk
 context is
                r = r / >>>  255 <<< .0; g = g / 255.0; b = b / 255.0;
nawk: illegal statement at source line 8 in function rgb_to_hsb source
file ../../dotneato/awk/colortbl.awk
nawk: syntax error at source line 21 in function rgb_to_hsb source file
../../dotneato/awk/colortbl.awk



>How-To-Repeat:
It seems to come each time.



>Fix:

The follwing patch fixes the problem for me. I do not know if it has any
bad side effects. I've only tried it on 5.1 (so I don't know if it will
fail on 4.8 or any other version):


*** ./work/graphviz-1.10/dotneato/awk/colortbl.awk	Mon Feb 23 01:08:52 2004
--- ./work/graphviz-1.10/dotneato/awk/colortbl.awk.original-version	Mon Feb 23 01:08:26 2004
***************
*** 4,10 ****
  # http://www.research.att.com/orgs/ssr/book/reuse

  function rgb_to_hsb(r,g,b) {
! 	r = r / 255; g = g / 255; b = b / 255;
  	max = r; if (max < g) max = g; if (max < b) max = b;
  	min = r; if (min > g) min = g; if (min > b) min = b;
  	v = max;
--- 4,10 ----
  # http://www.research.att.com/orgs/ssr/book/reuse

  function rgb_to_hsb(r,g,b) {
! 	r = r / 255.0; g = g / 255.0; b = b / 255.0;
  	max = r; if (max < g) max = g; if (max < b) max = b;
  	min = r; if (min > g) min = g; if (min > b) min = b;
  	v = max;
***************
*** 18,32 ****
  		bc = (max - b)/delta;
  		if (r == max) h = bc - gc;
  		else {
! 			if (g == max) h = 2 + (rc - bc);
! 			else h = 4 + (gc - rc);
  		}
! 		h = h * 60;
! 		if (h < 0) h = h + 360;
  	}
! 	h = h / 360 * 255;
! 	s = s * 255;
! 	v = v * 255;
  }

  BEGIN	{ s = ARGV[1]; gsub("\\.","_",s); printf("hsbcolor_t %s[] = {\n",s); }
--- 18,32 ----
  		bc = (max - b)/delta;
  		if (r == max) h = bc - gc;
  		else {
! 			if (g == max) h = 2.0 + (rc - bc);
! 			else h = 4.0 + (gc - rc);
  		}
! 		h = h * 60.0;
! 		if (h < 0.0) h = h + 360.0;
  	}
! 	h = h / 360.0 * 255.0;
! 	s = s * 255.0;
! 	v = v * 255.0;
  }

  BEGIN	{ s = ARGV[1]; gsub("\\.","_",s); printf("hsbcolor_t %s[] = {\n",s); }




>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->perky 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Feb 23 01:06:22 PST 2004 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=63247 

From: Pav Lucistnik <pav@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, mats@dufberg.se
Cc:  
Subject: Re: ports/63247: graphics/graphviz will not compile under 5.1
Date: Sat, 22 May 2004 14:22:09 +0200

 I can't reproduce this with nawk from 5.2-CURRENT. There were several
 imports of awk since 5.1. Can you please check if the problem persists
 on newer systems than 5.1?
 
 -- 
 Pav Lucistnik <pav@oook.cz>
               <pav@FreeBSD.org>
 
 In God we trust. All others must use the callback verifier.

From: Mats Dufberg <mats@dufberg.se>
To: Pav Lucistnik <pav@FreeBSD.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: ports/63247: graphics/graphviz will not compile under 5.1
Date: Tue, 25 May 2004 00:27:35 +0200 (CEST)

 On May 22, 2004, 14:22 (+0200) Pav Lucistnik <pav@FreeBSD.org> wrote:
 
 > I can't reproduce this with nawk from 5.2-CURRENT. There were several
 > imports of awk since 5.1. Can you please check if the problem persists
 > on newer systems than 5.1?
 
 I cannot reproduce the problem with FreeBSD 5.2.1 and graphviz-1.12.
 
 
 
 Mats
 
 -----------------------------------------------------------------
 Mats Dufberg                                      mats@dufberg.se
 Blaoarvsgraend 42                                  +46-8-38 48 59
 SE-162 45 Vaellingby, Sweden                      +46-70-258 2588
State-Changed-From-To: open->closed 
State-Changed-By: pav 
State-Changed-When: Mon May 24 15:36:19 PDT 2004 
State-Changed-Why:  
Submitter confirms that problem is resolved in recent 
versions of FreBSD. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=63247 
>Unformatted:
 >System:
 
 The bug only appears on FreeBSD 5.1 (5.x?) and not on FreeBSD 4.8 (4.x?).
 The identified differens is the installed version of nawk, awk version
 20020210 (4.8) and awk version 20030314 (5.1).
 
 I've reported it as a ports bug, but it could be a nawk bug (system bug).
 
 
 
