[issue19974] tarfile doesn't overwrite symlink by directory

2019-01-06 Thread Vajrasky Kok


Vajrasky Kok  added the comment:

Correction:
1. broken symlink overwrites valid symlink,
2. ordinary file overwrites broken symlink.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2019-01-06 Thread Vajrasky Kok


Vajrasky Kok  added the comment:

Martin, thank you for your advice. I have added additional two test cases for 
broken symlink case.
1. broken symlink overwrites ordinary file,
2. ordinary file overwrites broken symlink.

I hope that is enough. Let me know if you have another concern.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2019-01-06 Thread Vajrasky Kok


Vajrasky Kok  added the comment:

I have added test case for broken symlinks. I am not sure whether this is 
necessary or not. But anyway I have added it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2019-01-06 Thread Vajrasky Kok


Vajrasky Kok  added the comment:

After experimenting with lexists, I don't think I can simplify it with lexists.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2019-01-06 Thread Martin Panter

Martin Panter  added the comment:

About “lexists”, I meant using it instead of “os.path.exits” (not “islink”). On 
Linux:

>>> targetpath = 'target'
>>> os.symlink('nonexistant', dst=targetpath)  # Make a broken symlink
>>> os.system('ls -l')
total 0
lrwxrwxrwx 1 vadmium vadmium 11 Jan  6 09:28 target -> nonexistant
0
>>> os.path.exists(targetpath)  # Doesn't register broken symlinks
False
>>> os.path.lexists(targetpath)  # Does register it
True

Did you try extracting a tar file over a broken link? (I haven’t tried your 
code; I’m just going on theory.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2019-01-06 Thread Vajrasky Kok


Vajrasky Kok  added the comment:

Sorry, Martin. I just understood what you suggested. I thought you were saying 
lexists to replace islink, but it is to replace the complex if condition. Let 
me work on it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2019-01-06 Thread Vajrasky Kok


Vajrasky Kok  added the comment:

"I could not find a case where these methods return different result." -> This 
is wrong. My mistake. os.lexists returns True for non symbolic link file while 
os.islink returns False.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2019-01-06 Thread Vajrasky Kok


Vajrasky Kok  added the comment:

Martin Panter,

I have modernized the patch.

About your suggestion:
1. "import errno" -> Yes, this is unnecessary. I have removed it.
2. Use os.path.lexists instead of os.path.islink for broken symlink -> The 
thing is os.path.islink returns True also for broken symlink. I could not find 
a case where these methods return different result.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2019-01-06 Thread Vajrasky Kok


Change by Vajrasky Kok :


--
pull_requests: +10895, 10896, 10897, 10898
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2019-01-06 Thread Vajrasky Kok


Change by Vajrasky Kok :


--
pull_requests: +10895, 10896, 10898
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2019-01-06 Thread Vajrasky Kok


Change by Vajrasky Kok :


--
pull_requests: +10895, 10896
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2019-01-06 Thread Vajrasky Kok


Change by Vajrasky Kok :


--
pull_requests: +10895
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2018-12-17 Thread Vajrasky Kok


Vajrasky Kok  added the comment:

Martin Panter, thank you for reviewing my patch. Let me rework it. It has been 
a while (4 years!!!).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2018-12-17 Thread STINNER Victor


STINNER Victor  added the comment:

Martin: you review a patch written 4 years ago at 
https://bugs.python.org/review/19974/diff/11106/Lib/tarfile.py

Oh wow, I didn't know that Rietveld was still working :-D It's maybe time to 
convert the old patch to a proper pull request on GitHub, no? :-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2018-12-15 Thread Martin Panter

Martin Panter  added the comment:

I’m not sure if this should be considered a bug fix, but if it goes into 2.7 it 
would overlap with Issue 10761 and Issue 12088. In 2.7 existing directory 
entries (including broken symlinks, but not including subdirectories) may be 
replaced by symbolic and hard links.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2017-03-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2014-06-11 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2014-02-20 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Here is the preliminary patch to address Serhiy's concern. I added some 
regression tests as well. Give me a time to think how to refactor the code 
(especially the test).

--
Added file: 
http://bugs.python.org/file34152/fix_tarfile_overwrites_symlink_v4.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2014-02-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There are several issues with last patch.

* Fails to extract tarfiles containing the ./ directory (very common case).

* And even more common case -- fails to extract non-empty directory.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2014-02-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2014-02-09 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Yeah, you are right, Serhiy. I check the behaviour of GNU tar command line. It 
always replaces the target no matter what kind of file source and target are.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2014-01-19 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Ah, thanks for the review, Serhiy. My bad. There is no underlying bug of tar. I 
was confused by the behaviour of tar which is converting the absolute path to 
relative path.

So, adding '/home/user/dir/file' to tar when you are in '/home/user/dir' then 
extracting it in the same place, you'll get:
'/home/user/dir/home/user/dir/file'.

I thought it was a bug. But this is what it is supposed to be. I see that 
tarfile module is mimicking GNU tar behaviour.

This is the updated patch.

--
Added file: 
http://bugs.python.org/file33548/fix_tarfile_overwrites_symlink_v3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2014-01-19 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Serhiy commented, I think we should remove targetpath in all cases. Not only 
when softlink is
extracted.

I already did that in my latest patch but I am a little bit wary of this 
behaviour.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2014-01-16 Thread Chris Morgan

Chris Morgan added the comment:

Testing passed on OSX Mavericks.

--
nosy: +drpotato

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2014-01-15 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
stage:  - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2014-01-15 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
stage: patch review - needs patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2013-12-15 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Here is the patch that works both on Windows and Linux.

--
Added file: 
http://bugs.python.org/file33147/fix_tarfile_overwrites_symlink_v2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2013-12-14 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Here is the preliminary path. It works and tested on Linux. I'll check the 
behaviour on Windows later.

--
keywords: +patch
nosy: +vajrasky
Added file: 
http://bugs.python.org/file33128/fix_tarfile_overwrites_symlink.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2013-12-14 Thread Vajrasky Kok

Changes by Vajrasky Kok sky@speaklikeaking.com:


Removed file: 
http://bugs.python.org/file33128/fix_tarfile_overwrites_symlink.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2013-12-14 Thread Vajrasky Kok

Changes by Vajrasky Kok sky@speaklikeaking.com:


Added file: 
http://bugs.python.org/file33129/fix_tarfile_overwrites_symlink.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2013-12-13 Thread Antony Mayi

New submission from Antony Mayi:

tarfile.py compared to GNU tar doesn't overwrite existing symlink with 
directory of same name if such directory exists in the extracted tarball.

--
components: Library (Lib)
messages: 206066
nosy: antonymayi
priority: normal
severity: normal
status: open
title: tarfile doesn't overwrite symlink by directory
type: behavior
versions: Python 2.7, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2013-12-13 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +lars.gustaebel

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19974] tarfile doesn't overwrite symlink by directory

2013-12-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +serhiy.storchaka
versions: +Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19974
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com