Bug 299221

Summary: less breaks if its startup script outputs anything
Product: Red Hat Enterprise Linux 5 Reporter: Jack Neely <jjneely>
Component: setupAssignee: Phil Knirsch <pknirsch>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 5.0CC: jjneely, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-02-22 16:17:09 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: 202468    
Bug Blocks:    
Attachments:
Description Flags
patch to fix non-interactive mod of tcsh none

Description Jack Neely 2007-09-20 20:17:32 UTC
+++ This bug was initially created as a clone of Bug #202468 +++

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.

I've verified this bug exists in RHEL 5 with less-394-5.el5

Comment 1 Zdenek Prikryl 2007-11-21 12:18:16 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:18:46 UTC
Created attachment 265931 [details]
patch to fix non-interactive mod of tcsh

Comment 3 Phil Knirsch 2008-02-22 16:17:09 UTC
Thanks, including fix in next rawhide package.

Read ya, Phil