Bug 704793 - os.path.relpath incorrect result for '/' as a start directory
Summary: os.path.relpath incorrect result for '/' as a start directory
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: python
Version: 14
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Dave Malcolm
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-05-14 23:46 UTC by Jan Vcelak
Modified: 2013-03-04 01:29 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-04-13 06:50:18 UTC
Type: ---


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Python 5117 0 None None None Never

Description Jan Vcelak 2011-05-14 23:46:21 UTC
Description of problem:

os.path.relpath(path[, start]) returns incorrect result, when the 'start' argument is set to '/'.

Version-Release number of selected component (if applicable):

python-2.7-8.fc14.1.x86_64

Actual results:

# python2.7
Python 2.7 (r27:82500, Sep 16 2010, 18:02:00) 
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.relpath("/etc/passwd", "/")
'../etc/passwd'
>>> os.path.relpath("/etc/passwd", "/root")
'../etc/passwd'
>>> 


Expected results (python-2.7.1-7.fc16.x86_64):

# python2.7
Python 2.7.1 (r271:86832, Apr 12 2011, 16:12:28) 
[GCC 4.6.0 20110331 (Red Hat 4.6.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.relpath("/etc/passwd", "/")
'etc/passwd'
>>> os.path.relpath("/etc/passwd", "/root")
'../etc/passwd'
>>>


Additional info:

http://bugs.python.org/issue5117

Comment 1 Jan Vcelak 2012-04-13 06:50:18 UTC
The bug is fixed in F16.


Note You need to log in before you can comment on or make changes to this bug.