Hello,

On Fri, Oct 21, 2005 at 09:49:58AM +0200, Harald Dunkel wrote:
> Something like
> 
>       IFS=:; for d in a:b; do echo $d; done
> 
> works for Sun's /bin/sh, but not for Bash 2.05b (even if you
> use --posix). The Bash folks say that this has been done to
> fix a security hole.

I've just checked POSIX: it seems that word splitting is not allowed there.
So my code was wrong, sorry.

> I have another concern: In your version $(srcdir) gets
> a higher priority than the $(VPATH) set in Makefile.am.

Yes, you are right: we should simply obey VPATH.

(I think that VPATH should always start with @srcdir@, otherwise the VPATH
and non-VPATH builds wouldn't be consistent.  But there is no good to try
to enforce the rule here.)

> So how about this?

Your proposal looks good, except I think it might be better to use single
quotes around $(VPATH).
And the quoting around $d, which I introduced, is redundant.

That yields:

        `IFS=:; x=':$(VPATH)'; \
        for d in $$x; do \
                test -n $$d && d=$$d/; \
                test -f $${d}%SOURCE% && echo $$d && break;
        done`%SOURCE%

Have a nice day,
        Stepan Kasal


Reply via email to