Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 163869

Summary: Commands piped to ssh result in warning message when they include 'exit'
Product: Red Hat Enterprise Linux 4 Reporter: Dave Fogarty <dave>
Component: opensshAssignee: Tomas Mraz <tmraz>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: low Docs Contact:
Priority: medium    
Version: 4.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-07-22 09:57:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Dave Fogarty 2005-07-21 18:28:09 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050720 Fedora/1.0.6-1.1.fc3 Firefox/1.0.6

Description of problem:
When I echo a command and pipe it to ssh everything normally works fine.  However, when that command contains an 'exit' statement, I get this error:

TERM environment variable not set.

When I test using a set -x, it seem to be related to the "clear" command in .bash_logout.

This applies to Fedora Core 3, RHES3, and RHES4 but NOT RHES2.1.




Version-Release number of selected component (if applicable):
openssh-3.9p1-8.RHEL4.4 bash-3.0-19.2

How reproducible:
Always

Steps to Reproduce:
1. echo 'exit 0' | ssh -T localhost

Actual Results:  [doughnut@shoe ~]$ echo 'exit 0' | ssh -T localhost
TERM environment variable not set.
[doughnut@shoe ~]$ echo 'set -x ; exit 0' | ssh -T localhost
+ exit 0
++ clear
TERM environment variable not set.
[doughnut@shoe ~]$


Expected Results:  Commands that don't involve exit work like expected:

[doughnut@shoe ~]$ echo 'set -x ; sleep 0' | ssh -T localhost
+ sleep 0
[doughnut@shoe ~]$


Additional info:

Our RHES2.1 box works fine.  The clear is there, but no warning:

[doughnut@shoe ~]$ echo 'set -x ; exit 0' | ssh -T brie
+ exit 0
++ clear
[doughnut@shoe ~]$

Comment 1 Tomas Mraz 2005-07-22 09:57:55 UTC
The difference between RHEL2.1 and newer releases are probably in that the
warning was not issued by the clear program in the older release. However it
doesn't make much sense to run the clear binary anyway.

Use: echo "set -x; exit 0" | ssh localhost bash

This way the bash invoked from ssh is not a login shell and the unnecessary
clear command is not issued when exiting.