This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: patch to allow touch to work on HPFS (and others, maybe??)
Corinna Vinschen <vinschen <at> redhat.com> writes:
> Huh? It reports "NTFS" as filesystem? Now, *that's* weird. Especially
> since none of the usual NTFS attributes are set.
I was surprised, too.
>
> Anyway, can you please test on both drives how they behave if utime
> uses FILE_WRITE_ATTRIBUTES vs. GENERIC_WRITE?
Well, that was my first time ever building cygwin1.dll, but it went smoothly.
As requested, I tested utimes() when opening with just FILE_WRITE_ATTRIBUTES
and with full-blown GENERIC_WRITE, on both the ClearCase and the NFS mounted
drives. In all four cases, touch(1), which boils down to utimes(2), was able
to modify all three file times for a file, but returned success without budging
any of the times on a directory. Meanwhile, on both the local NTFS partition
and a shared NTFS drive hosted by another windows machine, utimes(2) correctly
modified times for both files and directories.
>
> The expected result would be that the clearcase volume chokes with
> FILE_WRITE_ATTRIBUTES while the Solaris FS should work with it.
> Otherwise we're sort of doomed.
Then we're doomed (but was that ever a surprise from Windows? :)
I also noticed that on remote mounts, all file times are truncated to the
nearest second when setting or reading (I hope it is truncated, and not
rounded, because any OS that rounds times risks having timestamps in the
future, and that causes havoc). But when I logged in to my Solaris account,
and accessed the same file systems (the Clearcase and NFS mounts) from there,
touch was able to use sub-second resolutions, and correctly affected
directories. That means that the timestamp truncation is not an inherent
limitation of NFS or MVFS, but of the Windows implementation that talks to
those file systems. I don't know if there is a way to work around Windows not
touching the times of non-NTFS directories, but that probably isn't as
important.
$ cd m: # ClearCase mount (MVFS)
$ touch foo
$ stat foo
File: `foo'
Size: 0 Blocks: 0 IO Block: 1024 regular empty file
Device: 2345789h/36984713d Inode: 828882696040073479 Links: 1
Access: (0644/-rw-r--r--) Uid: (22382/ eblake) Gid: (10513/Domain Users)
Access: 2005-02-10 11:54:43.000000000 -0700
Modify: 2005-02-10 11:54:43.000000000 -0700
Change: 2005-02-10 11:54:43.000000000 -0700
$ touch foo
$ stat foo
File: `foo'
Size: 0 Blocks: 0 IO Block: 1024 regular empty file
Device: 2345789h/36984713d Inode: 828882696040073479 Links: 1
Access: (0644/-rw-r--r--) Uid: (22382/ eblake) Gid: (10513/Domain Users)
Access: 2005-02-10 11:54:47.000000000 -0700
Modify: 2005-02-10 11:54:47.000000000 -0700
Change: 2005-02-10 11:54:47.000000000 -0700
$ mkdir bar
$ stat bar
File: `bar'
Size: 89 Blocks: 1 IO Block: 1024 directory
Device: 2345789h/36984713d Inode: 828882678826239892 Links: 2
Access: (0755/drwxr-xr-x) Uid: (22382/ eblake) Gid: (10513/Domain Users)
Access: 2005-02-10 15:42:32.000000000 -0700
Modify: 2005-02-10 15:42:32.000000000 -0700
Change: 2005-02-10 15:42:32.000000000 -0700
$ touch bar
$ stat bar
File: `bar'
Size: 89 Blocks: 1 IO Block: 1024 directory
Device: 2345789h/36984713d Inode: 828882678826239892 Links: 2
Access: (0755/drwxr-xr-x) Uid: (22382/ eblake) Gid: (10513/Domain Users)
Access: 2005-02-10 15:42:32.000000000 -0700
Modify: 2005-02-10 15:42:32.000000000 -0700
Change: 2005-02-10 15:42:32.000000000 -0700
$ cd u: # NFS mount to drive hosted by Solaris, name reported as NTFS
$ touch foo
$ stat foo
File: `foo'
Size: 0 Blocks: 0 IO Block: 1024 regular empty file
Device: 12da0809h/316278793d Inode: 2778027755671012815 Links: 1
Access: (0644/-rw-r--r--) Uid: (22382/ eblake) Gid: (10513/Domain Users)
Access: 2005-02-10 11:55:31.000000000 -0700
Modify: 2005-02-10 11:55:31.000000000 -0700
Change: 2005-02-10 11:55:31.000000000 -0700
$ touch foo
$ stat foo
File: `foo'
Size: 0 Blocks: 0 IO Block: 1024 regular empty file
Device: 12da0809h/316278793d Inode: 2778027755671012815 Links: 1
Access: (0644/-rw-r--r--) Uid: (22382/ eblake) Gid: (10513/Domain Users)
Access: 2005-02-10 11:55:34.000000000 -0700
Modify: 2005-02-10 11:55:34.000000000 -0700
Change: 2005-02-10 11:55:34.000000000 -0700
$ mkdir bar
$ stat bar
File: `bar'
Size: 0 Blocks: 0 IO Block: 1024 directory
Device: 12da0809h/316278793d Inode: 2778027738457179228 Links: 1
Access: (0755/drwxr-xr-x) Uid: (22382/ eblake) Gid: (10513/Domain Users)
Access: 2005-02-10 15:40:19.000000000 -0700
Modify: 2005-02-10 15:40:19.000000000 -0700
Change: 2005-02-10 15:40:19.000000000 -0700
$ touch bar
$ stat bar
File: `bar'
Size: 0 Blocks: 0 IO Block: 1024 directory
Device: 12da0809h/316278793d Inode: 2778027738457179228 Links: 1
Access: (0755/drwxr-xr-x) Uid: (22382/ eblake) Gid: (10513/Domain Users)
Access: 2005-02-10 15:40:19.000000000 -0700
Modify: 2005-02-10 15:40:19.000000000 -0700
Change: 2005-02-10 15:40:19.000000000 -0700
$ rlogin perth # a Solaris box, where my $HOME is the same as u:\ above
% df -T .
Filesystem Type 1K-blocks Used Available Use% Mounted on
hirise:/vol/vol2/home/advtech3
nfs 83886080 74451144 9434936 89% /home/advtech3
% rm -rf foo bar
% touch foo
% stat foo
File: `foo'
Size: 0 Blocks: 0 IO Block: 8192 regular empty file
Device: 3e808beh/65538238d Inode: 4348428 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 542/ eblake) Gid: ( 542/ eblake)
Access: 2005-02-10 16:12:34.546699000 -0700
Modify: 2005-02-10 16:12:34.546699000 -0700
Change: 2005-02-10 16:12:34.546699000 -0700
% touch foo
% stat foo
File: `foo'
Size: 0 Blocks: 0 IO Block: 8192 regular empty file
Device: 3e808beh/65538238d Inode: 4348428 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 542/ eblake) Gid: ( 542/ eblake)
Access: 2005-02-10 16:12:39.652710000 -0700
Modify: 2005-02-10 16:12:39.652710000 -0700
Change: 2005-02-10 16:12:39.652710000 -0700
% mkdir bar
% stat bar
File: `bar'
Size: 4096 Blocks: 8 IO Block: 8192 directory
Device: 3e808beh/65538238d Inode: 4348430 Links: 2
Access: (2775/drwxrwsr-x) Uid: ( 542/ eblake) Gid: ( 542/ eblake)
Access: 2005-02-10 16:12:44.773717000 -0700
Modify: 2005-02-10 16:12:44.773717000 -0700
Change: 2005-02-10 16:12:44.773717000 -0700
% touch bar
% stat bar
File: `bar'
Size: 4096 Blocks: 8 IO Block: 8192 directory
Device: 3e808beh/65538238d Inode: 4348430 Links: 2
Access: (2775/drwxrwsr-x) Uid: ( 542/ eblake) Gid: ( 542/ eblake)
Access: 2005-02-10 16:12:49.289725000 -0700
Modify: 2005-02-10 16:12:49.289725000 -0700
Change: 2005-02-10 16:12:49.289725000 -0700
--
Eric Blake