Preserve date when cp over smbfs

Gilbert Cao hika at bsdmon.com
Wed Dec 28 03:45:54 PST 2005


Hi, the list.

I have noticed some small problem when copying files over SMB.
My samba server (port version 3.0.8,1) is running on a FreeBSD 5.4
STABLE.
My samba client is running on a FreeBSD 6.0 STABLE.

When I copy a single file with the cp utility, with -p flag, to
a smbfs mounted directory, the modification datetime is not preserved and it
is set to the current datetime :
$ cp -p myfile /path/to/smbmountdir/

The same thing occurred with the tar utility :
$ tar cpf - myfile | tar xpvf - -C /path/to/smbmountdir/

However, I have tried to copy the same file to the same smbfs mounted
directory, with gqview (port version 2.0.1_1) and the modification datetime is preserved.

I have quickly looked into the source code of both cp and gqview, and it seems
that cp relies on utimes(), and gqview relies on utime().

Is there any other way for the cp and tar utilities to preserve file
datetime over SMB ?
In the problem comes from the smbfs kernel module ? or the cp and tar
utility ?

In the future, I would just like to avoid loading gqview, just to copy
files with preserve datetime :
cp and tar seems more natural :p

Regards.

-- 
--------------------------------
 (hika) Gilbert Cao
 http://www.miaouirc.com
  - MiaouIRC Project 2002-2003
 http://www.bsdmon.com
  - The BSD DMON Power to serve
 IRC : #miaule at IRCNET Network
--------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20051228/ef890ca4/attachment.bin


More information about the freebsd-questions mailing list