Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Nov 2017 14:22:15 -0600
From:      Karl Denninger <karl@denninger.net>
To:        freebsd-fs@freebsd.org
Subject:   Re: MSDOS Filesystem question related to "read-only" files
Message-ID:  <501b5bca-a4b0-7bd9-c1bd-09de0394e136@denninger.net>
In-Reply-To: <0e31a0cf-8a97-1d63-8ebb-9c61d22539cb@denninger.net>
References:  <f4ccb904-63fd-4641-89c8-09357fbb5a1c@denninger.net> <CAG6CVpUZumZaU9xVcri1Ry8=C6j6JrjX5F6qd3oKatYZXFu6Kg@mail.gmail.com> <e6a682a1-322e-a677-3d5e-0a7a503ebd40@denninger.net> <0e31a0cf-8a97-1d63-8ebb-9c61d22539cb@denninger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a cryptographically signed message in MIME format.

--------------ms070700060304010605090001
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Oh, here's another interesting anomaly -- MSDOS filesystems return "0"
for the free file count!

(gdb) print fsbuf
$3 =3D {f_version =3D 537068824, f_type =3D 50, f_flags =3D 4096, f_bsize=
 =3D 4096,
=C2=A0 f_iosize =3D 4096, f_blocks =3D 1949442, f_bfree =3D 1949436, f_ba=
vail =3D
1949436,
=C2=A0 f_files =3D 0, f_ffree =3D 0, f_syncwrites =3D 3, f_asyncwrites =3D=
 5,
=C2=A0 f_syncreads =3D 1907, f_asyncreads =3D 0, f_spare =3D 0xbf3fd628, =
f_namemax
=3D 255,
=C2=A0 f_owner =3D 0, f_fsid =3D {val =3D 0xbf3fd680}, f_charspare =3D 0x=
bf3fd688 "",
=C2=A0 f_fstypename =3D 0xbf3fd6d8 "msdosfs",
=C2=A0 f_mntfromname =3D 0xbf3fd6e8 "/dev/da0s1", f_mntonname =3D 0xbf3fd=
740 "/mnt"}

Needless to say that can cause some interesting issues if you're coding
to avoid potential inode exhaustion and the target is a MSDOS
filesystem..... FAT filesystems DO have a maximum file count, incidentall=
y.

On 11/20/2017 14:08, Karl Denninger wrote:
> Oh, my apologies -- I didn't include the version:
>
> FreeBSD 11.0-STABLE #0 r313159M: Fri Feb=C2=A0 3 09:58:35 CST 2017
>
> On an RPI2, but I doubt that matters.
>
>
> On 11/20/2017 14:02, Karl Denninger wrote:
>> root@Test-MCP:/home/karl/HD-MCP # cd /mnt
>> root@Test-MCP:/mnt # mount
>> /dev/ufs/rootfs on / (ufs, local, noatime, soft-updates, nfsv4acls)
>> devfs on /dev (devfs, local)
>> tmpfs on /tmp (tmpfs, local)
>> /dev/da0s1 on /mnt (msdosfs, local)
>> root@Test-MCP:/mnt # ls -al
>> total 408
>> drwxr-xr-x=C2=A0=C2=A0 1 hdmcp=C2=A0 wheel=C2=A0=C2=A0=C2=A0 4096 Jan=C2=
=A0 1=C2=A0 1980 .
>> drwxr-xr-x=C2=A0 20 root=C2=A0=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0 512=
 Nov 20 16:04 ..
>> drwxr-xr-x=C2=A0=C2=A0 1 hdmcp=C2=A0 wheel=C2=A0=C2=A0=C2=A0 4096 Nov =
19 11:20 System Volume Information
>> -rwxr-xr-x=C2=A0=C2=A0 1 hdmcp=C2=A0 wheel=C2=A0 127979 Nov 19 22:54
>> cam2-2017-11-19-22-54-47.jpg
>> -rwxr-xr-x=C2=A0=C2=A0 1 hdmcp=C2=A0 wheel=C2=A0 271295 Nov 19 22:57
>> cam2-2017-11-19-22-57-20.jpg
>> root@Test-MCP:/mnt # chmod u-w *
>> root@Test-MCP:/mnt # ls -al
>> total 408
>> drwxr-xr-x=C2=A0=C2=A0 1 hdmcp=C2=A0 wheel=C2=A0=C2=A0=C2=A0 4096 Jan=C2=
=A0 1=C2=A0 1980 .
>> drwxr-xr-x=C2=A0 20 root=C2=A0=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0 512=
 Nov 20 16:04 ..
>> drwxr-xr-x=C2=A0=C2=A0 1 hdmcp=C2=A0 wheel=C2=A0=C2=A0=C2=A0 4096 Nov =
19 11:20 System Volume Information
>> -rwxr-xr-x=C2=A0=C2=A0 1 hdmcp=C2=A0 wheel=C2=A0 127979 Nov 19 22:54
>> cam2-2017-11-19-22-54-47.jpg
>> -rwxr-xr-x=C2=A0=C2=A0 1 hdmcp=C2=A0 wheel=C2=A0 271295 Nov 19 22:57
>> cam2-2017-11-19-22-57-20.jpg
>> root@Test-MCP:/mnt #
>>
>> Nope.=C2=A0 The "w" is still there.
>>
>> No error returned from the "chmod" command (or if I call it from a C
>> program) but the file mode is NOT changed whether I'm doing it as the
>> superuser or as the owner of the file (and directory)
>>
>> On 11/20/2017 12:30, Conrad Meyer wrote:
>>> Hi Karl,
>>>
>>> In fact, msdosfs in FreeBSD should set the FAT READONLY attribute
>>> under two conditions:
>>>
>>> 1. The owner chmod's the file non-writeable (chmod u-w) (what you've
>>> described, I think).  Or,
>>> 2. The super user or otherwise privileged user sets the "readonly"
>>> flag on the file via chflags(1).
>>>
>>> How have you determined that chmod u-w does nothing?  What version of=

