Bug 450424 - tput: No value for $TERM and no -T specified
Summary: tput: No value for $TERM and no -T specified
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: 586947
TreeView+ depends on / blocked
Reported: 2008-06-08 04:57 UTC by Andrew Schultz
Modified: 2012-03-14 14:12 UTC (History)
7 users (show)

Fixed In Version: coreutils-7.6-11.fc12
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 586947 (view as bug list)
Last Closed: 2010-03-20 07:54:04 UTC
Type: ---

Attachments (Terms of Use)

Description Andrew Schultz 2008-06-08 04:57:53 UTC
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):
I did not see this with openssh from F8.

How reproducible:

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

Expected results:

Comment 1 Tomas Mraz 2008-06-09 17:32:57 UTC
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 05:56:00 UTC
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 16:16:30 UTC
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

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 07:33:12 UTC
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 09:36:39 UTC
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 12:26:37 UTC
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 14:17:15 UTC
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 09:48:31 UTC
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 14:49:11 UTC
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 15:54:57 UTC
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 15:27:05 UTC
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 07:54:04 UTC
Thanks for reassigning, fixed in coreutils-8.4-6.fc14 - closing RAWHIDE.

Comment 13 Fedora Update System 2010-04-28 15:04:46 UTC
coreutils-8.4-6.fc13 has been submitted as an update for Fedora 13.

Comment 14 Fedora Update System 2010-04-28 16:06:22 UTC
coreutils-7.6-11.fc12 has been submitted as an update for Fedora 12.

Comment 15 Fedora Update System 2010-04-28 18:56:40 UTC
coreutils-7.2-8.fc11 has been submitted as an update for Fedora 11.

Comment 16 Fedora Update System 2010-05-04 23:52:44 UTC
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 19:04:19 UTC
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 19:07:24 UTC
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 14:12:50 UTC
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.