Bug 704793

Summary: os.path.relpath incorrect result for '/' as a start directory
Product: [Fedora] Fedora Reporter: Jan Vcelak <jvcelak>
Component: pythonAssignee: Dave Malcolm <dmalcolm>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 14CC: dmalcolm, ivazqueznet, jonathansteffan, tsmetana
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-04-13 06:50:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

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.