From owner-freebsd-bugs@freebsd.org Fri Nov 24 16:38:57 2017 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B68D4DEB685 for ; Fri, 24 Nov 2017 16:38:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4A427AF84 for ; Fri, 24 Nov 2017 16:38:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id vAOGcv6R021499 for ; Fri, 24 Nov 2017 16:38:57 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 223846] msdosfs does not reflect READONLY to user Date: Fri, 24 Nov 2017 16:38:57 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 11.0-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: karl@denninger.net X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Nov 2017 16:38:57 -0000 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.=