This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: setting access time beyond Jan. 2038 on remote share failes on Win7 x64
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.2
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Amaury.Forgeot.d'Arc, Thorsten.Simons, amaury.forgeotdarc, vstinner
Priority: normal Keywords:

Created on 2011-11-24 13:49 by Thorsten.Simons, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (9)
msg148248 - (view) Author: Thorsten Simons (Thorsten.Simons) Date: 2011-11-24 13:49
Using Python '3.2.2 (default, Sep  4 2011, 09:07:29) [MSC v.1500 64 bit (AMD64)]' on Windows 7 Professional SP1:

If you set an access time for a file beyond Jan. 2038 on a file stored in a local NTFS filesystem, all's well:

>>> os.utime('c:\\temp_target\\ulp', (3433232323, 3433232323))
>>> os.stat('c:\\temp_target\\ulp')
nt.stat_result(st_mode=33206, st_ino=2251799813820060, st_dev=0, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=3433232323, st_mtime=3433232323, st_ctime=1322133855)
>>> time.ctime(3433232323)
'Mon Oct 17 13:38:43 2078'

If you try to do this on a remote share (mounted as y:), provided by a Linux x64 box running Samba x64, things are different:

>>> os.utime('y:\\temp_target2\\ulp', (3433232323, 3433232323))
>>> os.stat('y:\\temp_target2\\ulp')
nt.stat_result(st_mode=33206, st_ino=67150103, st_dev=0, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=910692730085, st_mtime=910692730085, st_ctime=1322133629)
>>> time.ctime(910692730085)
Traceback (most recent call last):
  File "<pyshell#22>", line 1, in <module>
    time.ctime(910692730085)
ValueError: unconvertible time

So, setting of access/modification time does not work - assumeably, we run into a 32-bit boundary somewhere...

Interestingly, if you set the respective access time from a Linux x64 box, you can see the right access time within Windows 7 via Explorer/Properties...
msg148251 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-11-24 13:59
The timestamp is converted to time_t (32 bits) and then to FILE_TIME (64 bits). A function to convert directly a PyObject to FILE_TIME should be written.
msg148284 - (view) Author: Amaury Forgeot d'Arc (Amaury.Forgeot.d'Arc) * Date: 2011-11-24 18:41
bits).
> A function to convert directly a PyObject to FILE_TIME should be written.

I thought that time_t was 64 bits on Windows
msg148592 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-11-29 18:45
> I thought that time_t was 64 bits on Windows

On Windows 64 bits, sizeof(time_t) is 64 bits and time.ctime(910692730085) works (return a string with year 2128).

It looks like Thorsten Simons is running Windows 32 bits.
msg148599 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2011-11-29 19:59
> > I thought that time_t was 64 bits on Windows
time_t *is* 64bit by default since Visual Studio 8, even with the 32bit compiler:
http://msdn.microsoft.com/en-us/library/1f4c8f33(v=vs.80).aspx
msg148602 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-11-29 20:36
> time_t *is* 64bit by default since Visual Studio 8

Ah? The issue was reported on a version compiled with Visual Studio 8. Notice "MSC v.1500" in:

> Using Python '3.2.2 (default, Sep  4 2011, 09:07:29)
> [MSC v.1500 64 bit (AMD64)]' on Windows 7 Professional SP1:
msg148616 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2011-11-29 21:38
It's probably SAMBA which does not support time_t above 32bit.
st_atime=910692730085 corresponds to a FILE_TIME of 0x7fffffffffffffff
msg148619 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2011-11-29 21:50
I found this samba bug: https://bugzilla.samba.org/show_bug.cgi?id=7785
It is fixed since Samba version 3.5.8.
msg148644 - (view) Author: Thorsten Simons (Thorsten.Simons) Date: 2011-11-30 08:28
Gentlemen,

thank you for your contribution - the information about the Samba fix solved the problem!
History
Date User Action Args
2022-04-11 14:57:24adminsetgithub: 57680
2011-11-30 08:30:09petri.lehtinensetresolution: works for me -> not a bug
stage: resolved
2011-11-30 08:28:15Thorsten.Simonssetstatus: open -> closed
resolution: works for me
messages: + msg148644
2011-11-29 21:50:25amaury.forgeotdarcsetmessages: + msg148619
2011-11-29 21:38:44amaury.forgeotdarcsetmessages: + msg148616
2011-11-29 20:36:12vstinnersetmessages: + msg148602
2011-11-29 19:59:17amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg148599
2011-11-29 18:45:42vstinnersetmessages: + msg148592
2011-11-24 18:41:20Amaury.Forgeot.d'Arcsetnosy: + Amaury.Forgeot.d'Arc
messages: + msg148284
2011-11-24 13:59:55vstinnersetnosy: + vstinner
messages: + msg148251
2011-11-24 13:49:27Thorsten.Simonscreate