Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File's ctime differ in perl5 and perl6 #5407

Open
p6rt opened this issue Jun 30, 2016 · 4 comments
Open

File's ctime differ in perl5 and perl6 #5407

p6rt opened this issue Jun 30, 2016 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 30, 2016

Migrated from rt.perl.org#128506 (status was 'open')

Searchable as RT128506$

@p6rt
Copy link
Author

p6rt commented Jun 30, 2016

From sftf-misc@mail.ru

OS​: Windows Server 2012 R2 Standard
FS​: NTFS
TZ​: +06​:00

=== perl5
e​:\temporary>perl -v
This is perl 5, version 22, subversion 0 (v5.22.0) built for MSWin32-x64-multi-thread

e​:\temporary>type ctime.pl
use File​::stat;
use Time​::Piece;

my $fn1 = 't​:\temporary\tia\Энергия\print.pdf';
my $fn2 = 't​:\temporary\tia\Энергия\kl_to_1c.txt';
for ($fn1,$fn2) {
  my $fs = stat($_);
  print "$_\n";
  print 'changed ',gmtime($fs->ctime)->datetime,"\n";
  print 'modified ',gmtime($fs->mtime)->datetime,"\n";
  print 'accessed ',gmtime($fs->atime)->datetime,"\n";
}

e​:\temporary>perl ctime.pl
t​:\temporary\tia\Энергия\print.pdf
changed 2016-06-30T03​:50​:54 <== (1)
modified 2016-05-04T03​:03​:08
accessed 2016-06-30T03​:50​:54
t​:\temporary\tia\Энергия\kl_to_1c.txt
changed 2016-06-30T03​:50​:54 <== (3)
modified 2016-06-30T03​:12​:35
accessed 2016-06-30T03​:50​:54

=== perl6
e​:\temporary>perl6 -v
This is Rakudo version 2016.04 built on MoarVM version 2016.04
implementing Perl 6.c.

e​:\temporary>type ctime.pl6
use v6;
my $fio1 = 't​:\temporary\tia\Энергия\print.pdf'.IO;
my $fio2 = 't​:\temporary\tia\Энергия\kl_to_1c.txt'.IO;

for $fio1,$fio2 {
  say .path;
  say 'changed ', .changed.DateTime.truncated-to('second');
  say 'modified ', .modified.DateTime.truncated-to('second');
  say 'accessed ', .accessed.DateTime.truncated-to('second');

}

e​:\temporary>perl6 ctime.pl6
t​:\temporary\tia\Энергия\print.pdf
changed 2016-05-04T03​:03​:08Z <== (2)
modified 2016-05-04T03​:03​:08Z
accessed 2016-06-30T03​:50​:54Z
t​:\temporary\tia\Энергия\kl_to_1c.txt
changed 2016-06-30T04​:10​:08Z <== (4)
modified 2016-06-30T03​:12​:35Z
accessed 2016-06-30T03​:50​:54Z

(1) and (3) is what Windows show in file properties as 'Created'.
(1),(2) and (3),(4) are different.

Reproducing (1),(2).
1) Create file with text editor. Difference will be in seconds.
From perl5​:
  changed 2016-06-30T16​:38​:42
  modified 2016-06-30T16​:38​:48
  accessed 2016-06-30T16​:38​:42

From perl6​:
  changed 2016-06-30T16​:38​:48Z
  modified 2016-06-30T16​:38​:48Z
  accessed 2016-06-30T16​:38​:42Z

2) Edit this file several minutes later. Difference will be more noticeable.
From perl5​:
  changed 2016-06-30T16​:38​:42 <==
  modified 2016-06-30T16​:49​:17
  accessed 2016-06-30T16​:38​:42

From perl6​:
  changed 2016-06-30T16​:49​:17Z <==
  modified 2016-06-30T16​:49​:17Z
  accessed 2016-06-30T16​:38​:42Z

