Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 503366 - app-portage/gentoolkit-0.3.0.8-r2: "eshowkw -T versionlist" garbled output
Summary: app-portage/gentoolkit-0.3.0.8-r2: "eshowkw -T versionlist" garbled output
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-04 00:21 UTC by Ulrich Müller
Modified: 2022-07-10 23:13 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Müller gentoo-dev 2014-03-04 00:21:46 UTC
When redirecting output of "eshowkw -T versionlist" to a file, alignment between columns is broken:

Keywords for app-editors/zile:
       |     [
       |     I
       |     ]
       | 2   2
       | . 2 .
       | 3 . 4
       | . 4 .
       | 2 . 1
       | 4 9 1
       | r    
       | 1    
      -+------
------ | + + ~
 alpha | + + ~
 amd64 | o + ~
   arm | o o o
 arm64 | o o o
  hppa | o o o
  ia64 | o o o
  m68k | o o o
  mips | + + ~
   ppc | o o o
 ppc64 | o o o
  s390 | o o o
    sh | + + ~
 sparc | + + ~
   x86-+------
------ | # o o
unused | 0    
  slot-+------
------ | g g g
  repo | e e e
       | n n n
       | t t t
       | o o o
       | o o o

(Note that the first version should be 2.3.24-r1 but is shown as 2.3.24r1 without the hyphen. Maybe this is related?)

Surprisingly, the problem only shows with output redirection. Alignment is fine when displaying on a terminal.
Comment 1 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2016-12-12 00:58:47 UTC
This bug is still present here Dec 2016.

Amusingly, there's a workaround:

1. Force -C 
2. Pipe through ansifilter instead


Which suggests the problem is not so much with redirection,
the problem is in the colour handling (which happens to be toggled by redirection)
Comment 2 Ulrich Müller gentoo-dev 2022-06-07 09:10:49 UTC
ping
Comment 3 Brian Dolbec (RETIRED) gentoo-dev 2022-06-07 17:34:06 UTC
hmm, I never use eshowkw really, but testing now. I get the same output in xfce4-terminal as in a file.

Row alignment is off like in your first post.
Comment 4 Brian Dolbec (RETIRED) gentoo-dev 2022-06-07 18:54:55 UTC
so, when there is 2 versions to list, it messes up and puts the second version on a new line.

But always when the first dash line is added, it gets split into 2 lines, throwing the left column labels out of row sync with the right side column data.


Problem appears to be in the rotating of the data from left -- right, to top -- bottom.


The same pkg displays correctly when not using the -T parameter, which displays horizontally.

So far I am not having any luck pinpointing where it is screwing up
Comment 5 Brian Dolbec (RETIRED) gentoo-dev 2022-06-08 00:19:27 UTC
OK, I have the row alignment issue fixed in git!

The issue was in re-sizing the upper left corner for version header.

The fix drops the "------" part of the header separator line above the keywords in order to restore the correct alignment.

The versions not lining up 100% of the time is due to justification of version numbers when some are single digits and some are double digits.  But this issue occurs in both versionlist and archlist output.


Please test and report
Comment 6 Brian Dolbec (RETIRED) gentoo-dev 2022-06-08 00:23:29 UTC
brian@storm ~/Dev/git/gentoo/app-editors/zile $ eshowkw -T versionlist
Keywords for app-editors/zile:
       | 2  
       | . 2
       | 4 .
       | . 6
       | 1 .
       | 5 2
       |   r
       |   2
      -+----
 amd64 | + +
   arm | + +
 arm64 | + +
  hppa | o o
   ppc | + +
 ppc64 | o o
 sparc | + +
   x86 | + +
  ia64 | o o
 riscv | o o
  s390 | o o
 alpha | ~ ~
 loong | o o
  m68k | o o
  mips | o o
-------+----
  eapi | 7 8
unused | # o
  slot | 0  
