Mail Archives: cygwin/2010/11/22/05:58:17
--9zSXsLTf0vkW971A
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
On Nov 20 22:17, A.R. Burgers wrote:
> LS,
>
> on 1.7.8 files the contents of a file on a netapp share can not be read by all programs.
> [...]
> #! /bin/sh
>
> uname -a
> zz=/shares/g_zon_software/cygwin17
> ls -l $zz/bug.txt
> rm -f $zz/bug.txt
> cat << HERE > $zz/bug.txt
> line 1
> HERE
> ls -l $zz/bug.txt
> cat $zz/bug.txt
> file $zz/bug.txt
> cat /etc/fstab | grep g_zon_software
> mount -m | grep 'share.*g_zon_software'
> CYGWIN_NT-5.1 P4114 1.7.8s(0.233/5/3) 20101118 15:52:06 i686 Cygwin
> -rw-r--r-- 1 burgers Domain Users 0 2010-11-19 13:35 /shares/g_zon_software/cygwin17/bug.txt
> -rw-r--r-- 1 burgers Domain Users 0 2010-11-19 13:36 /shares/g_zon_software/cygwin17/bug.txt
> line 1
> /shares/g_zon_software/cygwin17/bug.txt: empty
So it appears that you *can* read the files after all, but the stat
function returns a file size of 0, right? So all tools which test
the file size before opening a file will fail.
The question now is, why does it return 0. What has changed in Cygwin
is that a core function now uses the FileNetworkOpenInformation class to
fetch file information. Maybe that's not quite correctly implemented on
Netapps?
Can you please give the attached testcase a try? Link it against ntdll
and use the DOS path to the file as parameter, like this:
$ gcc -g -o ntqueryfile ntqueryfile.c -lntdll
$ ./ntqueryfile \\\\nas01\\g_zon_software\\cygwin17\\bug.txt
Please paste the output into your reply.
Thanks,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--9zSXsLTf0vkW971A
Content-Type: text/x-c++src; charset=utf-8
Content-Disposition: attachment; filename="ntqueryfile.c"
#include <stdio.h>
#include <ddk/ntifs.h>
#include <sys/cygwin.h>
BOOL NTAPI RtlCreateUnicodeStringFromAsciiz (PUNICODE_STRING, PCSTR);
int
main (int argc, char **argv)
{
UNICODE_STRING wpath;
UNICODE_STRING upath;
HANDLE h;
OBJECT_ATTRIBUTES attr;
IO_STATUS_BLOCK io;
NTSTATUS status;
FILE_NETWORK_OPEN_INFORMATION fnoi;
FILE_STANDARD_INFORMATION fsi;
if (argc < 2)
{
fprintf (stderr, "usage: %s DOS-PATH\n", argv[0]);
return 1;
}
if (!RtlCreateUnicodeStringFromAsciiz (&wpath, argv[1]))
{
fprintf (stderr, "RtlCreateUnicodeStringFromAsciiz failed\n");
return 1;
}
if (!RtlDosPathNameToNtPathName_U (wpath.Buffer, &upath, NULL, NULL))
{
fprintf (stderr, "RtlDosPathNameToNtPathName_U failed\n");
RtlFreeUnicodeString (&wpath);
return 1;
}
InitializeObjectAttributes (&attr, &upath, 0, NULL, NULL);
status = NtOpenFile (&h, READ_CONTROL | FILE_READ_ATTRIBUTES, &attr, &io,
FILE_SHARE_VALID_FLAGS,
FILE_OPEN_REPARSE_POINT | FILE_OPEN_FOR_BACKUP_INTENT);
if (!NT_SUCCESS (status))
{
fprintf (stderr, "NtOpenFile: 0x%08lX\n", status);
return 1;
}
status = NtQueryInformationFile (h, &io, &fnoi, sizeof fnoi,
FileNetworkOpenInformation);
if (!NT_SUCCESS (status))
fprintf (stderr, "NtQueryInformationFile(FNOI): 0x%08lx\n", status);
else
{
printf ("fnoi.AllocationSize %lld\n", fnoi.AllocationSize.QuadPart);
printf ("fnoi.EndOfFile %lld\n", fnoi.EndOfFile.QuadPart);
}
status = NtQueryInformationFile (h, &io, &fsi, sizeof fsi,
FileStandardInformation);
if (!NT_SUCCESS (status))
fprintf (stderr, "NtQueryInformationFile(FSI): 0x%08lx\n", status);
else
{
printf (" fsi.AllocationSize %lld\n", fsi.AllocationSize.QuadPart);
printf (" fsi.EndOfFile %lld\n", fsi.EndOfFile.QuadPart);
}
NtClose (h);
return 0;
}
--9zSXsLTf0vkW971A
Content-Type: text/plain; charset=us-ascii
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
--9zSXsLTf0vkW971A--
- Raw text -