Bug 52322 - rpm mishandles stdout and stderr
Summary: rpm mishandles stdout and stderr
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm
Version: 7.1
Hardware: i586
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-08-22 19:20 UTC by degraaf
Modified: 2007-04-18 16:36 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-08-22 19:22:31 UTC
Embargoed:


Attachments (Terms of Use)
Report of bug behaviour. (5.09 KB, text/plain)
2001-08-22 19:22 UTC, degraaf
no flags Details

Description degraaf 2001-08-22 19:20:59 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.3-12 i586)

Description of problem:
Package names are missing from  rpm -Fvh  output
when output is redirected.

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


How reproducible:
Always

Steps to Reproduce:
1.   rpm -Fvh *.rpm  2>&1  | tee /tmp/rpm.Fvh

2.   rpm -Fvh *.rpm

3.   rpm -Fvh *.rpm  2> /tmp/rpm.stderr  > /tmp/rpm.stdout
	

Actual Results:  I see no way to post my carefully crafted file here,
so I'll cut and paste it.  Too bad this bugzilla is so
braindamaged.
rpm mishandles stdout and stderr.

Using bash bash-2.04-21 and rpm-4.0.2-8 I get unexpected erroneous
output from a series of updates with the stderr and stdout
redirected.  When I do updates I like to capture the session output
for possible future examination, but rpm won't redirect its output
properly.  Shown below are three update sessions on three different
machines that were configured identically.
In each case rpm's output was redirected slightly differently.

Test 1 - combine stderr and stdout and pipe the stream to tee
so it is recorded and displayed.

Note that the package names being updated are missing.


# rpm -Fvh *.rpm 2>&1 | tee /tmp/rpm.Fvh
Preparing...               
####################################################
############################################### [100%]
################################################################################
################### [  7%]
################################################################################
################### [ 15%]
################################################################################
################### [ 23%]
################################################################################
################### [ 30%]
################################################################################
################### [ 38%]
################################################################################
################### [ 46%]
################################################################################
################### [ 53%]
################################################################################
################### [ 61%]
################################################################################
################### [ 69%]
################################################################################
################### [ 76%]
################################################################################
################### [ 84%]
################################################################################
################### [ 92%]
################################################################################
################### [100%]
[root@datium /usr/local/src/redhat/7.1/i386]
#




Test 2 - No redirection at all; output is simply shown on the screen;
then cut and pasted here.
Here the package names are seen:

# rpm -Fvh *.rpm
Preparing...                ###########################################
[100%]
   1:elm                    ########################################### [ 
7%]
   2:krb5-libs              ########################################### [
15%]
   3:krb5-devel             ########################################### [
23%]
   4:openssl                ########################################### [
30%]
   5:imap                   ########################################### [
38%]
   6:openldap               ########################################### [
46%]
   7:nss_ldap               ########################################### [
53%]
   8:openldap-clients       ########################################### [
61%]
   9:openldap-devel         ########################################### [
69%]
  10:openssl-devel          ########################################### [
76%]
  11:procmail               ########################################### [
84%]
  12:telnet                 ########################################### [
92%]
  13:util-linux             ###########################################
[100%]
[root@datstar /net/datium/usr/local/src/redhat/7.1/i386]
#



Test 3 - stderr is redirected to one file and stdout to another.
and a separate process monitors the stdout stream.
The stdout contains the same erroneous data as Test 1, ie, the
package names are missing.  stderr contains nothing at all.


# rpm -Fvh *.rpm 2> /tmp/rpmstderr > /tmp/rpmstdout; tail -f /tmp/rpmstdout
################################################################################
################### [ 30%]
################################################################################
################### [ 38%]
################################################################################
################### [ 46%]
################################################################################
################### [ 53%]
################################################################################
################### [ 61%]
################################################################################
################### [ 69%]
################################################################################
################### [ 76%]
################################################################################
################### [ 84%]
################################################################################
################### [ 92%]
################################################################################
################### [100%]

[root@datant /net/datium/usr/local/src/redhat/7.1/i386]
# 




So it appears that rpm's output data is written to stdout only,
but that when stdout is redirected, the pkgnames are lost.
Where do the pkgnames go?
How could they be lost?

Please fix this egregious error.



Additional info:

Comment 1 degraaf 2001-08-22 19:22:23 UTC
Created attachment 29014 [details]
Report of bug behaviour.

Comment 2 Jeff Johnson 2001-08-22 20:29:39 UTC
Don't use the -h flag if redirecting output, it's intended for interactive use.


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