-------+----
  repo | g g
       | e e
       | n n
       | t t
       | o o
       | o o
brian@storm ~/Dev/git/gentoo/app-editors/zile $ eshowkw
Keywords for app-editors/zile:
          |                               |   u   |  
          | a   a     p s     r   a l     |   n   |  
          | m   r h   p p   i i s l o m m | e u s | r
          | d a m p p c a x a s 3 p o 6 i | a s l | e
          | 6 r 6 p p 6 r 8 6 c 9 h n 8 p | p e o | p
          | 4 m 4 a c 4 c 6 4 v 0 a g k s | i d t | o
----------+-------------------------------+-------+-------
2.4.15    | + + + o + o + + o o o ~ o o o | 7 # 0 | gentoo
 2.6.2-r2 | + + + o + o + + o o o ~ o o o | 8 o   | gentoo
brian@storm ~/Dev/git/gentoo/app-editors/zile $
Comment 7 Brian Dolbec (RETIRED) gentoo-dev 2022-06-08 01:22:34 UTC
Pushed a better fix for this which restores the full header line separator.

brian@storm ~/Dev/git/gentoo/app-editors/zile $ eshowkw -T versionlist > foo.txt && cat foo.txt
Keywords for app-editors/zile:
       | 2  
       | . 2
       | 4 .
       | . 6
       | 1 .
       | 5 2
       |   r
       |   2
-------+----
 amd64 | + +
   arm | + +
 arm64 | + +
  hppa | o o
   ppc | + +
 ppc64 | o o
 sparc | + +
   x86 | + +
  ia64 | o o
 riscv | o o
  s390 | o o
 alpha | ~ ~
 loong | o o
  m68k | o o
  mips | o o
-------+----
  eapi | 7 8
unused | # o
  slot | 0  
-------+----
  repo | g g
       | e e
       | n n
       | t t
       | o o
       | o o
