Bug 202468 - less breaks if its startup script outputs anything
less breaks if its startup script outputs anything
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: setup (Show other bugs)
4.4
All Linux
medium Severity medium
: ---
: ---
Assigned To: Phil Knirsch
:
Depends On:
Blocks: 299221
  Show dependency treegraph
 
Reported: 2006-08-14 13:35 EDT by Jakub Hrozek
Modified: 2015-03-04 20:17 EST (History)
3 users (show)

See Also:
Fixed In Version: RHBA-2008-0130
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-03-05 07:30:44 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch to fix non-interactive mod of tcsh (618 bytes, patch)
2007-11-21 07:16 EST, Zdenek Prikryl
no flags Details | Diff
Patch to fix non-interactive mod of tcsh (and keep path definition processing) (547 bytes, patch)
2008-11-05 08:13 EST, Ondrej Vasik
no flags Details | Diff

  None (edit)
Description Jakub Hrozek 2006-08-14 13:35:56 EDT
Description of problem:
This was initially raised by Jack Neely (jjneely@ncsu.edu, 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 07:14:35 EST
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 07:16:33 EST
Created attachment 265921 [details]
patch to fix non-interactive mod of tcsh
Comment 3 Phil Knirsch 2008-02-22 11:19:41 EST
Very simple fix, proposing for RHEL-4.8 FasTrack.

Read ya, Phil
Comment 9 errata-xmlrpc 2008-03-05 07:30:44 EST
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 04:56:49 EDT
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 08:13:11 EST
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.

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