Description of problem: This was initially raised by Jack Neely (jjneely, see bz #186931, comment #3) and verified to be present in RHEL 4.4 Version-Release number of selected component (if applicable): less-382-4.rhel4.i386 How reproducible: always Steps to Reproduce: 1.Create /etc/profile.d/test.csh that contains: --- #!/bin/tcsh echo "FOO" --- 2.Login as a user with tcsh as the default shell 3.Run: less /etc/hosts Actual results: You see the word "FOO" displayed rather than the text of /etc/hosts Expected results: the text of /etc/hosts Additional info: less does a popen("/bin/tcsh -c /usr/bin/lesspipe.sh /etc/hosts") where the shell is gotten from the users default shell.
This is caused by a processing of scripts /etc/profile.d/* in non-interactive mod of tcsh. When tcsh is executed, then all scripts in /etc/profile.d/*.csh are executed too. Even in non-interactive mod. But in this mod, tcsh should not execute those scripts. This bad behavior leads to problems, because a less is confused. Then the less accepts as a input a text from echo instead a text from /etc/hosts. The solution is to reflect non-interactive mod in /etc/csh.cshrc. I'll attach a patch, which solve this. Zdenek
Created attachment 265921 [details] patch to fix non-interactive mod of tcsh
Very simple fix, proposing for RHEL-4.8 FasTrack. Read ya, Phil
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2008-0130.html
This fix caused regression - bug #464788. In my opinion fix should be reverted because it is impossible fix both #202468 and #464788.
Created attachment 322565 [details] Patch to fix non-interactive mod of tcsh (and keep path definition processing) I guess both issues could be solved together by redirecting stdout and stderr to /dev/null for noninteractive shells ... tried following patch and it works for me in both cases.