Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
268e61cf
Commit
268e61cf
authored
Jun 03, 2005
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #1213894: os.path.realpath didn't resolve symlinks that were the first
component of the path.
parent
56616999
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
Lib/posixpath.py
Lib/posixpath.py
+1
-1
Lib/test/test_posixpath.py
Lib/test/test_posixpath.py
+20
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/posixpath.py
View file @
268e61cf
...
...
@@ -414,7 +414,7 @@ symbolic links encountered in the path."""
if
isabs
(
filename
):
bits
=
[
'/'
]
+
filename
.
split
(
'/'
)[
1
:]
else
:
bits
=
filename
.
split
(
'/'
)
bits
=
[
''
]
+
filename
.
split
(
'/'
)
for
i
in
range
(
2
,
len
(
bits
)
+
1
):
component
=
join
(
*
bits
[
0
:
i
])
...
...
Lib/test/test_posixpath.py
View file @
268e61cf
...
...
@@ -476,6 +476,26 @@ class PosixPathTest(unittest.TestCase):
self
.
safe_rmdir
(
ABSTFN
+
"/k/y"
)
self
.
safe_rmdir
(
ABSTFN
+
"/k"
)
self
.
safe_rmdir
(
ABSTFN
)
def
test_realpath_resolve_first
(
self
):
# Bug #1213894: The first component of the path, if not absolute,
# must be resolved too.
try
:
old_path
=
abspath
(
'.'
)
os
.
mkdir
(
ABSTFN
)
os
.
mkdir
(
ABSTFN
+
"/k"
)
os
.
symlink
(
ABSTFN
,
ABSTFN
+
"link"
)
os
.
chdir
(
dirname
(
ABSTFN
))
base
=
basename
(
ABSTFN
)
self
.
assertEqual
(
realpath
(
base
+
"link"
),
ABSTFN
)
self
.
assertEqual
(
realpath
(
base
+
"link/k"
),
ABSTFN
+
"/k"
)
finally
:
os
.
chdir
(
old_path
)
self
.
safe_remove
(
ABSTFN
+
"link"
)
self
.
safe_rmdir
(
ABSTFN
+
"/k"
)
self
.
safe_rmdir
(
ABSTFN
)
# Convenience functions for removing temporary files.
def
pass_os_error
(
self
,
func
,
filename
):
...
...
Misc/NEWS
View file @
268e61cf
...
...
@@ -136,6 +136,9 @@ Extension Modules
Library
-------
- Bug #1213894: os.path.realpath didn'
t
resolve
symlinks
that
were
the
first
component
of
the
path
.
-
Patch
#
1120353
:
The
xmlrpclib
module
provides
better
,
more
transparent
,
support
for
datetime
.{
datetime
,
date
,
time
}
objects
.
With
use_datetime
set
to
True
,
applications
shouldn
't have to fiddle with the DateTime wrapper
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment