Interesting observation with sparse files

Corinna Vinschen
Fri Aug 15 12:14:00 GMT 2003


just FYI, I found the following weird behaviour on XP.  I tried to create
two sparse files with random values:

$ createsparse sparse.1 123456789K
$ createsparse sparse.2 1234567890K

The first call worked, the second call failed and the resulting file
was of size 4K.

createsparse works like this:

  seek = strtoll(argv(2));
  fd = open(file);
  write(fd, buf, 4096);
  lseek(fd, seek, SEEK_CUR);
  write(fd, buf, 4096);

An strace revealed the following:

  off_low = 1477138432;
  off_high = 294;
  SetFilePointer(get_handle (), off_low, &off_high, FILE_CURRENT);

returned with no error.  But the following WriteFile() returned with
GetLastError() set to 1450:

$ net helpmsg 1450

Insufficient system resources exist to complete the requested service.


I have no explanation so far, Microsoft KB doesn't know anything about
this effect.  Note that already the first case creates a file which is
bigger than the partition and even the disk I try to create it on.  Also
removing that file before creating the second one doesn't change anything.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                      
Red Hat, Inc.

More information about the Cygwin-developers mailing list