>>> FreeBSD are you using?
>>>
>>> Best,
>>> Conrad
>>>
>>>
>>> On Mon, Nov 20, 2017 at 7:36 AM, Karl Denninger <karl@denninger.net> =
wrote:
>>>> I'm running into an interesting issue here and wondering if there's =
a
>>>> way to do this under FreeBSD.
>>>>
>>>> MSDOS filesystems have a "primitive" permission capability;
>>>> specifically, they can have a "Read-only" attribute on a file.  It l=
ooks
>>>> like OpenBSD supports this from reading their man pages.
>>>>
>>>> FreeBSD doesn't appear to.  When you mount a msdos filesystem (e.g. =
a
>>>> USB stick) whoever owns the parent directory where you mount it give=
s
>>>> you the permissions and "ownership" of files on said filesystem.  Al=
l
>>>> good so far.  But attempting to chmod a file to remove write permiss=
ion
>>>> "succeeds" (returns success) but does nothing.
>>>>
>>>> Is this capability simply not present on FreeBSD?  I'm interested in=

>>>> using it as a means of "flagging" files on a USB stick in an applica=
tion
>>>> that I do not want to remove if the stick fills (basically, to "prot=
ect"
>>>> them from being aged off) and it appears there's no way to do it, ot=
her
>>>> than to use something unique in the filename that I would then have =
to
>>>> pay attention to.
>>>>
>>>> --
>>>> Karl Denninger
>>>> karl@denninger.net <mailto:karl@denninger.net>
>>>> /The Market Ticker/
>>>> /[S/MIME encrypted email preferred]/

--=20
Karl Denninger
karl@denninger.net <mailto:karl@denninger.net>
/The Market Ticker/
/[S/MIME encrypted email preferred]/

--------------ms070700060304010605090001
Content-Type: application/pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgMFADCABgkqhkiG9w0BBwEAAKCC
DdgwggagMIIEiKADAgECAhMA5EiKghDOXrvfxYxjITXYDdhIMA0GCSqGSIb3DQEBCwUAMIGL
MQswCQYDVQQGEwJVUzEQMA4GA1UECAwHRmxvcmlkYTESMBAGA1UEBwwJTmljZXZpbGxlMRkw
FwYDVQQKDBBDdWRhIFN5c3RlbXMgTExDMRgwFgYDVQQLDA9DdWRhIFN5c3RlbXMgQ0ExITAf
BgNVBAMMGEN1ZGEgU3lzdGVtcyBMTEMgMjAxNyBDQTAeFw0xNzA4MTcxNjQyMTdaFw0yNzA4
MTUxNjQyMTdaMHsxCzAJBgNVBAYTAlVTMRAwDgYDVQQIDAdGbG9yaWRhMRkwFwYDVQQKDBBD
dWRhIFN5c3RlbXMgTExDMRgwFgYDVQQLDA9DdWRhIFN5c3RlbXMgQ0ExJTAjBgNVBAMMHEN1
ZGEgU3lzdGVtcyBMTEMgMjAxNyBJbnQgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK
AoICAQC1aJotNUI+W4jP7xQDO8L/b4XiF4Rss9O0B+3vMH7Njk85fZ052QhZpMVlpaaO+sCI
KqG3oNEbuOHzJB/NDJFnqh7ijBwhdWutdsq23Ux6TvxgakyMPpT6TRNEJzcBVQA0kpby1DVD
0EKSK/FrWWBiFmSxg7qUfmIq/mMzgE6epHktyRM3OGq3dbRdO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ODXrFF0e/G8Lg0id+0Gdsw3yg2yI
tGUQTyzvVZTSuxqZCH5cQ7/hrlyIcXuVzC+2jNeejIA9cZ3t26DF9mbBYPGAoPq82aORRLQQ
sby2uSnII3/qkOEitr+PYOGDG7PKwF9acEMeQN+eTbFT1EXNs0OIo/7t5jNuF8UkyMFR2+RE
DB4injh0yEG9jLDy5IKtRpZNYObs78KsMi7d1JhW2UKH5tAWF7CyLuFdj1qmtMXjKuIOsNut
KtMntZQakh76MssojUba+Dvvs0o0SSjwACmx0qG6XQEkz3Mk0RQ4zrpmxSMw41Rf7cQQq+6/
YpTk2lC4NPqA9RRf/4G0QpfdhxnAzUhMk6xpKvc3Tzpnl3B8MBVBKPMd9mmbCBeOPujxC0wQ
0lOl78RVtlqPj3ZsUL3KlMAhSYNQN8CsQTMOmQMreAMQeRQhLYG6h1d9xwm0OLaIXFxkCceP
jfVVcTeYCUK8xp+hqe2PPka/mXFcg++zKqagTspXygAAAAAAAA==
--------------ms070700060304010605090001--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?501b5bca-a4b0-7bd9-c1bd-09de0394e136>