On 11/04/2008, at 12:03 AM, Nathan Scott wrote:
Hi all,
The snippit of code below from pcp.env fills me with fear
and loathing. I know James is not a big fan either. :)
The explicit setting of LD_LIBRARY_PATH on Solaris gives
me some security concerns (this is used by the PCP start
and cron scripts, so is often executed as root) - it's
better to do that stuff through the /etc/ld.so.conf.d/
equivalent in Solaris, not here. The Solaris-specific
part then specifies /usr/local/bin, which is respecified
later - a bit odd.
Also, theres no way to extend the PATH seen by PMDAs. I
hit a situation yesterday where it would've been really
useful to have a configuration hook there.
Finally, every time we run PCP scripts, we potentially
have to go off and stat an ever-increasing number of
directories, many being there for other platforms, which
just isn't a clean design.
So, I'm thinking:
- the Solaris piece should be completely removed
yes
- the platform-specific part could be replaced by a
pcp.conf variable $PCP_PLATFORM_PATHS, which sysadmins
can add to if they have "special" PATH needs for custom
PMDAs, like me!
Sounds OK. IMHO PCP should (by default) only look in the minimum set
of paths ... /usr/bin and friends
This is the current code, read it and weep:
# This needs to be the union of directories in which PCP tools may
expect
# to find executable commands ...
#
PATH=""
if [ "$PCP_PLATFORM" = solaris ]
then
# GNU tools and libs hide in /usr/local ... make sure we find these
# early enough in the searching
#
PATH=/usr/local/bin:
LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
fi
PATH=$PATH/usr/sbin:/sbin:/bin:/usr/bin:/etc:${PCP_BIN_DIR}:
${PCP_BINADM_DIR}:${PCP_SHARE_DIR}/bin:${PCP_SHARE_DIR}/lib \
# the more obscure ones are conditional
#
for dir in /usr/bsd /usr/etc /usr/bin/X11 /usr/local/bin \
/opt/sfw/bin /usr/ccs/bin /cygdrive/c/WINDOWS/system32 \
/usr/contrib/bin /opt/local/bin
do
[ -d $dir ] || continue
echo "$PATH" | egrep ":$dir(:|\$)" >/dev/null && continue
PATH=$PATH:$dir
done
export PATH
New version:
PATH=/usr/sbin:/sbin:/bin:/usr/bin:/etc:${PCP_BIN_DIR}:
${PCP_BINADM_DIR}:${PCP_SHARE_DIR}/bin:${PCP_SHARE_DIR}/lib:
${PCP_PLATFORM_PATHS}
And PCP_PLATFORM_PATHS can be set to an explicit value inside
the configure script (so theres a bit of extra code in there
to be fair, but no runtime code).
Finally, can someone with access to the original rlog verify
and fill in the blanks in this platform<->path mapping:
/usr/bsd - FreeBSD
/usr/etc - IRIX
/usr/bin/X11 - UNIX platforms
/usr/local/bin - UNIX platforms
/opt/sfw/bin - ?
Sun Freeware
/usr/ccs/bin - ?
solaris BSD compat subsystem?
/cygdrive/c/WINDOWS/system32 - Windows/Cygwin
/usr/contrib/bin - ?
/opt/local/bin - Mac OS X
MacPorts - There is the fink project, which sold we /sw/bin
cheers.
--
Nathan
|