cons-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: win32 weirdness


From: Kolarik, Tony
Subject: RE: win32 weirdness
Date: Fri, 20 Oct 2000 13:23:45 -0400

I decided to experiment with cons 2.0.2, using a saved version of one of
Steven Knight's generated test beds.  I wrote a little perl script that uses
stat, which cons uses to short circuit MD5 comparisons.  

The upshot seems to be that on NT the simple test of linked files
modification times isn't enough, since the contents don't necessarily change
in parallel. We may need to use the create time too.


# test.pl
my($nlink, $atime, $mtime, $ctime) = (stat($ARGV[0]))[3,8,9,10];
print "$ARGV[0]\tnlink: $nlink\tatime: $atime\tmtime: $mtime\tctime:
$ctime\n";

It looks like cons sets up a hard link on NT, which I didn't realize. The
interesting thing is that after the edit and save in MSDEV the access and
creation times of a linked file (in build\) mirror each other, even though
the link count drops to 1. Creation times do differ, with the MSDEV edited
file showing a new create time, the 'Linked' version showing the former
create time.  Sort of a partially broken hard link I guess... the stat
function returns an inode of 0 for every file I looked at.

Doing an extra file save w/o any edit in MSDEV, only updates the attributes
- including the create time - of the actual (unlinked) src file not the
'linked' one.

With notepad (or another editor), after cons has linked the files the
contents change in both files as do the access and modification times, but
the create time stays identical for both. 
 -- Tony K.


Below I first build an obj in a linked directory with cons, which creates a
link then I... 
stat the 'Linked' NT files; link count == 2, mtime == mtime, ctime == ctime 
show contents in both locations; identical 
edit and save the file in MSDEV
stat the 'Linked' NT files; link count == 1, mtime == mtime, ctime != ctime
show contents in both locations; differ
cons it in a Linked dir, unsuccessfully.

Edit the src file in Notepad
stat the 'Linked' NT files; link count == 1, mtime != mtime, ctime != ctime 
show contents in both locations; differ 
cons it in a Linked dir, successfully. 

Edit the src file in Notepad
stat the 'Linked' NT files; link count == 2, mtime != mtime, ctimes == ctime
show contents in both locations; identical
cons it in a Linked dir, successfully.


============================================================================

D:\test\cons\src_bld>perl cons build\bbb.obj
cl -nologo -c build\bbb.c -Fobuild\bbb.obj > nul

D:\test\cons\src_bld>test.pl src/bbb.c
src/bbb.c       nlink: 2        atime: 972050577        mtime: 972050577
ctime: 972050035

D:\test\cons\src_bld>test.pl build/bbb.c
build/bbb.c     nlink: 2        atime: 972050577        mtime: 972050577
ctime: 972050035

D:\test\cons\src_bld>cat src/bbb.c
void bbb(void) {printf("src/bbb.c\n");}
// new comment

D:\test\cons\src_bld>cat build/bbb.c
void bbb(void) {printf("src/bbb.c\n");}
// new comment

D:\test\cons\src_bld>echo Edit and Save in MSDEV
Edit and Save in MSDEV

D:\test\cons\src_bld>msdev

D:\test\cons\src_bld>test.pl src/bbb.c
src/bbb.c       nlink: 1        atime: 972051964        mtime: 972051964
ctime: 972051964

D:\test\cons\src_bld>test.pl build/bbb.c
build/bbb.c     nlink: 1        atime: 972051964        mtime: 972051964
ctime: 972050035

D:\test\cons\src_bld>cat src/bbb.c
void bbb(void) {printf("src/bbb.c\n");}


D:\test\cons\src_bld>cat build/bbb.c
void bbb(void) {printf("src/bbb.c\n");}
// new comment

D:\test\cons\src_bld>perl cons build\bbb.obj
cons: "build\bbb.obj" is up-to-date.

D:\test\cons\src_bld>echo Edit and Save in Notepad
Edit and Save in Notepad

D:\test\cons\src_bld>test.pl src/bbb.c
src/bbb.c       nlink: 1        atime: 972052140        mtime: 972052140
ctime: 972051964

D:\test\cons\src_bld>test.pl build/bbb.c
build/bbb.c     nlink: 1        atime: 972051964        mtime: 972051964
ctime: 972050035

D:\test\cons\src_bld>cat src/bbb.c
void bbb(void) {printf("src/bbb.c\n");            return;}


D:\test\cons\src_bld>cat build/bbb.c
void bbb(void) {printf("src/bbb.c\n");}
// new comment

D:\test\cons\src_bld>perl cons build\bbb.obj
cl -nologo -c build\bbb.c -Fobuild\bbb.obj > nul

D:\test\cons\src_bld>test.pl src/bbb.c
src/bbb.c       nlink: 2        atime: 972052196        mtime: 972052140
ctime: 972051964

D:\test\cons\src_bld>test.pl build/bbb.c
build/bbb.c     nlink: 2        atime: 972052196        mtime: 972052140
ctime: 972051964

D:\test\cons\src_bld>cat src/bbb.c
void bbb(void) {printf("src/bbb.c\n");            return;}


D:\test\cons\src_bld>cat build/bbb.c
void bbb(void) {printf("src/bbb.c\n");            return;}


D:\test\cons\src_bld>echo Edit and Save in Notepad
Edit and Save in Notepad

D:\test\cons\src_bld>test.pl src/bbb.c
src/bbb.c       nlink: 2        atime: 972052302        mtime: 972052302
ctime: 972051964

D:\test\cons\src_bld>test.pl build/bbb.c
build/bbb.c     nlink: 2        atime: 972052302        mtime: 972052302
ctime: 972051964

D:\test\cons\src_bld>cat src/bbb.c
void bbb(void) {printf("src/bbb.c\n");}


D:\test\cons\src_bld>cat build/bbb.c
void bbb(void) {printf("src/bbb.c\n");}


D:\test\cons\src_bld>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]