bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bugs found on bison/m4 on windows


From: Kees Dekker
Subject: bugs found on bison/m4 on windows
Date: Wed, 30 Jun 2004 17:20:16 +0200

Hi,

I'm using bison 1.875 and m4 (both downloaded from
http://gnuwin32.sourceforge.net/).

I found some problems:
1. m4 is not able to open a file from a directory with spaces if
BISON_PKGDATADIR dir contains spaces. I guess this could be easily fixed by
escaping the arguments when m4 is called from bison in output.c, function
output().
2. I'm also using clearcase, which is a source control management system. To
be able to work under Unix and Windows, ClearCase has a special mode on
Windows, i..e which causes to convert (text) files to DOS style text mode.
This is giving trouble in bison in scan-skel.c at line 743. The code is
here:

case 1:
YY_RULE_SETUP
#line 47 "scan-skel.l"
{
  char const *filename = yytext + sizeof "@output " - 1;
  yytext[yyleng - 1] = '\0';

  if (*filename == '@')
    {
      if (strcmp (filename, "@output_header_name@") == 0)
        filename = spec_defines_file;
      else if (strcmp (filename, "@output_parser_name@") == 0)
        filename = parser_file_name;
      else
        abort ();
    }

  XFREE (outname);
  outname = xstrdup (filename);
  xfclose (yyout);
  yyout = xfopen (outname, "w");
  lineno = 1;
}

But because yyleng counts the \r (from the terminating \r\n from yytext),
yytext is wrongly terminated, i.e. to e.g. "@address@hidden", causing
an abort in m4, and an exit/crash of bison. There are several solution to
solve this:
1. open files in m4 in text mode instead of binary mode
2. let parser skip \r, and correct yyleng
3. add an additional strcmp, like:
      else if ( (strcmp (filename, "@output_parser_name@") == 0) || (strcmp
(filename, "@address@hidden") ==0) )

I hope you will be able to fix this bug. Feel free to contact me in case if
more info is needed.

Regards
Kees Dekker
Barneveld, The Netherlands.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]