[issue6976] getcwd hangs and leaks mem on Solaris <= 9 in very long file name case

Ian Donaldson report at bugs.python.org
Wed Sep 23 07:55:37 CEST 2009


New submission from Ian Donaldson <iand at ekit-inc.com>:

test_posix hung on Solaris 9 ... traced to getcwd test hanging.

This in turn was traced to the very long filename case...
It seems posixmodule was modified (since py2.4.3 at least) 
to retry getcwd with a bigger buffer if ERANGE occurs.  

However on Solaris 9 its not documented that ERANGE also
occurs if getcwd(3) can't cope with the path length, even
if the buffer is big enough.  This causes posix_getcwd() to
loop malloc'ing a bigger buffer, forever.

I enclose a patch that limits the damage, to 1Mbyte at least.
(not sure if more recent Solaris 9 patches than we have
provide another solution)

On Solaris 10, there is no problem as the getcwd() is implemented
as a system call.

----------
components: Build
files: EKIT.PATCH5
messages: 93028
nosy: iandekit
severity: normal
status: open
title: getcwd hangs and leaks mem on Solaris <= 9 in very long file name case
type: resource usage
versions: Python 2.6
Added file: http://bugs.python.org/file14955/EKIT.PATCH5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6976>
_______________________________________


More information about the Python-bugs-list mailing list