From 9c6d302b2205cf9bd0ae4e8d260ac3ec5f6d772b Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Thu, 25 May 2006 10:21:45 +0000 Subject: [PATCH] * lib/Automake/XFile.pm (lock): Allow EOPNOTSUPP, besides ENOLCK. Only mention `make -j' when applicable. Only raise fatal errors when `make -j' is involved. Improve error message. --- ChangeLog | 6 +++ configure | 98 ++++++++++++++++++++++++------------------- doc/stamp-vti | 2 +- doc/version.texi | 2 +- lib/Automake/XFile.pm | 35 +++++++++------- 5 files changed, 82 insertions(+), 61 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23ad00dc..c3f592dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-05-25 Noah Misch + + * lib/Automake/XFile.pm (lock): Allow EOPNOTSUPP, besides + ENOLCK. Only mention `make -j' when applicable. Only raise + fatal errors when `make -j' is involved. Improve error message. + 2006-05-17 Ralf Wildenhues * lib/Autom4te/Configure_ac.pm (find_configure_ac): Use diff --git a/configure b/configure index 1f6b40fa..c968ccbc 100755 --- a/configure +++ b/configure @@ -233,8 +233,8 @@ IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells which exist, to save several forks. - if test -f $as_shell && - { ($as_shell) 2> /dev/null <<\_ASEOF + if test -f "$as_shell" && + { ("$as_shell") 2> /dev/null <<\_ASEOF # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh @@ -254,7 +254,7 @@ _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_shell 2> /dev/null <<\_ASEOF + if { "$as_shell" 2> /dev/null <<\_ASEOF # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh @@ -1117,7 +1117,7 @@ if test ! -r "$srcdir/$ac_unique_file"; then fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd $srcdir && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. @@ -1225,7 +1225,7 @@ fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue + test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in @@ -1260,14 +1260,14 @@ case $srcdir in esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - cd $ac_dir || { ac_status=$?; continue; } + cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. - if test -f $ac_srcdir/configure.gnu; then + if test -f "$ac_srcdir/configure.gnu"; then echo && - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then echo && - $SHELL $ac_srcdir/configure --help=recursive + $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? @@ -1552,8 +1552,8 @@ if test -r "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; esac fi else @@ -1645,35 +1645,41 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= -for ac_dir in lib $srcdir/lib; do - if test -f $ac_dir/install-sh; then +for ac_dir in lib "$srcdir"/lib; do + if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break - elif test -f $ac_dir/install.sh; then + elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break - elif test -f $ac_dir/shtool; then + elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in lib $srcdir/lib" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in lib $srcdir/lib" >&2;} + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in lib \"$srcdir\"/lib" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in lib \"$srcdir\"/lib" >&2;} { (exit 1); exit 1; }; } fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + # Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking build system type" >&5 @@ -1683,14 +1689,14 @@ if test "${ac_cv_build+set}" = set; then else ac_build_alias=$build_alias test "x$ac_build_alias" = x && - ac_build_alias=`$ac_config_guess` + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } -ac_cv_build=`$ac_config_sub $ac_build_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_build_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_build_alias failed" >&2;} +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi @@ -2447,7 +2453,7 @@ case `"$ac_path_GREP" --version 2>&1` in # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done - rm -f conftest.*;; + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac @@ -2529,7 +2535,7 @@ case `"$ac_path_EGREP" --version 2>&1` in # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done - rm -f conftest.*;; + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac @@ -2612,7 +2618,7 @@ case `"$ac_path_FGREP" --version 2>&1` in # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done - rm -f conftest.*;; + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac @@ -2714,8 +2720,8 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then +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 "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} @@ -3121,7 +3127,6 @@ gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' - _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF @@ -3503,13 +3508,18 @@ echo X"$ac_file" | q } s/.*/./; q'` - { if $as_mkdir_p; then - test -d "$ac_dir" || mkdir -p "$ac_dir" - else - as_dir="$ac_dir" + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ @@ -3533,10 +3543,11 @@ echo X"$as_dir" | q } s/.*/./; q'` + test -d "$as_dir" && break done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. @@ -3583,7 +3594,6 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac - _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF diff --git a/doc/stamp-vti b/doc/stamp-vti index ce08ca95..602fd31f 100644 --- a/doc/stamp-vti +++ b/doc/stamp-vti @@ -1,4 +1,4 @@ -@set UPDATED 15 May 2006 +@set UPDATED 16 May 2006 @set UPDATED-MONTH May 2006 @set EDITION 1.9a @set VERSION 1.9a diff --git a/doc/version.texi b/doc/version.texi index ce08ca95..602fd31f 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 15 May 2006 +@set UPDATED 16 May 2006 @set UPDATED-MONTH May 2006 @set EDITION 1.9a @set VERSION 1.9a diff --git a/lib/Automake/XFile.pm b/lib/Automake/XFile.pm index c1c58c50..799ad8d0 100644 --- a/lib/Automake/XFile.pm +++ b/lib/Automake/XFile.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2004, 2006 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -91,6 +91,7 @@ use Errno; use IO::File; use File::Basename; use Automake::ChannelDefs; +use Automake::Channels qw(msg); use Automake::FileUtils; require Exporter; @@ -218,22 +219,26 @@ sub lock my ($fh, $mode) = @_; # Cannot use @_ here. - # On some systems (e.g. GNU/Linux with NFSv2), flock(2) does not work over - # NFS, but Perl prefers that over fcntl(2) if it exists and if - # perl was not built with -Ud_flock. Normally, this problem is harmless, - # so ignore the ENOLCK errors that are reported in that situation, - # However, if the invoker is using "make -j", the problem is not harmless, - # so report it in that case, by inspecting MAKEFLAGS and looking for - # any arguments indicating that the invoker used -j. - # Admittedly this is a bit of a hack. - if (!flock ($fh, $mode) - && (!$!{ENOLCK} - || (exists $ENV{'MAKEFLAGS'} - && " -$ENV{'MAKEFLAGS'}" =~ / (-[BdeikrRsSw]*j|---?jobs)/))) + # Unless explicitly configured otherwise, Perl implements its `flock' with the + # first of flock(2), fcntl(2), or lockf(3) that works. These can fail on + # NFS-backed files, with ENOLCK (GNU/Linux) or EOPNOTSUPP (FreeBSD); we + # usually ignore these errors. If $ENV{MAKEFLAGS} suggests that a parallel + # invocation of GNU `make' has invoked the tool we serve, report all locking + # failures and abort. + # + # On Unicos, flock(2) and fcntl(2) over NFS hang indefinitely when `lockd' is + # not running. NetBSD NFS clients silently grant all locks. We do not + # attempt to defend against these dangers. + if (!flock ($fh, $mode)) { + my $make_j = (exists $ENV{'MAKEFLAGS'} + && " -$ENV{'MAKEFLAGS'}" =~ / (-[BdeikrRsSw]*j|---?jobs)/); + my $note = "\nforgo `make -j' or use a file system that supports locks"; my $file = $fh->name; - fatal ("cannot lock $file with mode $mode " - . "(perhaps you are running make -j on a lame NFS client?): $!"); + + msg ($make_j ? 'fatal' : 'unsupported', + "cannot lock $file with mode $mode: $!" . ($make_j ? $note : "")) + if $make_j || !($!{ENOLCK} || $!{EOPNOTSUPP}); } } -- 2.43.5