[issue15895] PyRun_SimpleFileExFlags() can leak a FILE pointer

2012-09-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fe4e6e0d6b0f by Christian Heimes in branch 'default':
Issue #15895: Fix FILE pointer leak in PyRun_SimpleFileExFlags() when filename 
points to a pyc/pyo file and closeit is false.
http://hg.python.org/cpython/rev/fe4e6e0d6b0f

New changeset 9251fb0440a0 by Christian Heimes in branch 'default':
Issue #15895: my analysis was slightly off. The FILE pointer is only leaked 
when set_main_loader() fails for a pyc file with closeit=0. In the success case 
run_pyc_file() does its own cleanup of the fp. I've changed the code to use 
another FILE ptr for pyc files and moved the fclose() to 
PyRun_SimpleFileExFlags() to make it more obvious what's happening.
http://hg.python.org/cpython/rev/9251fb0440a0

New changeset 61b1c25d55f2 by Christian Heimes in branch 'default':
Updates NEWS for issue #15895
http://hg.python.org/cpython/rev/61b1c25d55f2

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15895
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15895] PyRun_SimpleFileExFlags() can leak a FILE pointer

2012-09-22 Thread Georg Brandl

Georg Brandl added the comment:

Now transplanted to release clone.

--
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15895
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15895] PyRun_SimpleFileExFlags() can leak a FILE pointer

2012-09-21 Thread STINNER Victor

STINNER Victor added the comment:

This issue is not a regression, I think that the fix can wait for Python 3.3.1.

--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15895
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15895] PyRun_SimpleFileExFlags() can leak a FILE pointer

2012-09-21 Thread STINNER Victor

STINNER Victor added the comment:

 This issue is not a regression

My bad, Crys explained me on IRC that the leak does not exist in Python 3.2, it 
was introduced by the importlib. So it is a regression.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15895
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15895] PyRun_SimpleFileExFlags() can leak a FILE pointer

2012-09-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4754c4a710e6 by Christian Heimes in branch 'default':
Issue #15895: Fix FILE pointer leak in PyRun_SimpleFileExFlags() when filename 
points to a pyc/pyo file and closeit is false.
http://hg.python.org/cpython/rev/4754c4a710e6

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15895
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15895] PyRun_SimpleFileExFlags() can leak a FILE pointer

2012-09-11 Thread Christian Heimes

Christian Heimes added the comment:

The bug was a 3.3 regression, possibly introduced with the merge of importlib. 
I forgot to tick the 3,3regression keyword.

I've applied the fix. I'm leaving this ticket open and assigned to Georg for 
3.3.0.

--
keywords: +3.3regression
resolution:  - fixed
stage: patch review - committed/rejected
versions: +Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15895
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15895] PyRun_SimpleFileExFlags() can leak a FILE pointer

2012-09-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c3539eb02470 by Christian Heimes in branch 'default':
Issue #15895: my analysis was slightly off. The FILE pointer is only leaked 
when set_main_loader() fails for a pyc file with closeit=0. In the success case 
run_pyc_file() does its own cleanup of the fp. I've changed the code to use 
another FILE ptr for pyc files and moved the fclose() to 
PyRun_SimpleFileExFlags() to make it more obvious what's happening.
http://hg.python.org/cpython/rev/c3539eb02470

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15895
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15895] PyRun_SimpleFileExFlags() can leak a FILE pointer

2012-09-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6fea947edead by Christian Heimes in branch 'default':
Updates NEWS for issue #15895
http://hg.python.org/cpython/rev/6fea947edead

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15895
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15895] PyRun_SimpleFileExFlags() can leak a FILE pointer

2012-09-10 Thread Christian Heimes

Christian Heimes added the comment:

No, that's not possible. 'fp' is part of the argument to 
PyRun_SimpleFileExFlags() and never NULL. We need some way to distinguish a 
externally provided fp from a self-opened fp and fclose(fp) in the latter case.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15895
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15895] PyRun_SimpleFileExFlags() can leak a FILE pointer

2012-09-10 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

Look good to me, then. Are you committing the patch yourself?.

You can patch 2.7, 3.2 and default, and bug Georg for 3.3.0 inclusion (patches 
to default will be in 3.3.1), unless Georg is notified and chooses to cherry 
pick it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15895
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15895] PyRun_SimpleFileExFlags() can leak a FILE pointer

2012-09-09 Thread Christian Heimes

New submission from Christian Heimes:

In Python/pythonrun.c PyRun_SimpleFileExFlags() may leak a FILE pointer if 
closeit is False and maybe_pyc_file returns true. This happens when the 
filename ends with .pyc or .pyc. In this case the file is opened a second 
time with fopen() a few lines lower and assigned to the same variable fp. 
However fp is never closed.

The bug was found by Coverity as CID 719689.

Georg: I've set the priority to release blocker as a resource leak of a file 
pointer and therefore rare file descriptor is IMHO a severe issue.

--
assignee: georg.brandl
files: closeown.patch
keywords: patch
messages: 170142
nosy: brett.cannon, christian.heimes, georg.brandl
priority: release blocker
severity: normal
stage: patch review
status: open
title: PyRun_SimpleFileExFlags() can leak a FILE pointer
type: resource usage
Added file: http://bugs.python.org/file27159/closeown.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15895
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15895] PyRun_SimpleFileExFlags() can leak a FILE pointer

2012-09-09 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

LGTM.

Instead of using a flag variable, could you use something like if (fp!=NULL) 
fclose(fp);?

--
nosy: +jcea

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15895
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com