classification
Title: getcwd hangs and leaks mem on Solaris <= 9 in very long file name case
Type: resource usage Stage: resolved
Components: Build Versions: Python 2.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder: os.getcwd causes infinite loop on solaris
View: 9185
Assigned To: Nosy List: BreamoreBoy, iandekit, skrah
Priority: normal Keywords:

Created on 2009-09-23 05:55 by iandekit, last changed 2010-07-20 18:48 by skrah. This issue is now closed.

Files
File name Uploaded Description Edit
EKIT.PATCH5 iandekit, 2009-09-23 05:55 avoid getwcd hang
Messages (3)
msg93028 - (view) Author: Ian Donaldson (iandekit) Date: 2009-09-23 05:55
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.
msg110925 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-20 17:19
Are there any Solaris people who could look at this?  The patch file contains a very small change to posixmodule.c.
msg110945 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2010-07-20 18:48
This has just been fixed in issue 9185.
History
Date User Action Args
2010-07-20 18:48:26skrahsetstatus: open -> closed

superseder: os.getcwd causes infinite loop on solaris

nosy: + skrah
messages: + msg110945
resolution: duplicate
stage: resolved
2010-07-20 17:19:39BreamoreBoysetnosy: + BreamoreBoy
messages: + msg110925
2009-09-23 05:55:36iandekitcreate