Bug 450424 - tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks: 586947
  Show dependency treegraph
 
Reported: 2008-06-08 00:57 EDT by Andrew Schultz
Modified: 2012-03-14 10:12 EDT (History)
7 users (show)

See Also:
Fixed In Version: coreutils-7.6-11.fc12
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 586947 (view as bug list)
Environment:
Last Closed: 2010-03-20 03:54:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Andrew Schultz 2008-06-08 00:57:53 EDT
Description of problem:
When executing a command on a remote host via ssh, I get:
tput: No value for $TERM and no -T specified

This also happens with scp because it ssh's to the remote host and invokes scp
-t.  This does not happen when just ssh'ing to the remote host normally.

Version-Release number of selected component (if applicable):
openssh-5.0p1-3.fc9.i386
I did not see this with openssh from F8.

How reproducible:
always

Steps to Reproduce:
1. ssh remotehost /usr/bin/test
  
Actual results:
tput: No value for $TERM and no -T specified

Expected results:
(nothing)
Comment 1 Tomas Mraz 2008-06-09 13:32:57 EDT
This is message is not caused by a change in openssh package. I cannot reproduce
your problem and also the nonexistent $TERM when executing remote command is
correct. sshd behave this way in previous versions too. It seems that your bash
profile or rc scripts execute the tput command when they shouldn't - that is in
the case the bash is not run in the interactive mode.
Comment 2 Andrew Schultz 2008-06-11 01:56:00 EDT
yup.  I tracked this down to a profile.d script that was executing due to
changes I made to csh.cshrc.
Comment 3 Trevor Cordes 2009-03-17 12:16:30 EDT
Please reopen this bug and set component to coreutils.  This *is* a bug, introduced between F8 and F10.  F8 didn't complain with the same setup.  F10 does.  Maybe a change in tput?

It will only hit users of csh/tcsh.  That is why you didn't reproduce it before.

The problem is in /etc/profile.d/colorls.csh line 20.  You can't have the tput here without a check for whether you have an interactive terminal.  Actually, looking at the code above it is checking $TERM, yet it still is doing a tput even if there is no term.  Perhaps we just need to move the tput stuff up into the if $TERM block.

Quick workaround with no loss of functionality anywhere would care about is to comment out the lines:

#if ( -e "/etc/DIR_COLORS.256color" ) then
#  if ( "`tput colors`" == "256" ) then
#     set COLORS=/etc/DIR_COLORS.256color
#  endif
#endif

I just checked and the stock /etc/csh.cshrc and /etc/csh.login both source the files in /etc/profile.d, so you can't know in the /etc/profile.d/* scripts if you are interactive or not.
Comment 4 satyajeet.deshpande 2009-05-18 03:33:12 EDT
The lines that you have mentioned to be commented out are not present in the /etc/profile.d/colorls.csh file.

Do you know of any other workaround to this problem.
Comment 5 Trevor Cordes 2009-05-20 05:36:39 EDT
Hmm, what Fedora version are you running?
What's your coreutils?  rpm -q coreutils ;
I'm -6.12-20.fc10.i386.  I verified the lines are in my file.

Do a grep tput /etc/profile.d
Wherever you see it in a .csh file, that's where you need to comment it.
Comment 6 satyajeet.deshpande 2009-05-20 08:26:37 EDT
I m using RHEL 5 flavour and the coreutils are -5.97-19.el5. The lines are not present in my file.
Comment 7 Trevor Cordes 2009-05-20 10:17:15 EDT
Hmm, what's important is the computer you are CONNECTING to.  Is the ssh server RHEL5 or something newer?  Did you run the grep I suggested (on the server)?  I'll be shocked if your server doesn't have a tput in the /etc/profile.d

You could also grep the local user setting:  grep tput ~/.csh* ~/.tcsh*
Comment 8 satyajeet.deshpande 2009-05-21 05:48:31 EDT
For the command "grep tput ~/.csh* ~/.tcsh*" I am not getting any output .
I tried the grep that you suggested previously but am not seeing any output there as well. The ssh server is RHEL5 only.
Comment 9 Trevor Cordes 2009-06-11 10:49:11 EDT
Hmm, might be a different bug for Satyajeet, or you're just not finding the hidden tput.  For good measure, run those greps on the client and the server.  Oh, maybe my comment #5 was buggy...  instead run:

grep -r tput /etc/profile.d

You possibly might have to follow any includes (source or .) in any home dir cshrc's and /etc/profile.d's.  It can be convoluted and require a bit of csh knowledge.

You are running a (t)csh, right??  This bug should not hit bash users, which is the vast majority.
Comment 10 Eric Myers 2010-03-02 10:54:57 EST
I found this problem in Fedora 10.  Instead of commenting out the block in /etc/profile.d/colorls.csh I corrected it to read

  if ( "`tty -s && tput colors`" == "256" ) then

That is, put 'tty-s &&' before the tput command to only run tput if on a terminal.
Comment 11 Trevor Cordes 2010-03-19 11:27:05 EDT
This is a good solution.  Does someone want to put this tweak in rawhide?  Why is this bug marked NOTABUG?
Comment 12 Ondrej Vasik 2010-03-20 03:54:04 EDT
Thanks for reassigning, fixed in coreutils-8.4-6.fc14 - closing RAWHIDE.
Comment 13 Fedora Update System 2010-04-28 11:04:46 EDT
coreutils-8.4-6.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/coreutils-8.4-6.fc13
Comment 14 Fedora Update System 2010-04-28 12:06:22 EDT
coreutils-7.6-11.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/coreutils-7.6-11.fc12
Comment 15 Fedora Update System 2010-04-28 14:56:40 EDT
coreutils-7.2-8.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/coreutils-7.2-8.fc11
Comment 16 Fedora Update System 2010-05-04 19:52:44 EDT
coreutils-8.4-6.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 17 Fedora Update System 2010-05-17 15:04:19 EDT
coreutils-7.2-8.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 18 Fedora Update System 2010-05-17 15:07:24 EDT
coreutils-7.6-11.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 19 David Chin 2012-03-14 10:12:50 EDT
I am seeing this error message when connecting to a RHEL6 box. The RHEL6 box has coreutils-8.4-16.el6, and the /etc/profile.d/colorls.csh does reflect the fix by Eric Myers in https://bugzilla.redhat.com/show_bug.cgi?id=450424#c10

Double checked that that 'tty -s' does return 1 when connecting without terminal: ssh remotehost 'tty -s ; echo $?'

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