time stamp on msdosfs could not be set by general user

Yoshihiko Sarumaru mistral at imasy.or.jp
Sat Apr 12 10:06:45 PDT 2003


Hello,

I've been wondering why cp -p files to msdosfs complains like
this:

mistral% cp -p somefile /dos/
cp: utimes: /dos/somefile: Operation not permitted
cp: chmod: /dos/somefile: Operation not permitted

I can understand errors about chmod, but I can not understand errors
about utimes and modified time could not be set at all.

This behavior is controllable by changing owner of mount point,
but I feel this is unreasonable.

Below patch ignores unmatching of user and file owner, and it
imply this block will be always ignored. 
Comment out with #if 0 ~ #endif may better. 

Any objection ?

--- sys/msdosfs/msdosfs_vnops.c.orig	Wed Jan  1 23:38:45 2003
+++ sys/msdosfs/msdosfs_vnops.c	Sun Apr 13 01:41:01 2003
@@ -498,9 +498,9 @@
 	}
 	if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) {
 		if (vp->v_mount->mnt_flag & MNT_RDONLY)
 			return (EROFS);
-		if (cred->cr_uid != pmp->pm_uid &&
+		if (/* cred->cr_uid != pmp->pm_uid */ 0 &&
 		    (error = suser_xxx(cred, ap->a_p, PRISON_ROOT)) &&
 		    ((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
 		    (error = VOP_ACCESS(ap->a_vp, VWRITE, cred, ap->a_p))))
 			return (error);

--
Yoshihiko Sarumaru
mail: mistral at imasy.or.jp       web: http://www.imasy.or.jp/~mistral/


More information about the freebsd-fs mailing list