Bug 202468

Summary: less breaks if its startup script outputs anything
Product: Red Hat Enterprise Linux 4 Reporter: Jakub Hrozek <jhrozek>
Component: setupAssignee: Phil Knirsch <pknirsch>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4CC: atkac, jjneely, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2008-0130 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-03-05 12:30:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 299221    
Attachments:
Description Flags
patch to fix non-interactive mod of tcsh
none
Patch to fix non-interactive mod of tcsh (and keep path definition processing) none

Description Jakub Hrozek 2006-08-14 17:35:56 UTC
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.

Comment 1 Zdenek Prikryl 2007-11-21 12:14:35 UTC
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

Comment 2 Zdenek Prikryl 2007-11-21 12:16:33 UTC
Created attachment 265921 [details]
patch to fix non-interactive mod of tcsh

Comment 3 Phil Knirsch 2008-02-22 16:19:41 UTC
Very simple fix, proposing for RHEL-4.8 FasTrack.

Read ya, Phil

Comment 9 errata-xmlrpc 2008-03-05 12:30:44 UTC
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


Comment 10 Adam Tkac 2008-10-07 08:56:49 UTC
This fix caused regression - bug #464788. In my opinion fix should be reverted because it is impossible fix both #202468 and #464788.

Comment 11 Ondrej Vasik 2008-11-05 13:13:11 UTC
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.