Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 155373 - Incorrect error message on failed output redirection
Summary: Incorrect error message on failed output redirection
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: bash
Version: 4.0
Hardware: i386
OS: Linux
medium
low
Target Milestone: ---
: ---
Assignee: Tim Waugh
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-04-19 17:38 UTC by Steve Bonds
Modified: 2007-11-30 22:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-04-20 08:19:13 UTC


Attachments (Terms of Use)

Description Steve Bonds 2005-04-19 17:38:28 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20041003 Firefox/0.10

Description of problem:
When I redirect output to a location where I would expect to get "permission denied", I instead get "No such file or directory".

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

How reproducible:
Always

Steps to Reproduce:
1. log in as a user that can't write to /
2. run the command ">/tempfile"


  

Actual Results:  The shell returns the error "-bash: /tempfile: No such file or directory"

Expected Results:  The shell should have returned the error "bash: /tempfile: Permission denied"  (This is the Red Hat Enterprise 3 behavior.)

Additional info:

An "strace" of the improper behavior (strace sh -c ">/tempfile") shows:

-----
open("/tempfile", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = -1 EACCES (Permission denied)
open("/tempfile", O_WRONLY|O_TRUNC|O_LARGEFILE) = -1 ENOENT (No such file or directory)
-----

It seems that the failure of the first open() is not being detected and the errno from the second open() without O_CREAT is the one getting passed back to the error handler.  In Red Hat Enterprise 3, there is only one open():

-----
open("/tempfile", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = -1 EACCES (Permission denied)
-----

Comment 1 Tim Waugh 2005-04-20 08:19:13 UTC
This was caused by AFS support.  A fix has been committed to CVS for Fedora
development.  Thanks for the report.


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