Comment 8 Ulrich Müller gentoo-dev 2022-06-08 05:26:38 UTC
Output with redirection looks good now (same as in comment #7).

However, now the alignment _without_ redirection is broken. I've tested in xterm and in the Linux console.

app-editors/zile $ eshowkw -T versionlist
Keywords for app-editors/zile:
       |   [
       |   I
       | 2 ]
       | . 2
       | 4 .
       | . 6
       | 1 .
       | 5 2
       |   -
       |   r
------ |   2
 amd64-+----
   arm | + +
 arm64 | + +
  hppa | + +
   ppc | o o
 ppc64 | + +
 sparc | o o
   x86 | + +
  ia64 | + +
 riscv | o o
  s390 | o o
 alpha | o o
 loong | ~ ~
  m68k | o o
  mips | o o
------ | o o
  eapi-+----
unused | 7 8
  slot | # o
------ | 0  
  repo-+----
       | g g
       | e e
       | n n
       | t t
       | o o
       | o o
Comment 9 Brian Dolbec (RETIRED) gentoo-dev 2022-06-08 06:53:24 UTC
it works correctly for me in xfce4-term and console for re-direct or normal output to terminal.

So, I just emerged xterm and tested using that.

Tested with py3.9 and py3.10

works correctly everywhere.

I even emerged gentoolkit-9999 again, still works as it should.


I can't reproduce your error.
Comment 10 Brian Dolbec (RETIRED) gentoo-dev 2022-06-08 06:57:59 UTC
OH! I see it (I think)    it is the -r2 on yours, mine is missing the -, but yours is showing it.

It shows the dash for me only with archlist as header:

brian@storm ~/Dev/git/gentoo/app-editors/zile $ eshowkw
Keywords for app-editors/zile:
          |                               |   u   |  
          | a   a     p s     r   a l     |   n   |  
          | m   r h   p p   i i s l o m m | e u s | r
          | d a m p p c a x a s 3 p o 6 i | a s l | e
          | 6 r 6 p p 6 r 8 6 c 9 h n 8 p | p e o | p
          | 4 m 4 a c 4 c 6 4 v 0 a g k s | i d t | o
----------+-------------------------------+-------+-------
2.4.15    | + + + o + o + + o o o ~ o o o | 7 # 0 | gentoo
 2.6.2-r2 | + + + o + o + + o o o ~ o o o | 8 o   | gentoo
brian@storm ~/Dev/git/gentoo/app-editors/zile $ 

brian@storm ~/Dev/git/gentoo/app-editors/zile $ eshowkw -T versionlist
Keywords for app-editors/zile:
       | 2  
       | . 2
       | 4 .
       | . 6
       | 1 .
       | 5 2
       |   r
       |   2
-------+----
 amd64 | + +
   arm | + +
 arm64 | + +
  hppa | o o
   ppc | + +
 ppc64 | o o
 sparc | + +
   x86 | + +
  ia64 | o o
 riscv | o o
  s390 | o o
 alpha | ~ ~
 loong | o o
  m68k | o o
  mips | o o
-------+----
  eapi | 7 8
unused | # o
  slot | 0  
-------+----
  repo | g g
       | e e
       | n n
       | t t
       | o o
       | o o
Comment 11 Brian Dolbec (RETIRED) gentoo-dev 2022-06-08 07:07:53 UTC
(In reply to Ulrich Müller from comment #8)
> Output with redirection looks good now (same as in comment #7).
> 
> However, now the alignment _without_ redirection is broken. I've tested in
> xterm and in the Linux console.
> 
> app-editors/zile $ eshowkw -T versionlist
> Keywords for app-editors/zile:
>        |   [
>        |   I
>        | 2 ]
>        | . 2
>        | 4 .
>        | . 6
>        | 1 .
>        | 5 2
>        |   -
>        |   r
> ------ |   2
>  amd64-+----
>    arm | + +
>  arm64 | + +
>   hppa | + +
>    ppc | o o
>  ppc64 | + +
>  sparc | o o
>    x86 | + +
>   ia64 | + +
>  riscv | o o
>   s390 | o o
>  alpha | o o
>  loong | ~ ~
>   m68k | o o
>   mips | o o
> ------ | o o
>   eapi-+----
> unused | 7 8
>   slot | # o
> ------ | 0  
>   repo-+----
>        | g g
>        | e e
>        | n n
>        | t t
>        | o o
>        | o o


Also, what is up with the output on your second version???:

       |   [
       |   I
       | 2 ]
       | . 2

Maybe you have a bad color setting somewhere throwing things off
Comment 12 Ulrich Müller gentoo-dev 2022-06-08 08:01:11 UTC
(In reply to Brian Dolbec from comment #11)
> Also, what is up with the output on your second version???:
> 
>        |   [
>        |   I
>        | 2 ]
>        | . 2
> 
> Maybe you have a bad color setting somewhere throwing things off

Do you mean the [I]? I thought that indicated the installed version?

I've tested with a package that is not installed (app-editors/joe), and alignment is correct there. However, with "-T versionlist" it misses the "-" in 4.6-r1 (same as your comment #10, I guess).
Comment 13 Brian Dolbec (RETIRED) gentoo-dev 2022-06-08 08:08:45 UTC
I found the real culprit.  It was the bad -r2 handling, that dropped the dash (at least on my system).  I have no idea why it wasn't dropped on yours.

the fix is revert my last fix, and add an or to an if statement so it appended the dash.

I'll commit the change in the morning, is 1am here.


I totally forgot about the [I] for installed.
Comment 14 Brian Dolbec (RETIRED) gentoo-dev 2022-06-08 20:13:43 UTC
missing dash fix has been pushed to master.   This last patch also reverts the previous fix which only fixed the symptom, not the real cause.

Hopefully this last fix is the right one.
Comment 15 Ulrich Müller gentoo-dev 2022-06-08 20:52:02 UTC
LGTM