Issue 4616: tarfile does not set the creation date and time of the extracted directories (original) (raw)

Created on 2008-12-10 07:11 by throbi, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
testcase.zip throbi,2008-12-10 07:50
python_tarfile_win.JPG throbi,2008-12-10 08:47
unnamed throbi,2008-12-10 11:32
Messages (10)
msg77485 - (view) Author: Horváth István Róbert (throbi) Date: 2008-12-10 07:11
tarfile does not set the creation date and time of the extracted directories, all extracted directories will get the date and time of the extraction, although in the source archive (created by tarfile) the creation date and time is stored for directories, too.
msg77486 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-12-10 07:25
I cannot reproduce this; it works fine for me. Can you provide a test case?
msg77487 - (view) Author: Horváth István Róbert (throbi) Date: 2008-12-10 07:50
Sure, see the attachment. Just call: python pack.py unpack directory.tar You should get the folder named "directory" dated to the current date and time.
msg77488 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-12-10 08:05
I still cannot reproduce this: martin@mira:/tmp/h$ ls -l insgesamt 12 -rw-r--r-- 1 martin martin 172 10. Dez 08:40 directory.tar -rw-r--r-- 1 martin martin 1497 25. Feb 2008 pack.py -rw-r--r-- 1 martin martin 1129 10. Dez 08:58 testcase.zip martin@mira:/tmp/h$ date Mi 10. Dez 09:02:49 CET 2008 martin@mira:/tmp/h$ python pack.py unpack directory.tar Unpack done. martin@mira:/tmp/h$ ls -l insgesamt 16 drwxrwxrwx 2 martin martin 4096 10. Dez 08:38 directory -rw-r--r-- 1 martin martin 172 10. Dez 08:40 directory.tar -rw-r--r-- 1 martin martin 1497 25. Feb 2008 pack.py -rw-r--r-- 1 martin martin 1129 10. Dez 08:58 testcase.zip As you can see, directory is dated 8:38, even though the current time is 9:02.
msg77504 - (view) Author: Horváth István Róbert (throbi) Date: 2008-12-10 08:44
Sorry, I thought that by selecting component "Windows" from the first combo box I specify that this problem occurs on a windows machine. I run win xp sp2. As you can see in the screenshot, the unpacked directory has the current date and time.
msg77521 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-12-10 09:19
Can you debug this? Where specifically does the problem occur?
msg77530 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2008-12-10 10:15
Directory times are explicitly not set. The comment in TarFile.utime() says that it is an error on Windows to use utime on directories. I am no Windows expert, so I don't know if that is still true.
msg77532 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2008-12-10 11:04
Apparently it is not. os.utime() was fixed for Windows in Python 2.5 (r45925), so it should be possible for tarfile to set directory times now. I will prepare a patch.
msg77535 - (view) Author: Horváth István Róbert (throbi) Date: 2008-12-10 11:32
Wooow, you're fast! :-) We use Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32, so that will help us! Thank you, Robert On Wed, Dec 10, 2008 at 12:04 PM, Lars Gustäbel <report@bugs.python.org>wrote: > > Lars Gustäbel <lars@gustaebel.de> added the comment: > > Apparently it is not. os.utime() was fixed for Windows in Python 2.5 > (r45925), so it should be possible for tarfile to set directory times > now. I will prepare a patch. > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue4616> > _______________________________________ >
msg77674 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2008-12-12 15:23
I checked the necessary changes in the trunk and the py3k, release26-maint, and release30-maint branches (r67717-r67720). Thank you for your report.
History
Date User Action Args
2022-04-11 14:56:42 admin set github: 48866
2008-12-13 07:40:54 lars.gustaebel set resolution: fixed
2008-12-12 15:23:08 lars.gustaebel set status: open -> closedmessages: +
2008-12-10 11:32:09 throbi set files: + unnamedmessages: +
2008-12-10 11:04:40 lars.gustaebel set messages: +
2008-12-10 10:15:04 lars.gustaebel set messages: +
2008-12-10 09:19:56 loewis set assignee: lars.gustaebelmessages: + nosy: + lars.gustaebel
2008-12-10 08:47:33 throbi set files: + python_tarfile_win.JPG
2008-12-10 08:44:57 throbi set files: - python_tarfile_win.JPG
2008-12-10 08:44:06 throbi set files: + python_tarfile_win.JPGmessages: +
2008-12-10 08:05:31 loewis set messages: +
2008-12-10 07:50:03 throbi set files: + testcase.zipmessages: +
2008-12-10 07:25:50 loewis set nosy: + loewismessages: +
2008-12-10 07:11:19 throbi create