[Patches] [ python-Patches-944928 ] Bugfix for dircheck() in Objects/fileobject.c

SourceForge.net noreply at sourceforge.net
Thu Sep 15 15:16:56 CEST 2005


Patches item #944928, was opened at 2004-04-30 00:20
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=944928&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.3
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Ulrich Berning (uberning)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bugfix for dircheck() in Objects/fileobject.c

Initial Comment:
When the sys module is initialized in _PySys_Init(), it
creates file objects for stdin, stdout and stderr with
PyFile_FromFile() which calls fill_file_fields() to
initialize the file object. At the end of
initialization dircheck() is called, to ensure that the
file is not a directory. If the underlaying file
descriptors for stdin, stdout, stderr (0, 1, 2) are
closed by the parent process, dircheck() fails at least
on AIX. I don't know exactly why this fails but the
following expression in dircheck() 

if (fstat(fileno(f->f_fp), &buf) == 0 &&
S_ISDIR(buf.st_mode))

evaluates to True for stdin which results in setting an
exception and returning NULL to _PySys_Init().

The applied patch changes dircheck() to return without
further checks if the file object is for stdin, stdout
or stderr.

----------------------------------------------------------------------

>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-09-15 15:16

Message:
Logged In: YES 
user_id=1188172

Closing due to lack of response and improbability of validity.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2004-08-18 15:42

Message:
Logged In: YES 
user_id=21627

This patch is not acceptable in this form. What you describe
seems to point to a clear bug in AIX, and, as other AIX
users have not reported that as a problem, appears to be
specific to your installation. Maybe there is a problem with
the compiler installation somehow?

If you want to investigate this further, please try to
reproduce the stat/ISDIR problem in a small stand-alone C
program. If that succeeds, please generate an
strace/ktrace/truss output for that binary.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=944928&group_id=5470


More information about the Patches mailing list