[FreeNX-kNX] functions defined in /etc/profile.d/* are not set in nx session
Urs Beyerle
urs.beyerle at env.ethz.ch
Fri Mar 13 10:09:23 UTC 2009
Hi
I have investigated a little bit further. The problem occurs because
functions and also aliases defined in the /etc/profile.d scripts are
normally not exported. In case of functions a "export -f functionname"
in the /etc/profile.d script would help. However, in case of aliases
they can not be exported.
In contrast to a "simple" ssh session, a nx session starts an
application (like startkde) within the nxnode script. Somehow functions
and aliases are not passed to the started application - they are lost.
Unfortunately, the scripts inside /etc/profile.d/ are only sourced once
and only in case the shell is a login shell. This is at least the case
for SuSE. I tried to fix this problem in the nxnode script, but had no
success.
At the moment I have the following workaround:
Under SuSE all shells are sourcing the files /etc/bash.bashrc.local (for
bash etc.) or /etc/csh.cshrc.local (for csh, tcsh). In these scripts I
check first, if it's a nx session. If yes, /etc/profile.d are sourced
(again). See the source code of the scripts below.
Maybe this problem is only SuSE specific and does not occur on other
distros.
I hope this may help others seeing this problem too.
Or has somebody an other suggestion/solution?
Cheers,
Urs
# cat /etc/bash.bashrc.local
#
# source /etc/profile.d/*.sh again, if we run a NX session
#
if test -n "$NXSESSIONID" ; then
if test -d /etc/profile.d ; then
for s in /etc/profile.d/*.sh ; do
test -r $s -a ! -k $s && . $s
done
unset s
fi
fi
# cat /etc/csh.cshrc.local
#
# source /etc/profile.d/*.csh again, if we run a NX session
#
if ( ${?NXSESSIONID} ) then
if ( -d /etc/profile.d ) then
foreach _s ( /etc/profile.d/*.csh )
if ( -r $_s ) then
source $_s
endif
end
endif
endif
Urs Beyerle wrote:
> Hi all
>
> I have the following problem with nx: The functions defined in the
> scripts under /etc/profile.d are not set when connecting over nx. They
> are set correctly when connecting over ssh. To reproduce this, just
> compare the output of "declare" between a nx session and a ssh session.
> This problem breaks packages like bash-completion, environment-modules,
> etc. in all nx sessions.
>
> I haven't found out why this happens, since the scripts in
> /etc/profile.d are sourced (by nxnode running . /etc/profile - I guess),
> but the functions defined there are missing afterwards.
>
> I run FreeNX version 0.7.2 (from openSUSE NX repo) and 0.7.3 on openSUSE
> 10.3-11.1 and SLES10. Everywhere the same problem.
>
> I've found some old threads about bash-completion and FreeNX, but not
> really a solution
> http://mail.kde.org/pipermail/freenx-knx/2007-March/004798.html
> http://lists.centos.org/pipermail/centos/2005-October/011281.html
>
> Anybody else seeing this problem too? Has someone an idea what's happening?
>
> Thanks,
>
> Urs
>
>
>
> ________________________________________________________________
> Were you helped on this list with your FreeNX problem?
> Then please write up the solution in the FreeNX Wiki/FAQ:
>
> http://openfacts2.berlios.de/wikien/index.php/BerliosProject:FreeNX_-_FAQ
>
> Don't forget to check the NX Knowledge Base:
> http://www.nomachine.com/kb/
>
> ________________________________________________________________
> FreeNX-kNX mailing list --- FreeNX-kNX at kde.org
> https://mail.kde.org/mailman/listinfo/freenx-knx
> ________________________________________________________________
More information about the FreeNX-kNX
mailing list