From fba4a12453db8a80c285745b9208434922b6f379 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Fri, 23 Apr 2004 21:57:42 +0000 Subject: [PATCH] For PR automake/414: Introduce option filename-length-max=99. * doc/automake.texi (Options): Document it. * configure.ac (AM_INIT_AUTOMAKE): Use it. * lib/Automake/Options.pm (_process_option_list): Recognize it. * automake.in (handle_dist): Set FILENAME_FILTER. * lib/am/distdir.am (distdir) [FILENAME_FILTER]: Diagnose long filenames. * tests/fn99.test: New file. * tests/Makefile.am (TESTS): Add fn99.test. --- ChangeLog | 13 ++++++++ Makefile.in | 5 +++ NEWS | 4 +-- automake.in | 6 +++- configure | 71 +++++++++++++++++++++-------------------- configure.ac | 4 +-- doc/automake.texi | 24 +++++++++++++- doc/stamp-vti | 2 +- doc/version.texi | 2 +- lib/Automake/Options.pm | 5 +++ lib/am/distdir.am | 8 ++++- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/fn99.test | 58 +++++++++++++++++++++++++++++++++ 14 files changed, 161 insertions(+), 43 deletions(-) create mode 100755 tests/fn99.test diff --git a/ChangeLog b/ChangeLog index ec525bca..a078439b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-04-23 Alexandre Duret-Lutz + + For PR automake/414: + Introduce option filename-length-max=99. + * doc/automake.texi (Options): Document it. + * configure.ac (AM_INIT_AUTOMAKE): Use it. + * lib/Automake/Options.pm (_process_option_list): Recognize it. + * automake.in (handle_dist): Set FILENAME_FILTER. + * lib/am/distdir.am (distdir) [FILENAME_FILTER]: Diagnose long + filenames. + * tests/fn99.test: New file. + * tests/Makefile.am (TESTS): Add fn99.test. + 2004-04-20 Alexandre Duret-Lutz For PR automake/414: diff --git a/Makefile.in b/Makefile.in index 4e61c31d..5fb2c9ed 100644 --- a/Makefile.in +++ b/Makefile.in @@ -393,6 +393,11 @@ distdir: $(DISTFILES) ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) + @if find $(distdir) -type f -print | \ + grep '^...................................................................................................' 1>&2; then \ + echo 'error: the above filenames are too long' 1>&2; \ + exit 1; \ + else :; fi dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) diff --git a/NEWS b/NEWS index 6939fb73..0bc8c04f 100644 --- a/NEWS +++ b/NEWS @@ -45,8 +45,8 @@ New in 1.8a: * Diagnose AC_CONFIG_AUX_DIR calls following AM_INIT_AUTOMAKE. (PR/49) * Tar format can be chosen with the new options tar-v7, tar-ustar, and - tar-pax. - + tar-pax. The new option filename-length-max=99 helps diagnosing + filenames that are too long for tar-v7. New in 1.8: diff --git a/automake.in b/automake.in index afdb051b..ce074c27 100755 --- a/automake.in +++ b/automake.in @@ -3498,9 +3498,13 @@ sub handle_dist () if rule 'dist-hook'; $transform{'DIST-TARGETS'} = join(' ', @dist_targets); + my $flm = option ('filename-length-max'); + my $filename_filter = $flm ? '.' x $flm->[1] : ''; + $output_rules .= &file_contents ('distdir', new Automake::Location, - %transform); + %transform, + FILENAME_FILTER => $filename_filter); } diff --git a/configure b/configure index e3c326f6..4b448c8a 100755 --- a/configure +++ b/configure @@ -2178,7 +2178,7 @@ esac # Test for things needed by the test suite. echo "$as_me:$LINENO: checking for grep that handles long lines" >&5 echo $ECHO_N "checking for grep that handles long lines... $ECHO_C" >&6 -if test "${oc_cv_path_GREP+set}" = set; then +if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output @@ -2208,6 +2208,7 @@ $debug || echo "$me: cannot create a temporary directory in $TMPDIR" >&2 { (exit 1); exit 1; } } +ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2218,16 +2219,12 @@ do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" test -f "$ac_path_GREP" || continue - if $as_executable_p "$ac_path_GREP"; then + $ac_path_GREP_found || if $as_executable_p "$ac_path_GREP"; then # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP if "$ac_path_GREP" --version 2>&1 < /dev/null | grep 'GNU' >/dev/null; then - ac_cv_path_GREP="$ac_path_GREP" - break 2 - -fi - - + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=: +else ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"$tmp/conftest.in" while : @@ -2237,20 +2234,24 @@ fi cp "$tmp/conftest.in" "$tmp/conftest.nl" echo 'GREP' >> "$tmp/conftest.nl" "$ac_path_GREP" 'GREP$' < "$tmp/conftest.nl" >"$tmp/conftest.out" || break - diff "$tmp/conftest.out" "$tmp/conftest.nl" >/dev/null 2>&1 || break + diff "$tmp/conftest.out" "$tmp/conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_max-0}; then + if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" - ac_max=$ac_count + ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done fi +fi + + $ac_path_GREP_found && break 3 done done + done rm -rf "$tmp" @@ -2268,8 +2269,8 @@ fi fi -echo "$as_me:$LINENO: result: $oc_cv_path_GREP" >&5 -echo "${ECHO_T}$oc_cv_path_GREP" >&6 +echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6 GREP="$ac_cv_path_GREP" @@ -2308,6 +2309,7 @@ $debug || echo "$me: cannot create a temporary directory in $TMPDIR" >&2 { (exit 1); exit 1; } } +ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2318,16 +2320,12 @@ do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" test -f "$ac_path_EGREP" || continue - if $as_executable_p "$ac_path_EGREP"; then + $ac_path_EGREP_found || if $as_executable_p "$ac_path_EGREP"; then # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP if "$ac_path_EGREP" --version 2>&1 < /dev/null | grep 'GNU' >/dev/null; then - ac_cv_path_EGREP="$ac_path_EGREP" - break 2 - -fi - - + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=: +else ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"$tmp/conftest.in" while : @@ -2337,20 +2335,24 @@ fi cp "$tmp/conftest.in" "$tmp/conftest.nl" echo 'EGREP' >> "$tmp/conftest.nl" "$ac_path_EGREP" 'EGREP$' < "$tmp/conftest.nl" >"$tmp/conftest.out" || break - diff "$tmp/conftest.out" "$tmp/conftest.nl" >/dev/null 2>&1 || break + diff "$tmp/conftest.out" "$tmp/conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_max-0}; then + if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" - ac_max=$ac_count + ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done fi +fi + + $ac_path_EGREP_found && break 3 done done + done rm -rf "$tmp" @@ -2409,6 +2411,7 @@ $debug || echo "$me: cannot create a temporary directory in $TMPDIR" >&2 { (exit 1); exit 1; } } +ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2419,16 +2422,12 @@ do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" test -f "$ac_path_FGREP" || continue - if $as_executable_p "$ac_path_FGREP"; then + $ac_path_FGREP_found || if $as_executable_p "$ac_path_FGREP"; then # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP if "$ac_path_FGREP" --version 2>&1 < /dev/null | grep 'GNU' >/dev/null; then - ac_cv_path_FGREP="$ac_path_FGREP" - break 2 - -fi - - + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=: +else ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"$tmp/conftest.in" while : @@ -2437,21 +2436,25 @@ fi mv "$tmp/conftest.tmp" "$tmp/conftest.in" cp "$tmp/conftest.in" "$tmp/conftest.nl" echo 'FGREP' >> "$tmp/conftest.nl" - "$ac_path_FGREP" 'FGREP$' < "$tmp/conftest.nl" >"$tmp/conftest.out" || break - diff "$tmp/conftest.out" "$tmp/conftest.nl" >/dev/null 2>&1 || break + "$ac_path_FGREP" 'FGREP' < "$tmp/conftest.nl" >"$tmp/conftest.out" || break + diff "$tmp/conftest.out" "$tmp/conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_max-0}; then + if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" - ac_max=$ac_count + ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done fi +fi + + $ac_path_FGREP_found && break 3 done done + done rm -rf "$tmp" diff --git a/configure.ac b/configure.ac index e20bb228..6c79e435 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ # Process this file with autoconf to produce a configure script. -# Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify @@ -36,7 +36,7 @@ AC_CANONICAL_BUILD # bothered by `missing'. am_AUTOCONF=${AUTOCONF-autoconf} -AM_INIT_AUTOMAKE([1.6 dist-bzip2]) +AM_INIT_AUTOMAKE([1.6 dist-bzip2 filename-length-max=99]) # The API version is the base version. We must guarantee # compatibility for all releases with the same API version. diff --git a/doc/automake.texi b/doc/automake.texi index e40744fa..414886a0 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -5812,6 +5812,16 @@ Hook @code{dist-zip} to @code{dist}. Hook @code{dist-tarZ} to @code{dist}. @trindex dist-tarZ +@item @code{filename-length-max=99} +@cindex Option, filename-length-max=99 +@trindex filename-length-max=99 +Abort if filenames longer than 99 characters are found during +@code{make dist}. Such long filenames are generally considered not to +be portable in tarballs. See the @code{tar-v7} and @code{tar-ustar} +options below. This option should be used in the top-level +@file{Makefile.am} or as an argument of @code{AM_INIT_AUTOMAKE} in +@file{configure.ac}, it will be ignored otherwise. + @item @code{no-define} @cindex Option, no-define This options is meaningful only when passed as an argument to @@ -5919,6 +5929,17 @@ the source file. For instance if the source file is @item @code{tar-v7} @itemx @code{tar-ustar} @itemx @code{tar-pax} +@cindex Option, tar-v7 +@cindex Option, tar-ustar +@cindex Option, tar-pax +@cindex tar formats +@cindex v7 tar format +@cindex ustar format +@cindex pax format +@trindex tar-v7 +@trindex tar-ustar +@trindex tar-pax + These three mutually exclusive options select the tar format to use when generating tarballs with @code{make dist}. (The tar file created is then compressed according to the set of @code{no-dist-gzip}, @@ -5935,7 +5956,8 @@ implementations and supports filenames with up to 99 characters. When given longer filenames some tar implementations will diagnose the problem while other will generate broken tarballs or use non-portable extensions. Furthermore, the V7 format cannot store empty -directories. +directories. When using this format, consider using the +@code{filename-length-max=99} option to catch filenames too long. @code{tar-ustar} selects the ustar format defined by POSIX 1003.1-1988. This format is believed to be old enough to be portable. diff --git a/doc/stamp-vti b/doc/stamp-vti index 0d3a2687..07fa958e 100644 --- a/doc/stamp-vti +++ b/doc/stamp-vti @@ -1,4 +1,4 @@ -@set UPDATED 20 April 2004 +@set UPDATED 23 April 2004 @set UPDATED-MONTH April 2004 @set EDITION 1.8a @set VERSION 1.8a diff --git a/doc/version.texi b/doc/version.texi index 0d3a2687..07fa958e 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 20 April 2004 +@set UPDATED 23 April 2004 @set UPDATED-MONTH April 2004 @set EDITION 1.8a @set VERSION 1.8a diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm index 85fd3a25..b8b5e53f 100644 --- a/lib/Automake/Options.pm +++ b/lib/Automake/Options.pm @@ -271,6 +271,11 @@ sub _process_option_list (\%$@) { # Explicitly recognize these. } + elsif ($_ =~ /^filename-length-max=(\d+)$/) + { + delete $options->{$_}; + $options->{'filename-length-max'} = [$_, $1]; + } elsif ($_ eq 'tar-v7' || $_ eq 'tar-ustar' || $_ eq 'tar-pax') { error ($where, diff --git a/lib/am/distdir.am b/lib/am/distdir.am index 8561c185..f279650d 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -212,11 +212,17 @@ if %?TOPDIR_P% ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) +if %?FILENAME_FILTER% + @if find $(distdir) -type f -print | \ + grep '^%FILENAME_FILTER%' 1>&2; then \ + echo 'error: the above filenames are too long' 1>&2; \ + exit 1; \ + else :; fi +endif %?FILENAME_FILTER% endif %?TOPDIR_P% - ## --------------------------------------- ## ## Building various distribution flavors. ## ## --------------------------------------- ## diff --git a/tests/Makefile.am b/tests/Makefile.am index 3a690d66..6e1f6411 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -217,6 +217,7 @@ extra6.test \ extra7.test \ f90only.test \ flibs.test \ +fn99.test \ fnoc.test \ fo.test \ fonly.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 94b08ac3..2eaf4db4 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -334,6 +334,7 @@ extra6.test \ extra7.test \ f90only.test \ flibs.test \ +fn99.test \ fnoc.test \ fo.test \ fonly.test \ diff --git a/tests/fn99.test b/tests/fn99.test new file mode 100755 index 00000000..ba537fd6 --- /dev/null +++ b/tests/fn99.test @@ -0,0 +1,58 @@ +#! /bin/sh +# Copyright (C) 2004 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., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Check the filename-length-max=99 option. + +. ./defs || exit 1 + +set -e + +echo AC_OUTPUT >> configure.in + +cat >Makefile.am <<'END' +AUTOMAKE_OPTIONS = filename-length-max=99 +EXTRA_DIST = 12345678 +END + +(for i in 1 2 3 4 5 6 7 8 9 +do + mkdir -p 12345678 || exit 77 + cd 12345678 + touch x +done) + +$ACLOCAL +$AUTOCONF +$AUTOMAKE +./configure +$MAKE distcheck + +(for i in 1 2 3 4 5 6 7 8 9 10 11 +do + mkdir -p 12345678 || exit 77 + cd 12345678 + touch x +done) + +$MAKE dist 2>stderr && exit 1 +cat stderr +grep 'filenames are too long' stderr +test 2 = `grep 12345678 stderr | wc -l` +: -- 2.43.5