[issue21876] os.rename(src, dst) does nothing when src and dst files are hard-linked

2021-11-17 Thread Eryk Sun
Eryk Sun added the comment: > It's nice if os.rename() can be atomic. How about fixing the behavior in shutil.move()? Currently it tries os.rename(src, dst) without checking for this case. For example: >>> os.path.samefile('src', 'dst') True >>> shutil.move('src', 'dst') 'ds

[issue21876] os.rename(src, dst) does nothing when src and dst files are hard-linked

2021-11-17 Thread STINNER Victor
STINNER Victor added the comment: It's nice if os.rename() can be atomic. It can be atomic if it is implemented as a single syscall and the source and the destination are on the same filesystem. If we modify the implement to check if src and/or dst is a hardlink, we will need more syscalls

[issue21876] os.rename(src, dst) does nothing when src and dst files are hard-linked

2021-10-25 Thread Irit Katriel
Change by Irit Katriel : -- nosy: +vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue21876] os.rename(src, dst) does nothing when src and dst files are hard-linked

2014-06-30 Thread Aaron Swan
Aaron Swan added the comment: At any rate, it is a bit of a nuisance that files remain present when the intent was to move them. -- ___ Python tracker ___ __

[issue21876] os.rename(src, dst) does nothing when src and dst files are hard-linked

2014-06-28 Thread R. David Murray
R. David Murray added the comment: It may be a backward compatibility problem to change it, but although the os functions tend to be thin wrappers, we also try to be cross platform when possible and we tend to follow what the corresponding shell command does rather than what the posix API does

[issue21876] os.rename(src, dst) does nothing when src and dst files are hard-linked

2014-06-27 Thread Aaron Swan
Aaron Swan added the comment: Although using the mv command *does* remove the src file on red hat linux, I can accept that the POSIX requirement that the source *must* be removed might not apply if source is the same as the destination file. It would be nice if the behavior was consistent, but

[issue21876] os.rename(src, dst) does nothing when src and dst files are hard-linked

2014-06-27 Thread Esa Peuha
Esa Peuha added the comment: This looks like a documentation bug. Functions in module os are usually just thin wrappers around the underlying OS functions, and POSIX states that doing nothing is the correct thing to do here. (It is arguably a bug in early Unix implementations that got mistaken

[issue21876] os.rename(src, dst) does nothing when src and dst files are hard-linked

2014-06-27 Thread Aaron Swan
New submission from Aaron Swan: On Linux Red Hat os.rename(src,dst) does nothing when src and dst files are hard-linked. It seems like the expected behavior would be the removal of the src file. This would be in keeping with the documentation that states: "On Unix, if dst exists and is a file