Hide Forgot
Description of problem: The following standard files: /etc/profile.d/colorls.csh from coreutils-8.4-13.el6.x86_64 /etc/profile.d/qt.csh from qt3-3.3.8b-29.el6.x86_64 contain exit statements. This may be a bad idea. If I understand correctly, the above are sourced by csh on login-to-csh. Execution of the exit will immediately kill the shell, making root access impossible in case a system problem (missing directory etc.) causes the exit statements to be run. How reproducible: Didn't try. The problem occurred to me because I had a homegrown script in /etc/profile.d that called exit under obscure circumstances which happened to become true at some point in time, causing grief.
Worksforme without troubles... it just exits from the sourced script and continues with the next one... see the following (I added echo $i to the foreach cycle in csh.cshrc to output sourced .csh scripts): [root@dhcp-24-196 tests]# echo exit > /etc/profile.d/crashme.csh [root@dhcp-24-196 tests]# exit exit [Reset@dhcp-24-196 tests]$ tcsh /etc/profile.d/cobbler.csh /etc/profile.d/colorls.csh /etc/profile.d/crashme.csh /etc/profile.d/cvs.csh /etc/profile.d/glib2.csh /etc/profile.d/gnome-ssh-askpass.csh /etc/profile.d/kde.csh /etc/profile.d/lang.csh /etc/profile.d/less.csh /etc/profile.d/mc.csh /etc/profile.d/qt.csh /etc/profile.d/rh-env.csh /etc/profile.d/vim.csh /etc/profile.d/which2.csh So it just works just fine for me... I tried the same with ssh connection to tcsh acoount - with no issues. Closing NOTABUG, please provide more information how to reproduce the error.
Hi That's pretty interesting. Retested with tcsh, and indeed - no exit. I just assumed that it would do the same as bash, but no. So tcsh has a special handling of "exit" on sourced scripts: it doesn't actually exit if exit is called via a sourced script. Or more likely, exit calls are being explicitely trapped... which does not happen with bash. Unexpected for sure.