[Aptitude-devel] Bug#759772: Allow format strings to require fixed width for optional arguments

Manuel A. Fernandez Montecelo manuel.montezelo at gmail.com
Tue Nov 24 00:26:24 UTC 2015


Control: tags -1 + wontfix


Hi Benny,

2014-08-30 07:15 Benny Baumann:
>Package: aptitude
>Version: 0.6.11-1
>Severity: minor
>
>Let's assume the following format string for package lists:
>
>    %c%a%M%S %?i %p# %Z %10D %10I %4r %20v %20V %t
>
>Now configure some packages with explicit preferences along the lines of:
>
>    $ cat /etc/apt/preferences
>    Package: linux-image-* linux-headers-* linux-firmware-* firmware-* *-firmware
>    Pin: release a=experimental
>    Pin-Priority: 1000
>
>    Package: linux-image-* linux-headers-* linux-firmware-* firmware-* *-firmware
>    Pin: release a=unstable
>    Pin-Priority: 950
>
>    Package: *
>    Pin: release a=testing
>    Pin-Priority: 900
>
>    Package: *
>    Pin: release a=stable
>    Pin-Priority: 800
>
>    Package: *
>    Pin: release a=experimental
>    Pin-Priority: 750
>
>    Package: *
>    Pin: release a=unstable
>    Pin-Priority: 700
>
>When browsing the various categories you will see various most packages without
>any priority, as desired. But when looking into a section with kernel images,
>development headers or firmware packages in them, mixed with other, you will
>see stairs and other effects with misalignment of the columns.
>
>It would be cool if you could ask Aptitude to skip the value as is now, but
>still reserve a certain amount of space for it anyway.

If I understood this correctly, this works as documented [1].  The field
is there, only that it tries to use only the necessary space, so for
each line/row it can have different widths.

Pin priority has well known boundaries, so it's easy to specify the
width instead: "%4i".  In that case, packages without anything to show
will have the column empty, but still be there with the necessary width
to not produce strange visual effects.


Changing the current behaviour can break existing assumptions and is not
desirable at this point unless there are more compelling cases.

For example, if width of the field is only set for all rows after
calculating the widest that can be possibly needed, it's an unneccesary
extra computation most of the time.  And in any case, if any in the list
of packages present in the view (even if folded or out of the visible
area at the moment) has pin priority needing N=4 spaces, it is
equivalent to setting the field width to %4i to start with, so there
would be no advantage in this case.


So marking as +wontfix for the time being.


[1] http://aptitude.alioth.debian.org/doc/en/ch02s05s01.html

    "Placing a question mark (?) between the % and the character
    identifying the escape causes the column's “basic” width to vary
    depending on its content. Note that the resulting columns might not
    line up vertically!"


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



More information about the Aptitude-devel mailing list