Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Nov 2017 16:38:57 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 223846] msdosfs does not reflect READONLY to user
Message-ID:  <bug-223846-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D223846

            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@FreeBSD.org
          Reporter: karl@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 chm=
od 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 M=
FC'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 =3D fileid;

        mode =3D S_IRWXU|S_IRWXG|S_IRWXO;
+       if ((dep->de_Attributes & ATTR_READONLY) !=3D 0)
+               mode &=3D ~(S_IWUSR|S_IWGRP|S_IWOTH);
        vap->va_mode =3D mode &
            (ap->a_vp->v_type =3D=3D VDIR ? pmp->pm_dirmask : pmp->pm_mask);
        vap->va_uid =3D pmp->pm_uid;

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-223846-8>