Reported by:

gthomas@native-ed.bc.ca

Date:

Fri Jun 2 18:36:21 PDT 1995

Description

System compiles fine, but any non-trivial queries results in core dumps of the scanner (typically, something like "token too large, exceeds YYLMAX" or "...scanner error: Unterminated char/string constant")

Fix

What was happening is that some Linux configuration have the lex program symlinked to 'flex -l'. However, our scanner code assumes that if you are on Linux or NetBSD, you are running flex, not flex in lex compatibility mode. If your system does not alias lex as 'flex -l' or if you are running on a Linux or NetBSD box, you probably didn't encounter this problem.

Apply this patch. It will use flex in normal mode, instead of lex, if you are running Linux. The patch also explicitly uses 'bison -y' instead of yacc. If you prefer to use Berkeley yacc, you can safely change the YACC variable setting in src/mk/port/postgres.mk.linux if you like.

===================================================================
*** 1.3	1995/03/22 19:58:51
--- src/backend/parser/Makefile.inc	1995/06/02 20:50:17
*** 17,23 ****
  
  $(PARSEYACCS): gram.y
  	cd $(objdir); \
! 	yacc $(YFLAGS) $<; \
  	mv y.tab.c gram.c; \
  	mv y.tab.h parse.h
  
--- 17,23 ----
  
  $(PARSEYACCS): gram.y
  	cd $(objdir); \
! 	$(YACC) $(YFLAGS) $<; \
  	mv y.tab.c gram.c; \
  	mv y.tab.h parse.h
  
***************
*** 26,32 ****
  
  
  scan.c:	scan.l
! 	cd $(objdir); lex $<; mv lex.yy.c scan.c
  
  $(objdir)/scan.o: scan.c
  	$(cc_inobjdir)
--- 26,32 ----
  
  
  scan.c:	scan.l
! 	cd $(objdir); $(LEX) $<; mv lex.yy.c scan.c
  
  $(objdir)/scan.o: scan.c
  	$(cc_inobjdir)
===================================================================
*** 1.3	1995/03/22 19:58:40
--- src/backend/bootstrap/Makefile.inc	1995/06/02 20:49:55
***************
*** 38,44 ****
  
  bootscanner.c: bootscanner.lex
  	cd $(objdir); \
! 	lex $<; \
  	sed -f $(bootdir)/boot.sed < lex.yy.c > bootscanner.c; \
  	rm -f lex.yy.c
  
--- 38,44 ----
  
  bootscanner.c: bootscanner.lex
  	cd $(objdir); \
! 	$(LEX) $<; \
  	sed -f $(bootdir)/boot.sed < lex.yy.c > bootscanner.c; \
  	rm -f lex.yy.c
  
===================================================================
*** 1.4	1995/05/25 22:51:10
--- src/mk/port/postgres.mk.linux	1995/06/03 00:42:58
***************
*** 34,37 ****
--- 34,40 ----
  CFLAGS_BE= -D__USE_BSD -D__USE_BSD_SIGNAL
  LDADD_BE= -lbsd
  
+ LEX = flex
+ YACC = bison -y
+ 
  endif