Bug 471591

Summary: echo: write error: Broken pipe in %post
Product: Red Hat Enterprise Linux 5 Reporter: Olivier Fourdan <ofourdan>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED ERRATA QA Contact: BaseOS QE <qe-baseos-auto>
Severity: high Docs Contact:
Priority: high    
Version: 5.3CC: dkovalsk, kem, ltroan, psklenar, syeghiay, tao
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-01-20 20:48:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 468087    
Attachments:
Description Flags
source of an rpm package that exhibits the problem none

Description Olivier Fourdan 2008-11-14 15:01:05 UTC
Created attachment 323585 [details]
source of an rpm package that exhibits the problem

Description of problem:

Using a program that forks/pipe in %post can break all echo commands from the %post install scriptlet.

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

rpm-4.4.2.3-7.el5

How reproducible:

100% with attached reproducer

Steps to Reproduce:
1. Download and build attached reproducer
2. install with rpm -ivh test-rh-1.0.0-1.ia64.rpm
  
Actual results:

# rpm -ivh test-rh-1.0.0-1.ia64.rpm
Preparing...                ########################################### [100%]
   1:test-rh                ########################################### [100%]
# /etc/init.d/functions: line 398: echo: write error: Broken pipe
/etc/init.d/functions: line 400: echo: write error: Broken pipe
/etc/init.d/functions: line 402: echo: write error: Broken pipe
/etc/init.d/functions: line 403: echo: write error: Broken pipe
/etc/init.d/snmpd: line 34: echo: write error: Broken pipe


Expected results:

# rpm -ivh test-rh-1.0.0-1.ia64.rpm
Preparing...                ########################################### [100%]
   1:test-rh                ########################################### [100%]

Additional info:

The %post calls a script that run a program that runs "/sbin/service snmpd start" in the background with a pipe. But the program does not wait for child completion, so when the service script does its echo, the parent is gone and the pipe with it, leading to the "broken pipe" error.

While the problem can be fixed in the program by either handling SIGPIPE or waiting for the child completion with wait(), the customer sees this as a regression because previous versions of rpm would handle this silently.

Comment 1 Panu Matilainen 2008-11-16 09:43:13 UTC
Thanks for the reproducer. This is an unwanted side-effect from switching to NSS for crypto. NSPR (which NSS uses underneath) quietly sets SIG_IGN on SIGPIPE for whatever reason. Another similar case is bug 444389 (which is relevant for RHEL 5.3 too)

Fixing is just a matter of flipping SIGPIPE back to default handler for execution of scriptlets and such.

Comment 4 Panu Matilainen 2008-11-19 06:56:08 UTC
Fix built into rpm-4.4.2.3-8.el5

Comment 8 Issue Tracker 2008-12-05 03:04:03 UTC
From Fujitsu:
---
We confirmed that the fix is included in RHEL5.3 beta snapshot 4.
Thank you very much!
---
So PartnerVerified! Thanks!



This event sent from IssueTracker by moshiro 
 issue 234705

Comment 10 errata-xmlrpc 2009-01-20 20:48:22 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0079.html