delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/05/30/04:39:28

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=EDMP6Y1mfV73UQ3a7+QfLPz7GYnJ2fvz7iuRWoEDs3Eeh1aRXtR6E
3sALUgDSjowHSlV2SOgG1ZLW2zfkjDJLWoWQieuLwN7QoIeBUdIKgJGvhH/R+dWZ
d2VOfkKYbVQwBwlszG+nG4qw7g9RElB0SPi9rthHUS93lchqZjH0K4=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=Ew92FlVGNyxvcCCvnH3WelmRpIE=; b=jrTdjlGDr0YinqKZvlR+mCwY7Ozt
J0f7MGz/JA4M2Lb7SQ5h2Xe2pfv2IaCUJXyxPd74aYXgtLnX8yN99avFoRR/3G6Y
VLmxQsOvsVl0VqJAvzxMlFGCz6iqKZ14Ku2G8vNc6/ENdhIsfUlWx8izWwvf3B3x
efBHFfRzil+jq/0=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-94.6 required=5.0 tests=AWL,BAYES_50,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=Birth, st_birthtime, argue, UD:stat_result
X-HELO: calimero.vinschen.de
Date: Mon, 30 May 2016 10:39:01 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cygwin python os.stat gives wrong ctime
Message-ID: <20160530083901.GE12694@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <574A486B DOT 6000506 AT houseofpain DOT org>
MIME-Version: 1.0
In-Reply-To: <574A486B.6000506@houseofpain.org>
User-Agent: Mutt/1.6.1 (2016-04-27)

--mR8QP4gmHujQHb1c
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On May 28 21:39, Mitch Deoudes wrote:
> According to the python docs, os.stat() gives the following for st_ctime:
>=20
>     "|st_ctime| - platform dependent; time of most recent metadata change=
 on
> Unix, or the time of creation on Windows"
>=20
> To reproduce:
>     1) touch foo
>     2) wait a minute
>     3) touch foo
>     4) use python's os.stat() on the file foo
>=20
> cygwin's python 2.7.10 gives (me) the same number for mtime, ctime, and
> atime:
>=20
>     posix.stat_result(st_mode=3D33276, st_ino=3D40532396646393057,
> st_dev=3D1079873317, st_nlink=3D1, st_uid=3D1001, st_gid=3D513, st_size=
=3D0,
> st_atime=3D1464482278, st_mtime=3D1464482278, st_ctime=3D1464482278)
>=20
> However, cygwin's built-in stat command gives (correctly) the addtional
> "birth time", which is different:
>=20
>     Access: 2016-05-28 20:37:58.748977000 -0400
>     Modify: 2016-05-28 20:37:58.748977000 -0400
>     Change: 2016-05-28 20:37:58.748977000 -0400
>     Birth: 2016-05-28 20:36:34.514159100 -0400
>=20
> The non-cygwin version of Windows python from python.org (v2.7.11) behaves
> correctly as per spec:
>=20
>     nt.stat_result(st_mode=3D33206, st_ino=3D0L, st_dev=3D0L, st_nlink=3D=
0,
> st_uid=3D0, st_gid=3D0, st_size=3D0L, st_atime=3D1464482278L, st_mtime=3D=
1464482278L,
> st_ctime=3D1464482194L)
>=20
> Am I missing something, or is this a bug in cygwin's python?  You could
> argue that ctime is properly "change" and not "birth", but that's not what
> the python spec says it should be on Windows.

Cygwin's ctime is Change time, not Birth time, that's why Cygwin's stat
structure comes with an additional st_birthtime as on the BSDs.

I have no idea if python has a compile time option to make st_birthtime
visible, though.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--mR8QP4gmHujQHb1c
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXS/wlAAoJEPU2Bp2uRE+gvWwP/irbKNoh/OLKDywHhhSDMJRK
Ln1mWI72nHqwPfwTe5+zR+aMj0RB/BwU43Um9de5L8YCOjK0R1gkyT5WzTKpU/8w
FyNIPrFVoBAmi5bW8yNaD8eEtIfp2dCf5YJnpZ+ZoCHo1i4D+S+zxKStSX8awPRf
wSh9q61IXqnIn8ey9T9lECVuhmMMIb4crT8KKGevenob5IMzeuyB09N64tv4S6cQ
00egfbDWdLFvM9eApN+5XosHVcffGqbLvj4/TjNsBF9yBSaMrtKi56EkyeDcVQy0
A0gocRzQ5bKL2H2eq3qJbVxMvTR6rZyqxKL+qPprtVHmAcGpPqiGZtqhNo9BU+pn
wlnMf01pLxu9wRpB9Rl/HnUMGCJ3MSKNzdsax2wvlK6nJe+aOVgjYxQhi+EwYKP6
MhO/K85AGuIwEN6tUBqKB3zhtIsHjaVx2O50bCESysb7OoEy3RCL9FKSQXLACL3c
XbZNLCn578perTkf/bWfmrrEQgkyxesJdPE40AKFy52+UQe4LmKGXG8agDbZ+eV0
o78rArU0AuDvx8Svjv4nJwDiDOVYo7Xbfqx0tzavkKiGIDUBkpU6IZki2SZ29a8C
L0NoqlrB7BPx9Q/qHnOMbdOMf1oxes0yj2OxsTHie9FHiD/WeGLWbAGHez3cQq4o
Zn8zGuCJ/aNdcFc9ugL8
=U9Lc
-----END PGP SIGNATURE-----

--mR8QP4gmHujQHb1c--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019