Title: os.path.abspath doesn't work properly for 2.5b3 on Windows
Type: Severity: normal
Components: None Versions: Deferred
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amak, crankycoder, otmarhumbel, pjenvey
Priority: Keywords: patch

Created on 2009-04-17.17:29:10 by crankycoder, last changed 2009-05-29.01:12:47 by pjenvey.

File name Uploaded Description Edit Remove
site.patch crankycoder, 2009-04-17.19:35:12
msg4529 (view) Author: Victor Ng (crankycoder) Date: 2009-04-17.17:29:09
When running the Jython 2.5b3 from a standalone jar file - sys.path is
setup incorrectly on Windows.

sys.path reports:

>>> import sys
>>> sys.path
['', 'C:\\jython2.5b3-standalone\\Lib',
'C:\\C:\\jython2.5b3-standalone\\jython.jar\\Lib', '__classpath__',

Notice that the 3rd element had a double C:\
msg4531 (view) Author: Victor Ng (crankycoder) Date: 2009-04-17.18:26:19
This seems like a bug in os.path.abspath.

In the Lib/, the makepath function is not creating the right
absolute path.

(Pdb) dir
(Pdb) os.path.abspath(dir)

It basically gets the "C:\" part confused.

(Pdb) dir[3:]
(Pdb) os.path.abspath(dir[3:])
msg4532 (view) Author: Victor Ng (crankycoder) Date: 2009-04-17.19:35:12
this seems like a bug in the interaction between jython and cpython's
ntpath module.

CPython exhibits the same problem when applying abspath to:

Stripping the leading '/' seems to work around the problem.

I've patched to force strip the leading slash for jython+windows
msg4534 (view) Author: Alan Kennedy (amak) Date: 2009-04-18.12:53:38
Is this the same bug as 

stat fails on directory path with trailing backslash on Windows

Which Tobias fixed in revision 6164?
msg4745 (view) Author: Philip Jenvey (pjenvey) Date: 2009-05-29.01:12:46
I don't see this with 2.5rc3, can you still reproduce this?

Regardless, the bug is with whatever setup this invalid path in the first 
place. fixing it in isn't the right solution
Date User Action Args
2009-05-29 01:12:47pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg4745
nosy: + pjenvey
2009-04-25 06:06:36otmarhumbelsetnosy: + otmarhumbel
2009-04-18 12:53:39amaksetnosy: + amak
messages: + msg4534
2009-04-17 19:35:12crankycodersetfiles: + site.patch
keywords: + patch
messages: + msg4532
2009-04-17 18:34:13crankycodersettitle: sys.path has invalid path on windows with 2.5b3 -> os.path.abspath doesn't work properly for 2.5b3 on Windows
2009-04-17 18:26:20crankycodersetmessages: + msg4531
2009-04-17 17:29:10crankycodercreate