ports/63247: ports://graphics/graphviz will not compile under 5.1

Mats Dufberg mats at dufberg.se
Mon Feb 23 00:40:21 UTC 2004


>Number:         63247
>Category:       ports
>Synopsis:       ports://graphics/graphviz will not compile under 5.1
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 22 16:40:20 PST 2004
>Closed-Date:
>Last-Modified:
>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:
>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).
 
 
 



More information about the freebsd-ports-bugs mailing list