Sorry for my poor english. In samba3.0.2rc2 smbd/dosmode.c/dos_mode(), I think below SPARSE attribute code is not good for Linux, because linux st_blocks gives the size of the file in 512-byte blocks. >#if defined (HAVE_STAT_ST_BLOCKS) && defined (HAVE_STAT_ST_BLKSIZE) > if (sbuf->st_size > sbuf->st_blocks * (SMB_OFF_T)sbuf->st_blksize) { > result |= FILE_ATTRIBUTE_SPARSE; > } >#endif Linux manpage of stat says : ---------------------------------------------------------------- The value st_size gives the size of the file (if it is a regular file or a symlink) in bytes. The size of a symlink is the length of the pathname it contains, without trailing NUL. The value st_blocks gives the size of the file in 512-byte blocks. (This may be smaller than st_size/512 e.g. when the file has holes.) The value st_blksize gives the "preferred" blocksize for efficient file system I/O. (Writing to a file in smaller chunks may cause an inefficient read-modify-rewrite.) ---------------------------------------------------------------- Probably, using STAT_ST_BLOCKSIZE is better way, same as smbd/trans2/get_allocation_size(). And, should make sure SPARSE attribute apply to regular file. Finally, I think below code is better for Linux. ------------------------------------------------------------------- #if defined (HAVE_STAT_ST_BLOCKS) && defined (STAT_ST_BLOCKSIZE) if (S_ISREG(sbuf->st_mode ) && sbuf->st_size > sbuf->st_blocks * STAT_ST_BLOCKSIZE ) { result |= FILE_ATTRIBUTE_SPARSE; } #endif -------------------------------------------------------------------
here's one for you jeremy. Might be interesting or no longer valid.
This fix appears to be in svn HEAD.
Added to SAMBA_3_0 and HEAD. Jeremy.
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.