Graphviz Issue Tracker
Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000123graphvizGraph Librariespublic2002-10-17 12:552011-04-28 04:02
Assigned Toerg 
PlatformOSx86-Linux-Redhat 8.0, Redhat's 2OS Version
Summary0000123: agerror() is not called reliably during agread()

When I attempt to agread() a truncated dot file two consecutive times, agerror() is called during the first agread(), but it is not called during the second agread().

The failure to call agerror() a second time can produce two results:

  • When I use my own agerror() function (suggested in North's "Agraph Tutorial", page 12), the program segfaults.

  • When I rely upon the libagraph agerror() function, the program does not segfault.

The source below will reproduce this error:

#include <stdio.h>
#include <agraph.h>

int main()
   FILE* file = fopen("", "r");
   Agraph_t *dotGraph = 0;

   dotGraph = agread(file, 0);

   printf("the first read is complete.\\n");

   dotGraph = agread(file, (Agdisc_t*)NULL);

   printf("the second read is complete.\\n");

   return 0;

void agerror(int code, char *str)
   printf("my agerror : error code %d : %s\\n", code, str);
Steps To Reproduce

digraph G {
        subgraph cluster_c0 {a0 -> a1 -> a2 -> a3;}
        subgraph cluster_c1 {b0 -
Additional Information

The dot input causing the bug is a truncated version of the shipped with graphviz-1.8.10.

I chose an arbitrary place to truncate it.

The same behavior is shown with files that have some pretty ugly syntax errors.
TagsNo tags attached.
FIX-COMMENT Sorry, I don't have a fix, but $SRC_DIR/agraph/grammar.c lines 979-1028
appear to be the ones failing to call agerror() the seoncd time. Maybe
that'll help a little bit?

[erg] This is not a bug, but is part of the I/O and parsing model of the
STATUS-COMMENTFixed (18 December 2002)
VERSION     1.8.10
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2011-04-28 04:02 user1 New Issue
2011-04-28 04:02 user1 Assigned To => erg

MantisBT 1.2.5[^]
Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker