[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AIX grep limitation: coreutils build failure
From: |
Ralf Wildenhues |
Subject: |
AIX grep limitation: coreutils build failure |
Date: |
Sat, 27 May 2006 17:16:50 +0200 |
User-agent: |
Mutt/1.5.11 |
Apologies for the cross post.
AIX grep allows 2048 characters in a line, and fails otherwise.
This breaks coreutils-5.96 configure:
| grep: Maximum line length of 2048 exceeded.
[...]
| grep: Maximum line length of 2048 exceeded.
| configure: error: could not make ./config.status
because of this code in autoconf/lib/autoconf/status.m4:
if test `grep -c "$ac_delim\$" conf$$subs.sed` = _AC_SED_DELIM_NUM; then
break
elif $ac_last_try; then
AC_MSG_ERROR([could not make $CONFIG_STATUS])
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
and the too-long line is the one with lots of ${LIBOBJDIR}s in them.
(The system I tried this on has a third-party ggrep installed, but I'm
not letting coreutils' configure find it. The line is about 3000
characters long.)
For now coreutils seems to be able to get away with the slightly higher
line limit for `sed', but not for `grep'. OTOH, coreutils would not
actually need the `${LIBOBJDIR}' thingies anyway, and they cause the
extremely long line.
I suppose we can get away with a hack like the one below for now.
With that in place, config.status gets generated. There is another
grep-related failure: the generated Makefiles are grepped by Automake's
dependency tracking code. This causes the .deps/*Po files not to be
created. The second hack below "fixes" that. I'm not too sure about
it. Maybe
am_genline=`sed -n '/^#.*generated by automake/p' "$mf"`
test -n "$am_genline"
is better to use as a test?
FWIW, I'm not totally sure this is exactly the bug that Sam reported.
(The line may be longer or shorter on Solaris; there, /usr/xpg4/bin/grep
is documented to have a limit of LINE_MAX = 2.48 bytes (Solaris 2.6);
the config.status lines are slightly shorter than the Makefile ones,
so it may be possible he saw the latter issue trigger but not the
former.)
What do you think?
Cheers,
Ralf
Autoconf patch:
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Use `tr'
to shorten the line length for the delimiter test, for AIX grep.
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.109
diff -u -r1.109 status.m4
--- lib/autoconf/status.m4 26 May 2006 22:29:50 -0000 1.109
+++ lib/autoconf/status.m4 27 May 2006 14:54:17 -0000
@@ -401,7 +401,9 @@
m4_if(_AC_Var, address@hidden@], m4_if(_AC_SED_CMD_NUM, 2, 2,
_AC_SED_CMD_LIMIT), _AC_SED_CMD_NUM),
[_ACEOF
- if test `grep -c "$ac_delim\$" conf$$subs.sed` = _AC_SED_DELIM_NUM; then
+dnl Uss `tr' to cut down the line length so it is acceptable
+dnl even for AIX grep.
+ if test `tr -d "$as_cr_Letters" < conf$$subs.sed | grep -c "$ac_delim\$"` =
_AC_SED_DELIM_NUM; then
break
elif $ac_last_try; then
AC_MSG_ERROR([could not make $CONFIG_STATUS])
Automake patch:
* m4/depout.m4 (_AM_OUTPUT_DEPENDENCY_COMMANDS): Do not use
plain `grep' on the Makefile, as its line length may exceed that
for grep. Bug report against coreutils by Sam Sirlin.
* THANKS: Update.
Index: m4/depout.m4
===================================================================
RCS file: /cvs/automake/automake/m4/depout.m4,v
retrieving revision 1.18
diff -u -r1.18 depout.m4
--- m4/depout.m4 9 Jan 2005 14:46:21 -0000 1.18
+++ m4/depout.m4 27 May 2006 15:04:56 -0000
@@ -20,8 +20,9 @@
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
- # So let's grep whole file.
- if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
Index: THANKS
===================================================================
RCS file: /cvs/automake/automake/THANKS,v
retrieving revision 1.283
diff -u -r1.283 THANKS
--- THANKS 10 May 2006 20:55:34 -0000 1.283
+++ THANKS 27 May 2006 15:11:05 -0000
@@ -248,6 +249,7 @@
Rusty Ballinger address@hidden
Ryan T. Sammartino address@hidden
Sam Hocevar address@hidden
+Sam Sirlin address@hidden
Sander Niemeijer address@hidden
Santiago Vila address@hidden
Scott James Remnant address@hidden
- AIX grep limitation: coreutils build failure,
Ralf Wildenhues <=