Bug 169193

Summary: sed -i segfaults in readonly target directory
Product: Red Hat Enterprise Linux 3 Reporter: Neil Prockter <prockter>
Component: sedAssignee: Petr Machata <pmachata>
Status: CLOSED ERRATA QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: mnewsome
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: RHEL3U7NAK
Fixed In Version: RHBA-2006-0362 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-07-20 15:06:33 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: 181405    
Attachments:
Description Flags
sed-4.0.7-i-mkstemp.patch none

Description Neil Prockter 2005-09-24 11:53:37 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050909 Fedora/1.0.6-1.2.fc4 Firefox/1.0.6

Description of problem:
sed -i segfaults when the target file is in a readonly directory

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

How reproducible:
Always

Steps to Reproduce:
1. mkdir -p testcases/sed
2. cd testcases/sed
3. mkdir readonly
4. echo hello\\nhello again > readonly/testfile
5. chmod 500 readonly
6. sed -i -e 2d readonly/testfile

Actual Results:  Segmentation fault

Expected Results:  at least
sed: couldn't open temporary file readonly//sedEpzma8: Permission denied
at best use a temp file elsewhere

Additional info:

rhel4 with sed-4.1.2-4 more correctly gives 
sed: couldn't open temporary file readonly//sedEpzma8: Permission denied
(but why not make a tempfile somewhere else in this case)

Comment 1 Jakub Jelinek 2005-09-27 14:58:21 UTC
Created attachment 119298 [details]
sed-4.0.7-i-mkstemp.patch

Fix.

Comment 8 Bob Johnson 2006-04-11 15:50:25 UTC
This issue is on Red Hat Engineering's list of planned work items 
for the upcoming Red Hat Enterprise Linux 3.8 release.  Engineering 
resources have been assigned and barring unforeseen circumstances, Red 
Hat intends to include this item in the 3.8 release.

Comment 13 Red Hat Bugzilla 2006-07-20 15:06:34 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 the 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-2006-0362.html