COMMAND
CDE
SYSTEMS AFFECTED
HP 9000 series 700/800 at HpUX revision 10.X
PROBLEM
Following is based on HP Support Information Digests. The PATH
environemnt variable is constructed from several sources
including dtsearchpath and scripts in /etc/dt/config/Xsession.d/
and /usr/dt/config/Xsession.d/. The resulting PATH contains the
string "::" which will be interpreted as the current directory.
The root user should not have the current directory in the PATH.
SOLUTION
Since the PATH environment variable can be affected by
dtsearchpath and several scripts, the recommended solution is to
clean up the root user's PATH after is has been created. In
/usr/dt/bin/Xsession just before this:
# ###########################################################################
#
# Startup section.
Add this:
###################### Clean up $PATH for root ##########################
if [ "$USER" = "root" ]
then
Log "Clean up PATH for root user"
Log "Old PATH = $PATH"
PATH=`echo $PATH | awk '
{
# Remove elements from PATH that are
# (a) "."
# (b) ""
# (c) blank
#
gsub (" ",":", $0) # Substitite ":" for each blank
n = split ($0, path, ":") # Split into elements with ":" as delimiter
first = 1 # To suppress leading ":" in new PATH
for (i=1; i<=n; i++) {
len = length(path[i])
dot = index(path[i], ".")
dot_only = 0
if ((len == 1) && (dot==1)) {
dot_only = 1
}
# print element if it is not "" and not "."
if (!(len==0) && !(dot_only==1)) {
if(first != 1) {
printf (":") # if not first element, print ":" in front
}
printf ("%s",path[i])
first = 0
}
}
}
END { printf ("\n") }'`
Log "New PATH = $PATH"
fi
###################### End - Clean up $PATH for root ####################