Bug 299221 - less breaks if its startup script outputs anything
Summary: less breaks if its startup script outputs anything
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: setup
Version: 5.0
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
: ---
Assignee: Phil Knirsch
QA Contact:
URL:
Whiteboard:
Depends On: 202468
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-09-20 20:17 UTC by Jack Neely
Modified: 2015-03-05 01:19 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-02-22 16:17:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch to fix non-interactive mod of tcsh (618 bytes, patch)
2007-11-21 12:18 UTC, Zdenek Prikryl
no flags Details | Diff

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


Note You need to log in before you can comment on or make changes to this bug.