[1015] in Kerberos-V5-bugs

home help back first fref pref prev next nref lref last post

Autoheader 2.1 breaks on DEC OSF V1.3 due to fgrep bug

daemon@ATHENA.MIT.EDU (epeisach@MIT.EDU)
Sun Jan 1 17:34:49 1995

From: epeisach@MIT.EDU
Date: Sun, 1 Jan 1995 17:34:16 -0500
To: bug-gnu-utils@prep.ai.mit.edu


I have discovered a bug with autoheader in autoconf version 2.1.
The problem stems from a semi-broken fgrep in DEC's OSF/1 V1.3 (I have
not tested later versions), where lines greater than 512 bytes have new
lines added in the search responses. This sometimes causes some problems
with the output of autoheader.

Note: grep 2.0 from prep.ai.mit.edu does not suffer from this problem.

The sample demonstrates the problem: (taken from the less-252 package)

------------------------------ configure.in ----------------------
AC_INIT(configure.in)

AC_DEFINE(HAVE_POSIX_REGCOMP)

AC_OUTPUT(Makefile)
------------------------------------------------------------------
---------------------------- acconfig.h --------------------------
/*
 * Regular expression library.
 * Define exactly one of the following to be 1:
 * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h
 * HAVE_RE_COMP: BSD re_comp()
 * HAVE_REGCMP: System V regcmp()
 * HAVE_V8_REGCOMP: Henry Spencer V8 regcomp() and regexp.h
 * NO_REGEX: pattern matching is supported, but without metacharacters.
 */
#undef HAVE_POSIX_REGCOMP
#undef HAVE_RE_COMP
#undef HAVE_REGCMP
#undef HAVE_V8_REGCOMP
#undef NO_REGEX
-------------------------------------------------------------------

The output config.h.in is as follows:

/* config.h.in.  Generated automatically from configure.in by autoheader.  */

/*
 * Regular expression library.
 * Define exactly one of the following to be 1:
 * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h
 * HAVE_RE_COMP: BSD re_comp()
 * HAVE_REGCMP: System V regcmp()
 * HAVE_V8_REGCOMP: Henry Spencer V8 regcomp() and rege
xp.h
 * NO_REGEX: pattern matching is supported, but without metacharacters.
 */
#undef HAVE_POSIX_REGCOMP
#undef HAVE_RE_COMP
#undef HAVE_REGCMP
#undef HAVE_V8_REGCOMP
#undef NO_REGEX

----------------------------------------------------------------------

In this example, it would not matter, but I have seen other examples
where the newline was put in the middle of the undef....

The fix I found uses awk. (I tried to use sed, but I would lose the last
line in my tests and it would not be output)

My changes are:
	autoheader.sh - an awk fix to the problem where lines not
starting with @ are assumed to be part of the previous line... I believe
this is a correct assumption for the pipe line comming in.
This awk construct works with awk and gawk. I was not able to test with
nawk and mawk.

	configure.in - find which version of awk to use.
	Makefile.in - substitute for @AWK@ in the shell script.

*** 1.1	1995/01/01 18:33:29
--- autoheader.sh	1995/01/01 18:36:24
***************
*** 177,182 ****
--- 177,188 ----
  	H' | sed -e 's/@@*/@/g' |
     # Select each paragraph that refers to a symbol we picked out above.
     fgrep "$syms" |
+    # This awk script deals with fgrep implementations (OSF/1) which has 
+    # a buffer limit which is too small... Lines not beginning with @
+    # are assumed to be continuations of the previous line.
+    @AWK@ '/^@/ {if(line)print line; line=$0;next;}
+ 	{line = line $0;}
+ 	END {print line}' |
     tr @ \\012
  fi
  
*** 1.1	1995/01/01 18:34:07
--- Makefile.in	1995/01/01 18:38:16
***************
*** 26,31 ****
--- 26,32 ----
  MAKEINFO = makeinfo
  TEXI2DVI = texi2dvi
  M4 = @M4@
+ AWK = @AWK@
  PERL = @PERL@
  
  # Programs that are always installed.
***************
*** 70,76 ****
  	testsuite/lib/*.exp testsuite/autoconf.[gs]/*.exp \
  	standards.texi make-stds.texi standards.info*
  
! editsh = sed -e 's,@''datadir''@,$(acdatadir),g' -e 's,@''M4''@,$(M4),g'
  editpl = sed -e 's,@''datadir''@,$(acdatadir),g' -e 's,@''PERL''@,$(PERL),g'
  
  all: ${SCRIPTS}
--- 71,78 ----
  	testsuite/lib/*.exp testsuite/autoconf.[gs]/*.exp \
  	standards.texi make-stds.texi standards.info*
  
! editsh = sed -e 's,@''datadir''@,$(acdatadir),g' -e 's,@''M4''@,$(M4),g' \
! 	-e 's,@''AWK''@,$(AWK),g'
  editpl = sed -e 's,@''datadir''@,$(acdatadir),g' -e 's,@''PERL''@,$(PERL),g'
  
  all: ${SCRIPTS}
*** 1.1	1995/01/01 18:34:07
--- configure.in	1995/01/01 18:39:11
***************
*** 19,24 ****
--- 19,26 ----
    AC_MSG_WARN(autoscan will not be built since perl is not found)
  fi
  
+ AC_PROG_AWK
+ 
  AC_PROG_INSTALL
  
  # Work with the GNU or Cygnus source tree layout.

home help back first fref pref prev next nref lref last post