bug-coreutils
[Top][All Lists]
Advanced

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

Re: cp command - problem with sparse


From: Eric Blake
Subject: Re: cp command - problem with sparse
Date: Tue, 01 Feb 2005 20:17:20 -0700
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to James Youngman on 2/1/2005 3:17 AM:
> 
> Unix systems automatically generate sparse files when programs seek
> forwards on their output file.  There is no need to have a "sparse"
> attribute.  This is what coreutils' "cp" does.  
> 
> Windows and NTFS don't work in this way.  Under NTFS, there is, as you
> say, a "sparse" attribute which must be set.  GNU coreutils runs on
> Windows under Cygwin and am not sure if Cygwin exposes any form of API
> which might allow cp to set the sparse attribute.  It's certainly a lot more 
> complex to do this under Windows. 
> 

According to the cygwin mailing list,
http://sources.redhat.com/ml/cygwin/2005-02/msg00013.html, cygwin already
supports sparse files when you do lseek beyond EOF during writes.  The
trick, however, is that NTFS on Windows XP does not create a hole until 128k.

Therefore, this patch is needed in the testsuite to turn a SKIP into a
PASS on cygwin:

2005-02-01  Eric Blake  <address@hidden>  (tiny change)

        * tests/du/8gb: Detect sparse files on NTFS under cygwin.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCAEZA84KuGfSFAYARAiFSAKDF7lb6zJq6ADLsFyHPrgkQ30tDaACcDT7P
8lGA+YY7czPjlGfVQYRANaQ=
=E+76
-----END PGP SIGNATURE-----
Index: tests/du/8gb
===================================================================
RCS file: /cvsroot/coreutils/coreutils/tests/du/8gb,v
retrieving revision 1.6
diff -u -p -r1.6 8gb
--- tests/du/8gb        3 May 2003 14:24:37 -0000       1.6
+++ tests/du/8gb        2 Feb 2005 03:19:31 -0000
@@ -26,7 +26,8 @@ fi
 # If this file system doesn't support sparse files,
 # don't try to create a file that'd end up consuming 8GB.
 # This happens on Darwin6.5 with a file system of type `hfs'.
-dd bs=1 seek=64K of=t < /dev/null 2> /dev/null
+# NTFS requires 128K before a hole appears in a sparse file.
+dd bs=1 seek=128K of=t < /dev/null 2> /dev/null
 set x `du -sk t`
 if test "$2" = 64; then
   echo "$0: skipping this test, since this file system doesn't support" 1>&2

reply via email to

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