[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Solved! don't use cmp (Was: [GNU Autoconf 2.54] failures: 28)
From: |
Akim Demaille |
Subject: |
Solved! don't use cmp (Was: [GNU Autoconf 2.54] failures: 28) |
Date: |
17 Oct 2002 12:32:56 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter) |
| On Thu 17 Oct 2002 11:42, Akim Demaille <address@hidden> wrote:
| >
| > |On Wed 16 Oct 2002 19:21, Akim Demaille <address@hidden> wrote:
| > |> rm -f config.cache
| > |> sh -x ./foo.sh precious=foo
| > |> sh -x ./foo.sh precious=foo -C
| > |> cat config.cache
| > |> cat config.log
| > |> sh -x ./foo.sh precious=bar -C
| > |> cat config.cache
| > |> cat config.log
| >
| > I think I have it!!! I should have doubted about it much earlier :(
| >
| > On the LHS it is my machine, which, of course, is sane, and on the RHS
| > is yours, which of course, is HP :)
| >
| > + cat confcache + cat confcache
| > > + 1>& 6
| > # This file is a shell script that ca # This file is a shell script that
ca
| > # tests run on this system so they ca # tests run on this system so they
ca
| > # scripts and configure runs, see con # scripts and configure runs, see
con
| > # It is not useful on other systems. # It is not useful on other
systems.
| > # want to keep, you may remove or edi # want to keep, you may remove or
edi
| > # #
| > # config.status only pays attention t # config.status only pays attention
t
| > # the --recheck option to rerun confi # the --recheck option to rerun
confi
| > # #
| > # `ac_cv_env_foo' variables (set or u # `ac_cv_env_foo' variables (set or
u
| > # loading this file, other *unset* `a # loading this file, other *unset*
`a
| > # following values. # following values.
| >
| > ac_cv_env_build_alias_set='' | ac_cv_env_build_alias_set=''\'''\'''
|
| Yuck!
|
| > ac_cv_env_build_alias_value='' |
ac_cv_env_build_alias_value=''\'''\''
| > ac_cv_env_host_alias_set='' | ac_cv_env_host_alias_set=''\'''\'''
| > ac_cv_env_host_alias_value='' |
ac_cv_env_host_alias_value=''\'''\'''
| > ac_cv_env_precious_set='set' ac_cv_env_precious_set='set'
| > ac_cv_env_precious_value='foo' ac_cv_env_precious_value='foo'
| > ac_cv_env_target_alias_set='' |
ac_cv_env_target_alias_set=''\'''\'''
| > ac_cv_env_target_alias_value='' |
ac_cv_env_target_alias_value=''\'''\'
| > + echo 'foo.sh:1225: config.cache (/d | + echo foo.sh:1225: config.cache
(/de
| > > + 1>& 6
| > foo.sh:1225: config.cache (/dev/null) foo.sh:1225: config.cache
(/dev/null)
| > + cat /dev/null + cat /dev/null
| > > + 1>& 6
| > + cmp -s /dev/null confcache + cmp -s /dev/null confcache
| > + test -w /dev/null | + :
| > + test x/dev/null '!=' x/dev/null <
| > + cat confcache <
| >
| >
| > The piece of code is:
| >
| > cat confcache >&6
| > echo "$as_me:$LINENO: config.cache ($cache_file):" >&6
| > cat $cache_file >&6
| > if cmp -s $cache_file confcache; then :; else
| > if test -w $cache_file; then
| > test "x$cache_file" != "x/dev/null" && echo "updating cache
$cache_file"
| > cat confcache >$cache_file
| > else
| > echo "not updating unwritable cache $cache_file"
| > fi
| > fi
| > rm -f confcache
| >
| >
| > as you can see, it took the then branch, instead of the else branch.
| > In other words cmp -s /dev/null some-non-empty-file succeeds :(
| >
| > May I ask you:
| >
| > cmp /dev/null configure; echo $?
| > cmp configure /dev/null; echo $?
| > cmp -s /dev/null configure; echo $?
| > cmp -s configure /dev/null; echo $?
| > diff /dev/null configure >/dev/null; echo $?
| > diff configure /dev/null >/dev/null; echo $?
| >
| > ?
|
| a5:/pro/3gl/GNU/autoconf-2.54a 105 > sh -vx xx.sh
| cmp /dev/null configure; echo $?
| + cmp /dev/null configure
| Premature end of file /dev/null at -1
| + echo 0
| 0
| cmp configure /dev/null; echo $?
| + cmp configure /dev/null
| Premature end of file /dev/null at -1
| + echo 0
| 0
| cmp -s /dev/null configure; echo $?
| + cmp -s /dev/null configure
| + echo 0
| 0
| cmp -s configure /dev/null; echo $?
| + cmp -s configure /dev/null
| + echo 0
| 0
| diff /dev/null configure >/dev/null; echo $?
| + diff /dev/null configure
| + 1> /dev/null
| + echo 1
| 1
| diff configure /dev/null >/dev/null; echo $?
| + diff configure /dev/null
| + 1> /dev/null
| + echo 1
| 1
| a5:/pro/3gl/GNU/autoconf-2.54a 106 >
Good, I'm applying the following patch. I feel so much better :)
2002-10-17 Akim Demaille <address@hidden>
* lib/autoconf/general.m4 (AC_CACHE_SAVE): Don't use cmp.
Fixes the `AC_ARG_VAR' test failures.
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES): Don't use cmp.
* lib/freeze.mk (check-forbidden-patterns): New.
* lib/autoconf/Makefile.am, lib/autotest/Makefile.am
* lib/m4sugar/Makefile.am (check-local): Use it to catch `cmp'.
* doc/autoconf.texi (Limitations of Usual Tools): HP-UX' cmp and
/dev/null.
Reported months ago by H. Merijn Brand.
Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.265
diff -u -u -r1.265 NEWS
--- NEWS 16 Oct 2002 06:38:50 -0000 1.265
+++ NEWS 17 Oct 2002 10:28:55 -0000
@@ -26,6 +26,10 @@
- Portability of the Autoconf package to Solaris.
+- Cache files and HP-UX
+ Because of HP-UX' cmp, cache files probably never worked properly.
+ Autoconf no longer uses cmp at all.
+
- Spurious warnings caused by config.status.
This bug is benign, but painful: on some systems (typically
FreeBSD), warnings such as:
Index: THANKS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/THANKS,v
retrieving revision 1.97
diff -u -u -r1.97 THANKS
--- THANKS 11 Oct 2002 09:49:31 -0000 1.97
+++ THANKS 17 Oct 2002 10:28:56 -0000
@@ -75,6 +75,7 @@
Hans Olsson address@hidden
Harlan Stenn address@hidden
H.J. Lu address@hidden
+H. Merijn Brand address@hidden
Ian Lance Taylor address@hidden
James A. Lupo address@hidden
Jason Molenda address@hidden
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.688
diff -u -u -r1.688 autoconf.texi
--- doc/autoconf.texi 11 Oct 2002 23:53:09 -0000 1.688
+++ doc/autoconf.texi 17 Oct 2002 10:29:20 -0000
@@ -9860,6 +9860,17 @@
@command{diff} to avoid spurious differences due to differences of
newline encoding.
+Under HP-UX 11, @command{cmp} is unable to process @file{/dev/null}, and
+even exits with success:
+
address@hidden
+$ @kbd{cmp /dev/null configure}
address@hidden end of file /dev/null at -1
+$ @kbd{echo $?}
+0
address@hidden example
+
+For all these reasons, it seems safer to always use @command{diff}.
@item @command{cp}
@c ---------------
Index: lib/freeze.mk
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/freeze.mk,v
retrieving revision 1.7
diff -u -u -r1.7 freeze.mk
--- lib/freeze.mk 28 Sep 2002 14:07:47 -0000 1.7
+++ lib/freeze.mk 17 Oct 2002 10:29:20 -0000
@@ -111,3 +111,20 @@
$(ETAGS_FOR_M4SUGAR) \
--regex='/\(A[CU]_DEFUN\|AU_ALIAS\)(\[\([^]]*\)\]/\2/' \
--regex='/AN_\(FUNCTION\|HEADER\|IDENTIFIER\|LIBRARY\|MAKEVAR\|PROGRAM\)(\[\([^]]*\)\]/\2/'
+
+
+## -------------------------------- ##
+## Looking for forbidden patterns. ##
+## -------------------------------- ##
+
+check-forbidden-patterns:
+ if (cd $(srcdir) && \
+ grep $(forbidden_patterns) $(forbidden_patterns_files)) \
+ >forbidden.log; then \
+ echo "ERROR: forbidden patterns were found:" >&2; \
+ sed "s,^,$*.m4: ," <forbidden.log >&2; \
+ echo >&2; \
+ exit 1; \
+ else \
+ rm -f forbidden.log; \
+ fi
Index: lib/autoconf/Makefile.am
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/Makefile.am,v
retrieving revision 1.20
diff -u -u -r1.20 Makefile.am
--- lib/autoconf/Makefile.am 28 Sep 2002 14:07:47 -0000 1.20
+++ lib/autoconf/Makefile.am 17 Oct 2002 10:29:20 -0000
@@ -42,16 +42,9 @@
## Checks. ##
## -------- ##
-check-local:
- if (cd $(srcdir) && \
- grep '^_*EOF' $(dist_autoconflib_DATA)) >eof.log; then \
- echo "ERROR: user EOF tags were used:" >&2; \
- sed "s,^,$*.m4: ," <eof.log >&2; \
- echo >&2; \
- exit 1; \
- else \
- rm -f eof.log; \
- fi
+check-local: check-forbidden-patterns
+forbidden_patterns = -e '^_*EOF' -e ' cmp '
+forbidden_patterns_files = $(dist_autoconflib_DATA)
## ------------------ ##
Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.804
diff -u -u -r1.804 general.m4
--- lib/autoconf/general.m4 9 Sep 2002 15:51:52 -0000 1.804
+++ lib/autoconf/general.m4 17 Oct 2002 10:29:24 -0000
@@ -1771,7 +1771,7 @@
t end
/^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
: end'] >>confcache
-if cmp -s $cache_file confcache; then :; else
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
if test -w $cache_file; then
test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
cat confcache >$cache_file
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.30
diff -u -u -r1.30 status.m4
--- lib/autoconf/status.m4 27 Sep 2002 08:20:27 -0000 1.30
+++ lib/autoconf/status.m4 17 Oct 2002 10:29:29 -0000
@@ -649,7 +649,7 @@
cat $tmp/in >>$tmp/config.h
rm -f $tmp/in
if test x"$ac_file" != x-; then
- if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
+ if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
AC_MSG_NOTICE([$ac_file is unchanged])
else
ac_dir=`AS_DIRNAME(["$ac_file"])`
@@ -1019,7 +1019,7 @@
" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
rm -f $tmp/stdin
dnl This would break Makefile dependencies.
-dnl if cmp -s $ac_file $tmp/out 2>/dev/null; then
+dnl if diff $ac_file $tmp/out >/dev/null 2>&1; then
dnl echo "$ac_file is unchanged"
dnl else
dnl rm -f $ac_file
Index: lib/autotest/Makefile.am
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autotest/Makefile.am,v
retrieving revision 1.9
diff -u -u -r1.9 Makefile.am
--- lib/autotest/Makefile.am 28 Sep 2002 14:07:47 -0000 1.9
+++ lib/autotest/Makefile.am 17 Oct 2002 10:29:29 -0000
@@ -35,16 +35,9 @@
## Checks. ##
## -------- ##
-check-local:
- if (cd $(srcdir) && \
- grep '^_*EOF' $(dist_autotestlib_DATA)) >eof.log; then \
- echo "ERROR: user EOF tags were used:" >&2; \
- sed "s,^,$*.m4: ," <eof.log >&2; \
- echo >&2; \
- exit 1; \
- else \
- rm -f eof.log; \
- fi
+check-local: check-forbidden-patterns
+forbidden_patterns = -e '^_*EOF' -e ' cmp '
+forbidden_patterns_files = $(dist_autotestlib_DATA)
## ------------------ ##
Index: lib/m4sugar/Makefile.am
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/Makefile.am,v
retrieving revision 1.10
diff -u -u -r1.10 Makefile.am
--- lib/m4sugar/Makefile.am 28 Sep 2002 14:07:47 -0000 1.10
+++ lib/m4sugar/Makefile.am 17 Oct 2002 10:29:29 -0000
@@ -54,16 +54,10 @@
## Checks. ##
## -------- ##
-check-local:
- if (cd $(srcdir) && \
- grep '^_*EOF' $(dist_m4sugarlib_DATA)) >eof.log; then \
- echo "ERROR: user EOF tags were used:" >&2; \
- sed "s,^,$*.m4: ," <eof.log >&2; \
- echo >&2; \
- exit 1; \
- else \
- rm -f eof.log; \
- fi
+check-local: check-forbidden-patterns
+forbidden_patterns = -e '^_*EOF' -e ' cmp '
+forbidden_patterns_files = $(dist_m4sugarlib_DATA)
+
## ------------------ ##
- Solved! don't use cmp (Was: [GNU Autoconf 2.54] failures: 28),
Akim Demaille <=