#578412 aptitude: can not disable auto-expansion of format strings

Package:
aptitude
Source:
aptitude
Description:
terminal-based package manager
Submitter:
Olivier Robert
Date:
2015-11-24 01:09:03 UTC
Severity:
minor
#578412#5
Date:
2010-04-19 17:30:18 UTC
From:
To:
## Summary
The escape symbol %t does not comply with the formatting rule :
%[width][?]code[#]

as described in the manual
(/usr/share/doc/aptitude/html/en/ch02s05s01.html)

Exerpt:
(...) All %-escapes
come with a default size and/or expandability. The size of a %-escape can be
changed by writing it between the % and the character identifying the escape;
for instance, %20V generates the candidate version of the package, 20
characters wide. 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!
(...)

"width" has no effect
? parameter has no effect
I didn't try #


##Steps to follow to reproduce the problem

#Example 1:
$ aptitude search '~i' --display-format '*%?t*'

should show:
*unstable*
*testing,unstable*

actually shows:
*unstable                                                                      *
*testing,unstable                                                              *

=> no effect

#Example 2:
$ aptitude search '~i' --display-format '*%3?t*'
should show:
*uns*
*tes*

actually shows:

*unstable                                                                      *
*testing,unstable                                                              *

=> no effect

#578412#10
Date:
2010-04-20 13:20:57 UTC
From:
To:
  I think the problem is that while there's a syntax to turn
autoexpansion of a column *on*, there isn't a syntax to turn it *off*.
%t is autoexpanded by default, so no matter what you do, it will eat
all the available space.  You can see that aptitude is at least reading
the width information by combining %t with some other autoexpanding
column (like %p, for instance).

  Daniel

#578412#15
Date:
2010-04-23 20:01:22 UTC
From:
To:
I needed some time to understand your explanation. The reason is that I
actually thought that the question mark was turning the autoexpension
*off*. I now realize that it just removes a fixed width.
Am I right?
I would find it intuitive if it did both. What do you think?
Could you give me a literal example? (What should I type?)


Olivier

#578412#24
Date:
2014-05-12 06:32:44 UTC
From:
To:
Hello,

will be this bug fixed sometime? I use aptitude for searching because of many
search-options and output formating. I would like to specify output format as
non-expandable package name, but it is not possible to disable default
expandable flag.

Thank you for fixing.

Regards,

Robert Wolf.

#578412#29
Date:
2015-11-24 01:05:16 UTC
From:
To:
Hi both,

2010-04-23 21:01 Olivier Robert:

Yes.

I don't think that it is good to do this, it would probably have
unintended consequences.

Daniel Burrows meant '%p %t', I think.

Actually, if you don't want the fields to expand at all, you can use --disable-columns:

  $ aptitude search --disable-columns '~ramd64~n^aptitude$' --display-format '*%3?t*'
  *unstable*

  $ aptitude search --disable-columns '~ramd64~n^aptitude$' --display-format '%p *%3?t*'
  aptitude *unstable*



2014-05-12 07:32 Robert Wolf:

I think that the above example would work for you, please confirm.


In the meantime I am marking this as +wontfix, because I am not sure if
it's a bug, but in any case I don't see anybody wanting to mess with
this hairy area of column formatting any time soon.


Cheers.