Bug 962846

Summary: --last does not honor --qf
Product: [Fedora] Fedora Reporter: Need Real Name <lsof>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: ffesti, jzeleny, novyjindrich, packaging-team-maint, pknirsch, pmatilai
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-15 05:06:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Need Real Name 2013-05-14 14:53:24 UTC
Description of problem:
--qf is ignored when used with --last

The man page states:
       --last Orders the package listing by install time such that the  latest
              packages are at the top.


Version-Release number of selected component (if applicable):
rpm-4.11.0.1-1.fc19.x86_64
rpm-4.9.1.3-8.fc17.x86_64

How reproducible:
Every time

Steps to Reproduce:
1. rpm -q kernel --last --qf '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n'
2.
3.
  
Actual results:
kernel-3.8.11-100.fc17                        Sat 04 May 2013 08:04:14 CEST
kernel-3.8.8-100.fc17                         Tue 30 Apr 2013 13:25:29 CEST
kernel-3.8.4-102.fc17                         Sun 31 Mar 2013 08:31:52 CEST
kernel-3.8.8-100.fc17.x86_64                  
kernel-3.8.4-102.fc17.x86_64                  
kernel-3.8.11-100.fc17.x86_64                 

Expected results:
kernel-3.8.8-100.fc17.x86_64                  
kernel-3.8.4-102.fc17.x86_64                  
kernel-3.8.11-100.fc17.x86_64                 


Additional info:

Comment 1 Panu Matilainen 2013-05-15 05:06:21 UTC
--qf is not exactly ignored, its appended... but that's unlikely to be what you expect either. The issue is that --last is implemented as a popt alias and it relies on a very specific --qf of its own to get its job done:

rpm     alias --last --qf '%|INSTALLTIME?{%{INSTALLTIME}}:{000000000}| %{NVRA} %|INSTALLTIME?{%{INSTALLTIME:date}}:{(not installed)}|\n' \
        --pipe "sort -r -n | sed 's,^[0-9]\+ ,,' | awk '{printf(\"%-45s %-s\n\", $1, substr($0,length($1)+2))}' " \
        --POPTdesc=$"list package(s) by install time, most recent first"

This is one of the reasons for 'rpm --help' showing the popt aliases in a section of their own: such aliases cannot be freely combined with other options.