New submission from Tom Hale :
The os.path and Path implementations of samefile() do not allow comparisons of
symbolic links:
% mkdir empty && chdir empty
% ln -s non-existant broken
% ln broken lnbroken
% ls -i # Show inode numbers
19325632 broken@ 19325632 lnbroken@
% Yup, they
Tom Hale added the comment:
In summary:
The underlying os.stat() takes a follow_symlinks=True parameter but it can't be
set to False when trying to samefile() two symbolic links.
--
title: Add follow_symlinks=True to {os.path,Path}.samefile -> Add
follow_symlinks=True para
Tom Hale added the comment:
Related issue found in testing:
bpo-42778 Add follow_symlinks=True parameter to both os.path.samefile() and
Path.samefile()
--
___
Python tracker
<https://bugs.python.org/issue36
New submission from Tom Hale :
Here is a minimal test case:
==
#!/bin/bash
cd /tmp || exit 1
dir=test-copy_tree
src=$dir/src
dst=$dir/dst
mkdir -p "$src"
touch "$src"/file
ln -s file "$src/symlink"
pyth
Tom Hale added the comment:
Related:
bpo-41134 distutils.dir_util.copy_tree FileExistsError when updating symlinks
WIP update:
I am just about to ask for feedback on my proposed solution at
core-mentors...@python.org
--
title: Please add race-free os.link and os.symlink wrapper
Change by Tom Hale :
--
keywords: +patch
pull_requests: +20651
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/14464
___
Python tracker
<https://bugs.python.org/issu
Change by Tom Hale :
--
title: Allow os.symlink(src, target, force=True) to prevent race conditions ->
Race conditions due to os.link and os.symlink POSIX specification
___
Python tracker
<https://bugs.python.org/issu
Tom Hale added the comment:
Serhiy wrote
> Detected problem is better than non-detected problem.
I agree. I also assert that no problem (via a shutil wrapper) is better than a
detected problem which may not be handled.
While it's up to the programmer to handle exceptions, it's
Tom Hale added the comment:
I've created a PR here:
https://github.com/python/cpython/pull/14464
Only shutil.symlink is currently implemented.
Feedback sought from Windows users.
@Michael.Felt please note that `overwrite=False` is the default.
@taleinat I hope that the new implement
New submission from Tom Hale :
I cannot find a race-condition-free way to force overwrite an existing symlink.
os.symlink() requires that the target does not exist, meaning that it could be
created via race condition the two workaround solutions that I've seen:
1. Unlink existing sy
Tom Hale added the comment:
The most correct work-around I believe exists is:
(updates at: https://stackoverflow.com/a/55742015/5353461)
def symlink_force(target, link_name):
'''
Create a symbolic link pointing to target named link_name.
Overwri
Tom Hale added the comment:
Yes, but by default (because of difficulty) people won't check for this case:
1. I delete existing symlink in order to recreate it
2. Attacker watching symlink finds it deleted and recreates it
3. I try to create symlink, and an unexpected exception is r
Tom Hale added the comment:
Thanks Toshio Kuratomi, I raised it on the mailing list at:
https://code.activestate.com/lists/python-ideas/55992/
--
___
Python tracker
<https://bugs.python.org/issue36
Change by Tom Hale :
--
type: security -> enhancement
___
Python tracker
<https://bugs.python.org/issue36656>
___
___
Python-bugs-list mailing list
Unsubscrib
New submission from Tom Hale :
This comes from a question I raised on StackOverflow:
https://stackoverflow.com/q/47218313/5353461
I've copied the text
15 matches
Mail list logo