[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#265552: pstree indentation doesn't line up in xterm



Thomas Dickey wrote:
> On Fri, Aug 13, 2004 at 09:00:13PM +0200, Joey Hess wrote:
> > Package: xterm
> > Version: 4.3.0.dfsg.1-6
> > Severity: normal
> 
> that's xterm 191?
> 
> e.g., output from
> 	xterm -v

It's 190.

> > The pstree command outputs a process tree, and on a capable terminal
> > such as xterm it will use some kind of escape sequences to display line
> > drawing characters(?). It seems that this sometimes confuses xterm
> > leading to display glitches. Let me try to paste in what I'm seeing:
> 
> "sometimes"(?)
> - I don't see this behavior when I'm looking for it.
> (I saw the previous posting wrt this problem).

I've very confused by the way I see one thing if I run pstree straight, 
and another thing if I redirect its output to a file and cat it. Also,
which lines lack indentation seem to vary by what's in my process tree;
for example right now, only one line of my pstree output is
mis-indented, while there were many when I sent the bug.

> much of the posting is relatively simple.  However -
> 
> > So the indentation is broken with the line drawing characters. At first I
> > assumed this was a pstree bug, but then I straced it:
> > 
> > write(1, "     \33(0\17tq\33(Bxdm\33(0\17qwq\33(BXFree"..., 41     tqxdmqwqXFree86-debug) = 41
> > write(1, "     \33(0\17x\33(B     \33(0\17mq\33(Bxdm\33("..., 80     x     mqxdmqqq.xsessionqwqionqwqfirefo+) = 80
>                  ^^^^^^^^^^^^^^
> This caught my eye though.  It doesn't correspond to one of the terminal
> descriptions in ncurses.  Checking the source (psmisc), I see that it's
> using hardcoded escape sequences in combination with some termcap features.
> It also has some hardcoded behavior which would make it produce garbage
> for ISO-8859-1 text, since it assumes that it must be UTF-8.  (I'm
> looking at the out_char function in pstree.c).  That makes it look like
> a problem in psmisc rather than xterm.

It's surely evil code, see bug #265553.
 
> > The strace shows that pstree is properly indenting the lines that do not
> 
> I'm not certain about "properly" unless I take the whole thing apart.
> I'll look at the typescript (though it seemed mangled by the newsreader).

By "properly" I meant only that each line is indented with a seemingly
appropriate number of spaces, even though xterm does not always display the
leading spaces.

A typescript is a good idea. I've attached one taken with script. When
I did this, and when I play this typescript back with cat, the only line
that is mis-indented is the "xmms" one.

(Note that I use hard-coded escape sequences in my shell's prompt; those
arn't the fault of pstree, but they seem unrelated to this bug.)

> > diplay indented when it's not straced. Also, notice that after each write()
> > output by strace, we see the actual result of the write, and in each case
> > xterm managed this time to display the leading indentation properly.
> > 
> > I sshed around to a few other systems, and pstree on those has the
> > occasional missing indentation too. These systems were running various
> > versions of pstree. I also tried running it in gnome-terminal, and in
> > uxterm, and in both cases it displayed ok. I cleared all X resource
> 
> But when you're running in xterm, what locale?
>
> I don't see the $TERM and locale variables which are in use - those 
> are relevant.

joey@dragon:~>locale
LANG=en_US
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME=C
LC_COLLATE=C
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_PAPER="en_US"
LC_NAME="en_US"
LC_ADDRESS="en_US"
LC_TELEPHONE="en_US"
LC_MEASUREMENT="en_US"
LC_IDENTIFICATION="en_US"
LC_ALL=

joey@dragon:~>echo $TERM
xterm

I'm using the stock debian xterm terminfo file BTW, though I suspect
pstree does not even use it.

-- 
see shy jo

Attachment: typescript
Description: Binary data

Attachment: signature.asc
Description: Digital signature


Reply to: