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 - Commands piped to ssh result in warning message when they include 'exit'
Summary: Commands piped to ssh result in warning message when they include 'exit'
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: openssh
Version: 4.0
Hardware: i386
OS: Linux
Target Milestone: ---
: ---
Assignee: Tomas Mraz
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2005-07-21 18:28 UTC by Dave Fogarty
Modified: 2007-11-30 22:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-07-22 09:57:55 UTC
Target Upstream Version:

Attachments (Terms of Use)

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:

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.

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