Bug 659459 - In ksh scripts, files may be created but then fail to be immediately opened.
Summary: In ksh scripts, files may be created but then fail to be immediately opened.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: ksh
Version: 5.5
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Michal Hlavinka
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks: 660319 684831
TreeView+ depends on / blocked
 
Reported: 2010-12-02 20:39 UTC by Mike Belangia
Modified: 2018-11-14 16:34 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
When a ksh script created a file and immediately opened it after the creation, the operation failed. This happened because the created file, in some cases, did not exist yet. With this update, this race condition has been fixed and once a file is created, it is immediately available for any following commands.
Clone Of:
: 660319 (view as bug list)
Environment:
Last Closed: 2012-02-21 05:50:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Reproduction script (332 bytes, text/plain)
2010-12-02 20:39 UTC, Mike Belangia
no flags Details
Annotated strace (168.51 KB, text/plain)
2010-12-02 20:39 UTC, Mike Belangia
no flags Details
patch to fix this (1.63 KB, patch)
2010-12-06 15:29 UTC, Michal Hlavinka
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0159 0 normal SHIPPED_LIVE ksh bug fix and enhancement update 2012-02-20 14:53:47 UTC

Description Mike Belangia 2010-12-02 20:39:11 UTC
Created attachment 464363 [details]
Reproduction script

Description of problem:

When creating a file inside a ksh script and then immediately attempting to open the new file the file does not exist.  This occurs even when the file creation is inside parentheses and the access occurs outside the parentheses and the filesystem is on a local disk.

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

Client is reporting against 20100202-1.el5 (RHEL5) but I have also reproduced on 20100202-1.el5_5.1 (RHEL5).  This is also reproducable on 20100621-1.fc13 (Fedora 13) but seems to require more iterations.

How reproducible:

Attached are two files.  The first, ksh.bug, is a script which will reproduce the error.  The second, ksh.strace.out, is an strace of a failed run.  Search for "###" in the strace to find annotations displaying the failure

Steps to Reproduce:
1. Run ksh.bug

  
Actual results:
It seems that commands are being evaluated in an incorrect order.


Expected results:
As I understand it, the commands inside the parentheses should always be completed before the following commands are executed.

Comment 1 Mike Belangia 2010-12-02 20:39:44 UTC
Created attachment 464364 [details]
Annotated strace

Comment 2 Michal Hlavinka 2010-12-06 15:29:27 UTC
Created attachment 465002 [details]
patch to fix this

Comment 3 RHEL Program Management 2011-01-11 21:09:13 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 4 RHEL Program Management 2011-01-11 22:45:30 UTC
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.

Comment 11 Martin Prpič 2011-03-16 15:59:38 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
When a ksh script created a file and immediately opened it after the creation, the operation failed. This happened because the created file, in some cases, did not exist yet. With this update, this race condition has been fixed and once a file is created, it is immediately available for any following commands.

Comment 14 errata-xmlrpc 2012-02-21 05:50:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0159.html


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