From: Ralf Wildenhues Date: Thu, 29 Mar 2007 23:26:48 +0000 (+0000) Subject: * lib/mdate-sh (ls_command): Use -n when available to avoid X-Git-Tag: v1.10b~258 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c594b6132ea84dfa00cc3d77ebd6567d95e94f3;p=thirdparty%2Fautomake.git * lib/mdate-sh (ls_command): Use -n when available to avoid problems with spaces in user/group names. * tests/mdate5.test: New test. * tests/Makefile.am: Adjust. --- diff --git a/ChangeLog b/ChangeLog index 4579c0521..03ee3c44f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-03-30 Eric Blake + Ralf Wildenhues + + * lib/mdate-sh (ls_command): Use -n when available to avoid + problems with spaces in user/group names. + * tests/mdate5.test: New test. + * tests/Makefile.am: Adjust. + 2007-03-30 Ralf Wildenhues * automake.in (handle_tests): Rewrite XFAIL_TESTS just like diff --git a/lib/mdate-sh b/lib/mdate-sh index cd916c0a3..83d27009d 100755 --- a/lib/mdate-sh +++ b/lib/mdate-sh @@ -1,9 +1,9 @@ #!/bin/sh # Get modification time of a file or directory and pretty-print it. -scriptversion=2005-06-29.22 +scriptversion=2007-03-30.02 -# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005 Free Software +# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007 Free Software # Foundation, Inc. # written by Ulrich Drepper , June 1995 # @@ -75,6 +75,10 @@ if ls -L /dev/null 1>/dev/null 2>&1; then else ls_command='ls -l -d' fi +# Avoid user/group names that might have spaces, when possible. +if ls -n /dev/null 1>/dev/null 2>&1; then + ls_command="$ls_command -n" +fi # A `ls -l' line looks as follows on OS/2. # drwxrwx--- 0 Aug 11 2001 foo @@ -89,7 +93,7 @@ fi # words should be skipped to get the date. # On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. -set x`ls -l -d /` +set x`$ls_command /` # Find which argument is the month. month= diff --git a/tests/Makefile.am b/tests/Makefile.am index afa698b23..df6ff8760 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -367,6 +367,7 @@ mdate.test \ mdate2.test \ mdate3.test \ mdate4.test \ +mdate5.test \ missing.test \ missing2.test \ missing3.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 7ca66fbfa..f45ba3ea0 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -500,6 +500,7 @@ mdate.test \ mdate2.test \ mdate3.test \ mdate4.test \ +mdate5.test \ missing.test \ missing2.test \ missing3.test \ diff --git a/tests/mdate5.test b/tests/mdate5.test new file mode 100755 index 000000000..085563a5d --- /dev/null +++ b/tests/mdate5.test @@ -0,0 +1,48 @@ +#! /bin/sh +# Copyright (C) 1999, 2001, 2002, 2004, 2007 Free Software Foundation, +# Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Automake is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Automake; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +# Test to make sure mdate-sh works correctly. + +. ./defs || exit 1 +set -e + +cat >> configure.in << 'END' +AC_OUTPUT +END + +cat > Makefile.am << 'END' +info_TEXINFOS = textutils.texi +END + +cat > textutils.texi << 'END' +@include version.texi +@setfilename textutils.info +END + +$ACLOCAL +$AUTOMAKE --add-missing + +set x `$SHELL ./mdate-sh Makefile.am` +shift +# Check that mdate output looks like a date: +test $# = 3 +case $1$3 in *[!0-9]*) exit 1;; esac +test $1 -lt 32