[Aptitude-devel] Bug#815690: aptitude: regression in version 0.7.6 wrt. cli search display through pipes

Manuel A. Fernandez Montecelo manuel.montezelo at gmail.com
Tue Feb 23 20:19:42 GMT 2016

Control: tags -1 + moreinfo unreproducible


2016-02-23 18:34 nkiesel:
>Package: aptitude
>Version: 0.7.6-1
>Severity: normal
>Dear Maintainer,
>version 0.7.6 changed the way output formatting is handled for the CLI version,
>and I consider that a regression.
>I use something like `aptitude search '~N' > t; less t`.  This used to truncate
>the output, but aptitude honored the `-w` switch, thus `aptitude search -w
>$COLUMNS > t; less t` worked in 0.7.4.
>0.7.6 no longer allws that. Even specifying an output format using `-F` is
>silently ignored as soon as the output is redirected or piped.

-F is honoured:

    $ aptitude -w 60 -F '%p %v %V' search ~n^aptitude$
    aptitude                       0.7.6-1        0.7.6-1
    aptitude:i386                  <none>         0.7.6-1

    $ aptitude -F '%p %v %V' search ~n^aptitude$ | cat
    aptitude 0.7.6-1 0.7.6-1
    aptitude:i386 <none> 0.7.6-1

    $ aptitude -F '%p | %v | %V' search ~n^aptitude$ | cat
    aptitude | 0.7.6-1 | 0.7.6-1
    aptitude:i386 | <none> | 0.7.6-1

And in general, everything works in the same way, except that it doesn't
try to columnize the results and separates fields with single (instead
of multiple) spaces.

And that's because, ultimately, when piping or redirecting aptitude
cannot know what will be the size on the other end, when viewing the

>I consider that a regression.  Actually, I never really understood why aptitude
>tried to recognize this situation in the first place.  If the idea is to allow
>an easier parsing, the caller should simply use a proper -F argument (of
>course; this also no longer works with 0.7.6).  Or perhaps add a `-m|--machine-
>friendly` parameter that forces this output format.

I am not sure why you insist that it doesn't work and are so sure about
it, when it obviously does.

>So please reconsider your decision wrt. redirection detection.  Minimally, I
>would expect that `-F` is honored.  But ideally aptitude should just stop
>trying to be too smart here and simply produce the same output independent of
>if it goes to a terminal or something else.

See #445206, #496728 for arguments on the contrary, which is the reason
why I worked on it in the first place.

Manuel A. Fernandez Montecelo <manuel.montezelo at gmail.com>

More information about the Aptitude-devel mailing list