This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author csernazs
Recipients csernazs
Date 2010-07-07.08:56:33
SpamBayes Score 0.0011907148
Marked as misclassified No
Message-id <1278492997.35.0.523630408468.issue9185@psf.upfronthosting.co.za>
In-reply-to
Content
os.getcwd() causes infinite loop on solaris10 when the length of the current directory is greater than 1024 (them limit of the maximum absolute path).

os.getcwd is implemented by a while loop in python, see the function posix_getcwd in posixmodule.c. That while loop loops forever because on solaris it sets errno to ERANGE and res to NULL - even if there will be no positive results from getcwd due to the extra long path.
This infinite while cycle also causes eating up the memory.

I think the solution would be implementing a hard limit for this while loop. It could be either fixed (16k for example), or dymanic: comparing the MAXPATHLEN macro to the size of the allocated buffer and if the size of the buffer is greater than MAXLPATHLEN then raise an OSError exception with the current errno.

That bug was triggered by test_posix unittest.
History
Date User Action Args
2010-07-07 08:56:37csernazssetrecipients: + csernazs
2010-07-07 08:56:37csernazssetmessageid: <1278492997.35.0.523630408468.issue9185@psf.upfronthosting.co.za>
2010-07-07 08:56:35csernazslinkissue9185 messages
2010-07-07 08:56:33csernazscreate