[Bug 223846] msdosfs does not reflect READONLY to user
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Fri Nov 24 16:38:57 UTC 2017
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223846
Bug ID: 223846
Summary: msdosfs does not reflect READONLY to user
Product: Base System
Version: 11.0-STABLE
Hardware: Any
OS: Any
Status: New
Severity: Affects Many People
Priority: ---
Component: kern
Assignee: freebsd-bugs at FreeBSD.org
Reporter: karl at denninger.net
As documented on freebsd-fs in response to a query I posted after observing the
above behavior msdosfs does not reflect the READONLY attribute on files in an
msdosfs-mounted filesystem back to userspace.
This means that while you can set the READONLY attribute on a file with chmod a
subsequent "stat" of that file (from a program), or a display with "ls" will
not reflect it in the file mode returned.
Conrad Meyer posted a short code snippet that would fix this; credit to him of
course on the identification but IMHO this should be changed globally and MFC'd
as appropriate.
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -287,6 +287,8 @@ msdosfs_getattr(struct vop_getattr_args *ap)
vap->va_fileid = fileid;
mode = S_IRWXU|S_IRWXG|S_IRWXO;
+ if ((dep->de_Attributes & ATTR_READONLY) != 0)
+ mode &= ~(S_IWUSR|S_IWGRP|S_IWOTH);
vap->va_mode = mode &
(ap->a_vp->v_type == VDIR ? pmp->pm_dirmask : pmp->pm_mask);
vap->va_uid = pmp->pm_uid;
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list