msg80860 - (view) |
Author: Eli Bendersky (eli.bendersky) * |
Date: 2009-01-31 07:25 |
This is correct:
relpath(r'd:\abc\jho', r'd:\abc')
=> 'jho'
But this isn't:
relpath(r'd:\jho', r'd:\\')
=> '..\jho'
Neither is this:
relpath(r'd:\jho', r'd:')
=> '..\..\..\jho'
|
msg80861 - (view) |
Author: Hirokazu Yamamoto (ocean-city) * |
Date: 2009-01-31 08:34 |
About this,
>But this isn't:
>relpath(r'd:\jho', r'd:\\')
>=> '..\jho'
Same happens on posixpath.
from posixpath import relpath
print relpath(r'/abc', r'/') #=> ../abc
I'll look at the code.
|
msg80862 - (view) |
Author: Eli Bendersky (eli.bendersky) * |
Date: 2009-01-31 08:46 |
The problem is with these lines:
start_list = abspath(start).split(sep)
path_list = abspath(path).split(sep)
In case of 'd:\', the split returns two elements, the second empty.
|
msg80863 - (view) |
Author: Hirokazu Yamamoto (ocean-city) * |
Date: 2009-01-31 09:20 |
I hope attached patch will fix this bug.
|
msg80877 - (view) |
Author: Hirokazu Yamamoto (ocean-city) * |
Date: 2009-01-31 16:21 |
It seems that there is still problem.
>>> ntpath.relpath("//whiterab-c2znlh/foo/", "//whiterab-c2znlh/bar/")
'..\\foo'
This should raise ValueError because "//whiterab-c2znlh/foo" is UNC root
prefix (like "e:" for normal path) not "//whiterab-c2znlh" AFAIK.
I'll look into more deeper...
|
msg80880 - (view) |
Author: Hirokazu Yamamoto (ocean-city) * |
Date: 2009-01-31 17:16 |
I hope this works.
|
msg83146 - (view) |
Author: Jim Blandy (jimb) |
Date: 2009-03-04 22:01 |
In case the behavior requested here is controversial, here's an example
of where it would be nice to have relpath(x, '/') return a path for x
that is relative to the root directory:
The 'oprofile' system profiler for Linux profiles everything running on
the system at once. Its profile count database takes the form of a
directory tree of counter files that mirrors the whole filesystem:
/var/lib/oprofile/samples/current/{root}/bin/ls holds the samples for
/bin/ls, and so on. Also, the 'opannotate' command annotates source
trees with profile counts: if /bin/ls were built from /src/ls.c, then
'opannotate -o ~/ann-tree' would put a count-annotated copy of ls's
source '~/ann-tree/src/ls.c'.
At the moment, I wish I could simply say:
src=path to source file
real_src = os.path.realpath(src)
rel_real_src = os.path.relpath(real_src, '/')
annotated_source = os.path.join(annotation_dir, rel_real_src)
but this bug gets in the way.
|
msg90061 - (view) |
Author: Hirokazu Yamamoto (ocean-city) * |
Date: 2009-07-03 14:25 |
Maybe this patch should be updated because os.path functions changed
their behaviors for UNC in py3k. (#5799)
|
msg110994 - (view) |
Author: Mark Lawrence (BreamoreBoy) * |
Date: 2010-07-21 02:59 |
msg90061 refers to #5799 which is closed, fixed. Will the attached patch need reworking as a result of the #5799 change?
|
msg117876 - (view) |
Author: Hirokazu Yamamoto (ocean-city) * |
Date: 2010-10-02 14:10 |
In py3k, ntpath is almost fixed. but posixpath is not fixed yet.
ntpath has another problem about case sensitivity. I'll attach
the patch to fix ntpath's case issue and posixpath.
In Py27, ntpath has whole issue still there.
|
msg117877 - (view) |
Author: Hirokazu Yamamoto (ocean-city) * |
Date: 2010-10-02 14:11 |
I'll create the patch for it.
|
msg117894 - (view) |
Author: Hirokazu Yamamoto (ocean-city) * |
Date: 2010-10-02 19:55 |
Well, I said msg80877 past, and I think so too, but
os.path module of python2.x seems not to support UNC
correctly, and I'm not sure if the behavior change is
allowed here.
Probably UNC support is new feature, so I'll attach
the patch to solve only this problem as is.
|
msg119018 - (view) |
Author: Hirokazu Yamamoto (ocean-city) * |
Date: 2010-10-18 13:57 |
Committed fixes in r85689(py3k), r85693(release31-maint),
r85694(release27-maint). (This should work because I
simply ported already working fix in ntpath.relpath)
|
msg119024 - (view) |
Author: Stephen Hansen (ixokai) |
Date: 2010-10-18 14:41 |
FYI, this fix broke some buildbots: http://www.python.org/dev/buildbot/all/builders/x86%20Snow%20Leopard%202.7/builds/50 for instance. Gentoo too.
|
msg119068 - (view) |
Author: Bill Janssen (janssen) * |
Date: 2010-10-18 19:22 |
Broke bunches of 2.7 buildbots. But why are we running test_ntpath on OS X, anyway? Shouldn't this be skipped everywhere except win32 platforms?
|
msg119069 - (view) |
Author: Georg Brandl (georg.brandl) * |
Date: 2010-10-18 19:23 |
No - the posixpath/ntpath routines are meant to be usable for path manipulation for posix/NT paths on any platform.
|
msg119070 - (view) |
Author: Bill Janssen (janssen) * |
Date: 2010-10-18 19:25 |
Then we need to revert this patch and find one that works.
|
msg119100 - (view) |
Author: Hirokazu Yamamoto (ocean-city) * |
Date: 2010-10-19 01:25 |
Sorry, I've commit the fix in r85717(release27-maint).
I'll sit and watch buildbot.
|
msg119101 - (view) |
Author: Hirokazu Yamamoto (ocean-city) * |
Date: 2010-10-19 01:59 |
I confirmed test runs fine on x86 Snow Leopard 2.7.
So I'm closing this issue....
|
|
Date |
User |
Action |
Args |
2022-04-11 14:56:45 | admin | set | github: 49367 |
2010-10-19 01:59:36 | ocean-city | set | status: open -> closed resolution: fixed messages:
+ msg119101
|
2010-10-19 01:25:54 | ocean-city | set | messages:
+ msg119100 |
2010-10-18 19:25:02 | janssen | set | resolution: fixed -> (no value) messages:
+ msg119070 |
2010-10-18 19:23:59 | georg.brandl | set | nosy:
+ georg.brandl messages:
+ msg119069
|
2010-10-18 19:22:09 | janssen | set | nosy:
+ janssen messages:
+ msg119068
|
2010-10-18 18:34:41 | georg.brandl | set | status: closed -> open |
2010-10-18 14:41:49 | ixokai | set | nosy:
+ ixokai messages:
+ msg119024
|
2010-10-18 13:57:56 | ocean-city | set | status: open -> closed resolution: fixed messages:
+ msg119018
stage: commit review -> resolved |
2010-10-08 13:16:15 | ocean-city | set | stage: patch review -> commit review |
2010-10-02 19:55:31 | ocean-city | set | files:
+ py27_fix_relpath.patch
messages:
+ msg117894 |
2010-10-02 14:11:50 | ocean-city | set | messages:
+ msg117877 versions:
- Python 2.6 |
2010-10-02 14:10:40 | ocean-city | set | files:
+ py3k_fix_relpath.patch
messages:
+ msg117876 |
2010-09-29 08:51:50 | eckhardt | set | nosy:
+ eckhardt
|
2010-07-21 02:59:05 | BreamoreBoy | set | nosy:
+ BreamoreBoy messages:
+ msg110994
|
2009-07-03 14:28:59 | ocean-city | set | versions:
+ Python 3.2, - Python 3.0 |
2009-07-03 14:25:30 | ocean-city | set | dependencies:
+ Change ntpath functions to implicitly support UNC paths messages:
+ msg90061 |
2009-04-22 14:39:08 | ajaksu2 | set | priority: normal stage: patch review |
2009-03-04 22:01:21 | jimb | set | nosy:
+ jimb messages:
+ msg83146 |
2009-02-01 10:56:43 | ocean-city | set | title: os.path.relpath problem with root drive directory on windows -> os.path.relpath problem with root directory |
2009-02-01 07:41:43 | ocean-city | set | versions:
+ Python 3.0, Python 3.1, Python 2.7 |
2009-01-31 17:17:00 | ocean-city | set | messages:
- msg80864 |
2009-01-31 17:16:47 | ocean-city | set | files:
- fix_relpath_v2.patch |
2009-01-31 17:16:35 | ocean-city | set | files:
- fix_relpath.patch |
2009-01-31 17:16:22 | ocean-city | set | files:
+ fix_relpath_v3.patch messages:
+ msg80880 |
2009-01-31 16:21:54 | ocean-city | set | messages:
+ msg80877 |
2009-01-31 10:17:41 | ocean-city | set | files:
+ fix_relpath_v2.patch |
2009-01-31 10:17:24 | ocean-city | set | files:
- fix_relpath_v2.patch |
2009-01-31 10:01:57 | ocean-city | set | files:
+ fix_relpath_v2.patch messages:
+ msg80864 |
2009-01-31 09:20:20 | ocean-city | set | files:
+ fix_relpath.patch keywords:
+ patch messages:
+ msg80863 |
2009-01-31 08:46:39 | eli.bendersky | set | messages:
+ msg80862 |
2009-01-31 08:34:59 | ocean-city | set | nosy:
+ ocean-city messages:
+ msg80861 |
2009-01-31 07:25:51 | eli.bendersky | create | |