This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] fix testsuite ldscripts problem
* Dave Korn wrote on Wed, Oct 27, 2010 at 01:37:26AM CEST:
> On 26/10/2010 21:22, Ralf Wildenhues wrote:
> > * Dave Korn wrote on Mon, Oct 25, 2010 at 10:23:18PM CEST:
> >> -check-DEJAGNU: site.exp
> >> +ldscripts-link:
> >> + -eval "x`$(LIBTOOL) --config | $(GREP) ^objdir=`" && \
By the way, *really* old shells interpret unquoted ^ as synonym to |
(single quotes are safe here around ^objdir=, unlike double quotes).
> >> + if test -d $$xobjdir; then \
> >> + test ! -e $$xobjdir/ldscripts \
> >> + && $(LN_S) ../ldscripts $$xobjdir/ldscripts; \
> > Besides, Solaris /bin/sh test does not have -e, so you might want to
> > prefer -f or -r if you're still going to use the test.
>
> Surely -f isn't right? I think that checks for a regular file, and I do not
> know whether a link would necessarily count as one.
If the link points to a regular file, then yes.
Since you link to a directory (sorry for not realizing this sooner),
$(LN_S) won't work anyway if it's not 'ln -s', so at that point you'd
probably have to mkdir and cp -p or cp -R anyway. test -d should
otherwise work also for symlinks to directories.
> I really only want to
> check for existence of any kind at all, I don't care what because if someone's
> already created 'ldscripts' in the objdir, they must know what they're doing,
> it wouldn't just happen by accident. So I want the simplest portable
> existence test of any kind. I don't even want to care if it's readable,
> although I suppose it wouldn't matter either way if it's not. What's the best
> most portable way to just test for existence?
One of test -r, test -x, test -f. Or, given you have suitable
permissions in its enclosing directory, trying to mkdir it, and seeing
that fail. ;-)
Cheers,
Ralf