On Thu, 14 Oct 2010, dag wrote:

> On Thu, 14 Oct 2010, Maxime Ritter wrote:
>
>> dag wrote:
>>> Quite easy, the block that tests for a functional curses apparently fails
>>> on Ubuntu 10.10. What TERM was set in this case so I can reproduce the
>>> problem and see if another error message makes any sense in this case ?
>>
>> TERM=dumb
>>
>> It's very easy to reproduce : take a Xubuntu i386 10.10 CD, and install
>> it with an unplugged internet connection (or without the package
>> updates, as the fix for Bug #621927 has been released, but didn't catch
>> my mirror). Reboot, run the xfce terminal (default terminal in xubuntu),
>> apt-get install dstat, then run dstat....
>
> Apparently the wrong TERM is not the cause for this. Trying to reproduce
> this on my CentOS system I get:
>
> [...@moria dstat]$ TERM=dumb ./dstat -ta
> ----system---- ----total-cpu-usage---- -dsk/total- -net/total- ---paging-- 
> ---system--
>      time     |usr sys idl wai hiq siq| read  writ| recv  send|  in   out | 
> int   csw
> 14-10 09:57:45|  6   1  92   1   0   0|  29k   50k|   0     0 |4924B 
> 5696B|2408  7228
> 14-10 09:57:46|  2   0  98   0   0   0|   0     0 | 262B  112B|   0     0 | 
> 324   685
>
> So the wrong TERM is not the cause here. Could you remove the try/except
> statement around that block and send me the exception you get ?

Ok, I had some time to look at this and on CentOS 'dumb' is in fact a real 
termcap entry that does not support colors. But if I instead use something 
fake, I get this:

[...@moria dstat]$ TERM=dag dstat -ta
Color support is disabled, python-curses is not installed.
----system---- ----total-cpu-usage---- -dsk/total- -net/total- ---paging-- 
---system--
      time     |usr sys idl wai hiq siq| read  writ| recv  send|  in   out | 
int   csw
14-10 19:39:25|  2   0  98   0   0   0|  77k   70k|   0     0 |   0     0 | 318 
  637
14-10 19:39:26|  1   1  99   0   0   0|   0     0 |   0     0 |   0     0 | 547 
 1389

So I have now fixed this to display:

[...@moria dstat]$ TERM=dag ./dstat -ta
Color support is disabled as terminal (TERM=dag) does not support colors.
----system---- ----total-cpu-usage---- -dsk/total- -net/total- ---paging-- 
---system--
      time     |usr sys idl wai hiq siq| read  writ| recv  send|  in   out | 
int   csw
14-10 19:40:06|  2   0  98   0   0   0|  77k   70k|   0     0 |   0     0 | 318 
  638
14-10 19:40:07|  1   1  99   0   0   0|   0    16k|   0     0 |   0     0 | 515 
 1210

The fix was quite simple:

----
def gettermcolor(color=True):
     "Return whether the system can use colors or not"
     if color and sys.stdout.isatty():
         try:
             import curses
             curses.setupterm()
             if curses.tigetnum('colors') < 0:
                 return False
         except ImportError:
             print >>sys.stderr, 'Color support is disabled as python-curses is 
not installed.'
             return False
         except:
             print >>sys.stderr, 'Color support is disabled as terminal 
(TERM=%s) does not support colors.' % os.getenv('TERM')
             return False
     return color
----

Thanks for reporting !
-- 
--   dag wieers,  d...@wieers.com,  http://dag.wieers.com/   --
[Any errors in spelling, tact or fact are transmission errors]

-- 
dstat lost color support in ubuntu 10.10
https://bugs.launchpad.net/bugs/660181
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to