f2py and -D_FORTIFY_SOURCE=2 compilation flag

Hi, On fedora 8, the docstrings of f2py generated extensions are strangely missing. On Ubuntu, the same modules do have the docstrings. The problem, as reported in the f2py ML, seems to come from the -D_FORTIFY_SOURCE flag which is set to 2 instead of 1. Could this be fixed in numpy.distutils and how ? Thanks, David

On Wed, May 14, 2008 at 2:46 PM, David Huard <david.huard@gmail.com> wrote:
Hi,
On fedora 8, the docstrings of f2py generated extensions are strangely missing. On Ubuntu, the same modules do have the docstrings. The problem, as reported in the f2py ML, seems to come from the -D_FORTIFY_SOURCE flag which is set to 2 instead of 1. Could this be fixed in numpy.distutils and how ?
There is no string "FORTIFY_SOURCE" anywhere in the numpy codebase. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco

I filed a patch that seems to do the trick in ticket #792.<http://scipy.org/scipy/numpy/ticket/792> 2008/5/14 David Huard <david.huard@gmail.com>:
Hi,
On fedora 8, the docstrings of f2py generated extensions are strangely missing. On Ubuntu, the same modules do have the docstrings. The problem, as reported in the f2py ML, seems to come from the -D_FORTIFY_SOURCE flag which is set to 2 instead of 1. Could this be fixed in numpy.distutils and how ?
Thanks,
David

On Wed, May 14, 2008 at 3:20 PM, David Huard <david.huard@gmail.com> wrote:
I filed a patch that seems to do the trick in ticket #792.
I don't think this is the right approach. The problem isn't that _FORTIFY_SOURCE is set to 2 but that f2py is doing (probably) bad things that trip these buffer overflow checks. IIRC, Pearu wasn't on the f2py mailing list at the time this came up; please try him again. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco

Robert Kern wrote:
On Wed, May 14, 2008 at 3:20 PM, David Huard <david.huard@gmail.com> wrote:
I filed a patch that seems to do the trick in ticket #792.
I don't think this is the right approach. The problem isn't that _FORTIFY_SOURCE is set to 2 but that f2py is doing (probably) bad things that trip these buffer overflow checks. IIRC, Pearu wasn't on the f2py mailing list at the time this came up; please try him again.
I was able to reproduce the bug on a debian system. The fix with a comment on what was causing the bug, is in svn: http://scipy.org/scipy/numpy/changeset/5173 I should warn that the bug fix does not have unittests because: 1) testing the bug requires Fortran compiler that for NumPy is an optional requirement. 2) I have tested the fix with two different setups that should cover all possible configurations. 3) In the case of problems with the fix, users should notice it immediately. 4) I have carefully read the patch before committing. Regards, Pearu

Works for me, Thanks David 2008/5/15 Pearu Peterson <pearu@cens.ioc.ee>:
Robert Kern wrote:
On Wed, May 14, 2008 at 3:20 PM, David Huard <david.huard@gmail.com> wrote:
I filed a patch that seems to do the trick in ticket #792.
I don't think this is the right approach. The problem isn't that _FORTIFY_SOURCE is set to 2 but that f2py is doing (probably) bad things that trip these buffer overflow checks. IIRC, Pearu wasn't on the f2py mailing list at the time this came up; please try him again.
I was able to reproduce the bug on a debian system. The fix with a comment on what was causing the bug, is in svn:
http://scipy.org/scipy/numpy/changeset/5173
I should warn that the bug fix does not have unittests because: 1) testing the bug requires Fortran compiler that for NumPy is an optional requirement. 2) I have tested the fix with two different setups that should cover all possible configurations. 3) In the case of problems with the fix, users should notice it immediately. 4) I have carefully read the patch before committing.
Regards, Pearu _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
participants (3)
-
David Huard
-
Pearu Peterson
-
Robert Kern