From: Akim Demaille Date: Fri, 27 Sep 2002 08:20:26 +0000 (+0000) Subject: * doc/autoconf.texi (Limitations of Usual Tools): Some about mv X-Git-Tag: AUTOCONF-2.54a~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a56bdde71a7500a5307225335780f822dfae693;p=thirdparty%2Fautoconf.git * doc/autoconf.texi (Limitations of Usual Tools): Some about mv from /tmp. Thanks to Bill Moseley and Paul Eggert. * lib/m4sugar/m4sh.m4 (AS_TMPDIR): $2 is the directory into which the tmpdir must be created. * lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Have the tmp dir be in the build tree, instead of $TMPDIR. --- diff --git a/ChangeLog b/ChangeLog index cee416e73..f8dbf43aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-09-27 Akim Demaille + + * doc/autoconf.texi (Limitations of Usual Tools): Some about mv + from /tmp. + Thanks to Bill Moseley and Paul Eggert. + * lib/m4sugar/m4sh.m4 (AS_TMPDIR): $2 is the directory into which + the tmpdir must be created. + * lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Have the tmp + dir be in the build tree, instead of $TMPDIR. + 2002-09-27 Akim Demaille * bin/autoscan.in: Improve the comments. diff --git a/NEWS b/NEWS index de6cd09b4..bc555e81a 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,15 @@ - Portability of the Autoconf package to Solaris. +- Spurious warnings caused by config.status. + This bug is benign, but painful: on some systems (typically + FreeBSD), warnings such as: + + config.status: creating Makefile + mv: Makefile: set owner/group (was: 1357/0): Operation not permitted + + could be issued. This is fixed. + * Major changes in Autoconf 2.54 Released September 13th, 2002. diff --git a/THANKS b/THANKS index 9b9541462..e39c389f2 100644 --- a/THANKS +++ b/THANKS @@ -22,6 +22,7 @@ Artur Frysiak wiget@pld.org.pl Assar Westerlund assar@sics.se Axel Thimm Axel.Thimm@physik.fu-berlin.de Ben Elliston bje@redhat.com +Bill Moseley moseley@hank.org Bill Sommerfeld sommerfeld@apollo.hp.com Bob Friesenhahn bfriesen@simple.dallas.tx.us Bob Proulx bob@proulx.com diff --git a/configure b/configure index 7f6baa4af..da33d2c63 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.54 for GNU Autoconf 2.54a. +# Generated by GNU Autoconf 2.54a for GNU Autoconf 2.54a. # # Report bugs to . # @@ -854,7 +854,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF GNU Autoconf configure 2.54a -generated by GNU Autoconf 2.54 +generated by GNU Autoconf 2.54a Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. @@ -869,7 +869,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by GNU Autoconf $as_me 2.54a, which was -generated by GNU Autoconf 2.54. Invocation command line was +generated by GNU Autoconf 2.54a. Invocation command line was $ $0 $@ @@ -2287,7 +2287,7 @@ _ASBOX cat >&5 <<_CSEOF This file was extended by GNU Autoconf $as_me 2.54a, which was -generated by GNU Autoconf 2.54. Invocation command line was +generated by GNU Autoconf 2.54a. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -2344,7 +2344,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ GNU Autoconf config.status 2.54a -configured by $0, generated by GNU Autoconf 2.54, +configured by $0, generated by GNU Autoconf 2.54a, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 @@ -2470,6 +2470,9 @@ if $ac_need_defaults; then test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { @@ -2478,17 +2481,17 @@ $debug || } # Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} + { - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { - tmp=$TMPDIR/cs$$-$RANDOM + tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } diff --git a/doc/autoconf.texi b/doc/autoconf.texi index d8ee7f868..4931f8fc0 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -10198,7 +10198,6 @@ None of @command{mkdir}'s options are portable. Instead of @samp{mkdir -p @var{filename}}, you should use use @code{AS_MKDIR_P(@var{filename})} (@pxref{Programming in M4sh}). - @item @command{mv} @c --------------- @prindex @command{mv} @@ -10210,6 +10209,31 @@ but it is not always atomic: when doing @samp{mv new existing}, there's a critical section where neither the old nor the new version of @file{existing} actually exists. +Be aware that moving files from @file{/tmp} can sometimes cause +undesirable (but perfectly valid) warnings, even if you created these +files. On some systems, creating the file in @file{/tmp} is setting a +guid @code{wheel} which you may not be part of. So the file is copied, +and then the @code{chgrp} fails: + +@example +$ @kbd{touch /tmp/foo} +$ @kbd{mv /tmp/foo .} +@error{}mv: ./foo: set owner/group (was: 3830/0): Operation not permitted +$ @kbd{echo $?} +0 +$ @kbd{ls foo} +foo +@end example + +@noindent +This behavior conforms to @acronym{POSIX}: + +@quotation +If the duplication of the file characteristics fails for any reason, mv +shall write a diagnostic message to standard error, but this failure +shall not cause mv to modify its exit status.'' +@end quotation + Moving directories across mount points is not portable, use @command{cp} and @command{rm}. diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4 index 25f367604..61d97b53a 100644 --- a/lib/autoconf/status.m4 +++ b/lib/autoconf/status.m4 @@ -1516,7 +1516,10 @@ m4_ifset([AC_LIST_COMMANDS], ])dnl fi -AS_TMPDIR(cs) +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +AS_TMPDIR([confstat], [.]) _ACEOF ])[]dnl m4_ifval diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index fa2994a56..3da6ab47d 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -789,11 +789,11 @@ m4_define([AS_LITERAL_IF], [$3], [$2])]) -# AS_TMPDIR(PREFIX) -# ----------------- -# Create as safely as possible a temporary directory which name is -# inspired by PREFIX (should be 2-4 chars max), and set trap -# mechanisms to remove it. +# AS_TMPDIR(PREFIX, [DIRECTORY = $TMPDIR [= /tmp]]) +# ------------------------------------------------- +# Create as safely as possible a temporary directory in DIRECTORY +# which name is inspired by PREFIX (should be 2-4 chars max), and set +# trap mechanisms to remove it. m4_define([AS_TMPDIR], [# Create a temporary directory, and hook for its removal unless debugging. $debug || @@ -803,17 +803,17 @@ $debug || } # Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} +m4_if([$2], [], [: ${TMPDIR=/tmp}]) { - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/$1XXXXXX") 2>/dev/null` && + tmp=`(umask 077 && mktemp -d -q "m4_default([$2], [$TMPDIR])/$1XXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { - tmp=$TMPDIR/$1$$-$RANDOM + tmp=m4_default([$2], [$TMPDIR])/$1$$-$RANDOM (umask 077 && mkdir $tmp) } || { - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + echo "$me: cannot create a temporary directory in m4_default([$2], [$TMPDIR])" >&2 AS_EXIT }dnl ])# AS_TMPDIR