Bug 75424 - rpm -qa --last generates warning when piped through head
Summary: rpm -qa --last generates warning when piped through head
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm   
(Show other bugs)
Version: 8.0
Hardware: i386 Linux
Target Milestone: ---
Assignee: Paul Nasrat
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2002-10-08 13:30 UTC by Richard Lloyd
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-04-19 18:46:51 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Richard Lloyd 2002-10-08 13:30:32 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827

Description of problem:
I wanted to get a list of the 10 most recently installed RPMs on
my Red Hat 8.0 (i386) system. This should be, in theory,
"rpm -qa --last | head". On 8.0, this works, but also generates this

wk: cmd. line:1: (FILENAME=- FNR=110) fatal: printf to "standard output" failed
(Broken pipe)
sed: couldn't write 50 items to {standard output}: Broken pipe
sort: write failed: -: Broken pipe

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. rpm -qa --last | head

Actual Results:  Ten most recent RPMs installed are indeed output to stdout, but an
additional warning is displayed to stderr (as detailed above).

Expected Results:  No warning should be issued.

Additional info:

"rpm -qa | head" works OK in RH 8.0.
"rpm -qa --last | tail" also works OK in RH 8.0.
"rpm -qa --last | head" works OK in RH 7.2 (but not in 8.0).

My workaround to avoid the warning (other than the obvious 2>/dev/null)
was to use a temporary file:

rpm -qa --last >$tmpfile
head $tmpfile
rm -f $tmpfile

This works OK in RH 7.2 and 8.0.

Comment 1 Jeff Johnson 2002-10-08 13:43:58 UTC
Hmmm, this WORKSFORME.

I can't tell where the failure is coming from.
The --last option is simply some pipe fitting
onto "rpm -qa" output from a popt alias contained
in /usr/lib/rpm/rpmpopt-4.1:

rpm     alias --last --qf '%|INSTALLTIME?{%{INSTALLTIME}}:{000000000}|
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"

Can you try to identify which of the components (i.e. sort/sed/awk)
is failing, and cook the mess down to a reproducible case? Thanks ...

Comment 2 Jeremy Katz 2005-04-19 18:46:51 UTC
Closing due to inactivity.  If this issue still occurs with current releases,
please reopen and set the release in which you've encountered the problem.

Note You need to log in before you can comment on or make changes to this bug.