@p6rt
Copy link
Author

p6rt commented Jul 4, 2016

sftf-misc@mail.ru - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 1, 2016

From sftf-misc@mail.ru

CygWin

stat --v
stat (GNU coreutils) 8.23
Packaged by Cygwin (8.23-4)
stat print2.pdf
  File​: ‘print2.pdf’
  Size​: 9 Blocks​: 1 IO Block​: 65536 regular file
Device​: 58a40fd3h/1487146963d Inode​: 844424930137032 Links​: 1
Access​: (0644/-rw-r--r--) Uid​: ( 500/Administrator) Gid​: ( 513/Domain Users)
Access​: 2016-10-01 22​:38​:14.422316300 +0600
Modify​: 2016-06-30 22​:49​:17.215269700 +0600
Change​: 2016-10-01 22​:33​:28.579119600 +0600
Birth​: 2016-06-30 22​:38​:42.435453200 +0600

perl -v
This is perl 5, version 14, subversion 4 (v5.14.4) built for cygwin-thread-multi-64int
perl ctime2.pl
.\print2.pdf
changed 2016-10-01T22​:33​:28 # == stat 'Change'
modified 2016-06-30T22​:49​:17 # == stat 'Modify'
accessed 2016-10-01T22​:38​:14 # == stat 'Access'

Win32
This is perl 5, version 22, subversion 0 (v5.22.0) built for MSWin32-x64-multi-thread

perl ctime2.pl
.\print2.pdf
changed 2016-06-30T22​:38​:42 # == stat 'Birth'
modified 2016-06-30T22​:49​:17 # == stat 'Modify'
accessed 2016-10-01T22​:37​:42 # == ???

perl6 ctime2.pl6
This is Rakudo version 2016.07.1 built on MoarVM version 2016.0
implementing Perl 6.c.
perl6 ctime2.pl6
./print2.pdf
changed 2016-10-01T16​:33​:28Z # == stat 'Change'
modified 2016-06-30T16​:49​:17Z # == stat 'Modify'
accessed 2016-10-01T16​:38​:14Z # == stat 'Access'

@p6rt
Copy link
Author

p6rt commented Oct 3, 2016

From sftf-misc@mail.ru

Another shot.
ctime>stat --v
stat (GNU coreutils) 8.23
Packaged by Cygwin (8.23-4)
ctime>stat t​:/temporary/tia/Энергия/print.pdf
  File​: ‘t​:/temporary/tia/Энергия/print.pdf’
  Size​: 66288 Blocks​: 68 IO Block​: 65536 regular file
Device​: dfe235h/14672437d Inode​: 56294995342131413 Links​: 1
Access​: (0644/-rw-r--r--) Uid​: ( 500/Administrator) Gid​: ( 513/Domain Users)
Access​: 2016-10-03 10​:50​:16.791413100 +0600
Modify​: 2016-08-22 09​:08​:07.671978500 +0600
Change​: 2016-08-22 09​:08​:07.671978500 +0600
Birth​: 2016-10-03 10​:50​:16.791413100 +0600

# All 'stat' times are OK.

ctime>perl -v
This is perl 5, version 22, subversion 0 (v5.22.0) built for MSWin32-x64-multi-thread
ctime>perl ctime.pl
t​:\temporary\tia\Энергия\print.pdf
changed 2016-10-03T10​:50​:16 # != stat 'Change'
modified 2016-08-22T09​:08​:07 # OK
accessed 2016-10-03T10​:50​:16 # OK

ctime>perl6 ctime2.pl6
This is Rakudo version 2016.07.1 built on MoarVM version 2016.0
implementing Perl 6.c.
ctime>perl6 ctime.pl6
t​:\temporary\tia\Энергия\print.pdf
changed 2016-08-22T09​:08​:07Z # OK
modified 2016-08-22T09​:08​:07Z # OK
accessed 2016-10-03T10​:50​:16Z # OK

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant