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: [email protected]
          Reporter: [email protected]

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.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to