automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Check that symlinks are resolved by `make dist'.


From: Ralf Wildenhues
Subject: Re: [PATCH] Check that symlinks are resolved by `make dist'.
Date: Sun, 4 Apr 2010 09:00:19 +0200
User-agent: Mutt/1.5.20 (2009-10-28)

Hello Stefano,

* Stefano Lattarini wrote on Fri, Apr 02, 2010 at 12:29:49AM CEST:
> > I'll write a couple of tests soonish, making them SKIP'd if `ln -s'
> > fails, or if `test -h' fails when applied to the resulting
> >  "symlink".

Why?  I mean, it's fine to skip if 'ln -s' fails outright, but if it's
emulated by 'cp -p', there is no need to skip the test?

> > By the way, how is the Automake-generated Makefile expected to
> >  behave if a file in e.g. EXTRA_DIST is a broken symlink,
> ... this is still not tested (I don't know what result should be 
> expected in such a situation), and...

Well, what happens currently?  (I hope 'make dist' fails.)

> >  or a symlink pointing to a directory?
> ... the test for this is xfailing, since a symlink pointing to a 
> directory is not expanded to the corresponding directory when
> copied in $(distdir); this is probably due to the use of `cp -fpR'
> as "directory-copying command" in distdir.am, where the `-R'
> option causes GNU cp not to resolve symlinks -- POSIX seems to
> leave unspecified the behaviour of `cp -R' w.r.t. symlinks, if I
> understand correctly the description at:
>  <http://www.opengroup.org/onlinepubs/009695399/utilities/cp.html>
> 
> So what is the right thing to do about this -- patch distdir.am or 
> modify the semantic of the new test?

I don't think expanding the directory is desirable in this case.  It
could easily lead to file explosion.  I'm not sure whether to leave that
open as loop-hole for people wanting symlinks in the distribution, or to
offer an Automake option not to expand symlinks at all.

We don't need to hurry to define this unless and until we have a good
way to do so.  Let's leave this undefined.

> From ee859147f10c073a6d7bae822e6a4eb259f35e94 Mon Sep 17 00:00:00 2001
> From: Stefano Lattarini <address@hidden>
> Date: Wed, 31 Mar 2010 23:41:01 +0200
> Subject: [PATCH] Check that symlinks are resolved by `make dist'.
> 
> * tests/distsolvelinks.test: New test.

make that s/distsolvelinks/distlinks/ or so, that should be clear
enough.

> * tests/distsolvelinksdir.test: Likewise.
> * tests/Makefile.am (TESTS, XFAIL_TESTS): Updated accordingly.
> Suggested by observations from Ralf Wildenhues.


> --- /dev/null
> +++ b/tests/distsolvelinks.test

> +# Check that distributed symlinks in the source tree will be expanded
> +# as regular files in $(distdir).
> +
> +. ./defs || Exit 1
> +
> +set -e
> +
> +echo text > file
> +
> +ln -s file lnk \

> +  && cmp file lnk \
> +  && test -h lnk \
> +  && test ! -h file \

You can just omit these three lines I think,

> +  || {
> +    echo "$me: cannot make and/or detect symlinks" >&2

... and adjust the message.

> +    Exit 77
> +  }
> +
> +mkdir A
> +mkdir B
> +echo aaa > A/aaa
> +cd B
> +ln -s ../A/aaa bbb
> +cd ..
> +
> +echo FooBarBaz > foo
> +
> +ln -s foo  bar1
> +ln -s bar1 bar2
> +ln -s bar2 bar3
> +
> +ln -s "`pwd`/foo" quux
> +
> +echo AC_OUTPUT >>configure.in
> +
> +cat > Makefile.am << 'END'
> +EXTRA_DIST = lnk B/bbb bar1 bar2 bar3 quux
> +.PHONY: printdistdir
> +printdistdir:
> +     @echo $(distdir)
> +END
> +
> +ls -l . A B
> +
> +$ACLOCAL
> +$AUTOCONF
> +$AUTOMAKE
> +
> +./configure
> +$MAKE distdir
> +distdir=`$MAKE printdistdir` || Exit 1

Don't try to get variables set through output from 'make', that's very
error-prone.  Instead, move this:

> +ls -l $distdir $distdir/B
> +
> +set  file lnk  A/aaa B/bbb  foo quux  foo bar1  foo bar2  foo bar3
> +while test $# -gt 0; do
> +  file=$1; shift; link=$1; shift;
> +  test -f $distdir/$link
> +  test ! -h $distdir/$link
> +  diff $file $distdir/$link
> +done

into a rule in the makefile, as is done in several other tests.
That rule can just have 'distdir' as prerequisite.

Thanks,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]