This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Re: base-files: Does not permit the use of symlinks in /etc/profile.d/
- From: ericblake at comcast dot net (Eric Blake)
- To: Cygwin Apps <cygwin-apps at cygwin dot com>
- Date: Sat, 17 Sep 2005 17:08:19 +0000
- Subject: Re: base-files: Does not permit the use of symlinks in /etc/profile.d/
> > Sorry, didn't realise. If I change the line
> >
> > /bin/find /etc/profile.d -type f -iname '*.sh' -or -iname '*.zsh'
> >
> > to be
> >
> > /bin/find -L /etc/profile.d -type f -iname '*.sh' -or -iname '*.zsh'
> >
> > would that fix things? (The -L tells find to follow the link and make
> > decisions based on the actual file AFAICT).
>
> Would find then apply the -iname tests to the link destination too, then?
True - once you turn on -L, all the tests are applied to the destination.
Also, the existing code is redundant (find has already proven the
file exists and is regular, so the [ -f "${f}" ] is unneeded), and buggy,
since it tries to source non-files named *.zsh, as though it were written:
\( -type f -a -iname '*.sh' \) -o -iname '*.zsh'
So how about this:
if [ -d "/etc/profile.d" ]; then
for f in `/bin/find /etc/profile.d -xtype f \( -iname '*.sh' -o -iname '*.zsh' \) | LC_ALL=C sort`
do
. "$f"
done
fi
> That would be a potential confusion. How about using \( -type f -o -type l
> \) ?
-type l won't cut it, because it gets false positives on a symlink to a directory.
--
Eric Blake