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, 11 Apr 2010 20:07:27 +0200
User-agent: Mutt/1.5.20 (2009-10-28)

Hello Stefano,

* Stefano Lattarini wrote on Sun, Apr 04, 2010 at 08:57:19PM CEST:
> At Sunday 04 April 2010, Ralf Wildenhues wrote:
> > * Stefano Lattarini wrote on Fri, Apr 02, 2010 at 12:29:49AM CEST:
> > > > 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.)
> Yep, `make distdir' fails (and thus `make dist' fails too).

Good.

> Let's assume that a broken symlink `lnk' is added to EXTRA_DIST.
> GNU make 3.81 and 3.75 fail with:
>   make: *** No rule to make target `lnk', needed by `distdir'.  Stop.
> Heirloom make "@(#)make.sl  1.40 (gritter) 3/15/07" fails with:
>   make: fatal error: don't know how to make lnk1 (bu42)
> Debian freebsd-make (from package "freebsd-buildutils", version 7.2-1) 
> fails with:
>   make: don't know how to make lnk. Stop
> 
> However, these are not very clear error messages IMHO.

But that's something we can not easily solve in Automake.  Improving
error messages from 'make' really has to be done within 'make' itself.

> > > +distdir=`$MAKE printdistdir` || Exit 1
> > 
> > Don't try to get variables set through output from 'make', that's
> >  very error-prone.
> That was necessary with my previous "paranoid" approach, as I checked
> that `test -h' and worked correctly *for the current shell* only, not
> for the one spawned by $MAKE to execute target-associated commands.

You could have moved the test for 'test -h' into the make rule as well.
But this is moot now anyway.

> Subject: [PATCH] Check that symlinks are resolved by `make dist'.
> 
> * tests/distlinks.test: New test.
> * tests/Makefile.am (TESTS): Updated accordingly.
> Suggested by observations from Ralf Wildenhues.

This is good, thanks.  I've applied the patch with two minor changes:

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

> +ln -s file lnk || {
> +  echo "$me: cannot make symlinks" >&2

I replaced this with 'cannot create symlinks to files', because that is
more accurate,

> +  Exit 77
> +}
> +

> +test: distdir
> +     ls -l $(distdir) $(distdir)/B
> +     fail() { echo "$(me): $$*" >&2; e=1; }; \
> +     e=0; \
> +     set file lnk A/aaa B/bbb foo quux foo bar1 foo bar2 foo bar3; \
> +     while test $$# -gt 0; do \

and used '-ge 2' here, so the second 'shift' won't cause the shell to
barf even if I inadvertently add an odd number of arguments.

> +       file=$$1; shift; link=$(distdir)/$$1; shift; \
> +       test -f $$link || fail "$$link is not a regular file"; \
> +       test ! -h $$link || fail "$$link is a symlink"; \
> +       diff $$file $$link || fail "$$link differs from $$file"; \
> +     done; \

Thanks,
Ralf




reply via email to

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