Bug 75424 - rpm -qa --last generates warning when piped through head
rpm -qa --last generates warning when piped through head
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
8.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Paul Nasrat
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-10-08 09:30 EDT by Richard Lloyd
Modified: 2008-05-01 11:38 EDT (History)
0 users

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


Attachments (Terms of Use)

  None (edit)
Description Richard Lloyd 2002-10-08 09:30:32 EDT
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
warning:

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:
Always

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:

tmpfile=/var/tmp/rpmhead.out$$
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 09:43:58 EDT
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}|
%{NAME}-%{VERSION}-%{RELEASE} %|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"

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 14:46:51 EDT
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.