Files
lotherkandClaude Sonnet 5.5 e282d61715 docs/reference/netbsd-extattr.txt: file comments are dormant on a default NetBSD (t0200, step 1)
Read in src/: every ufs_*extattr operation answers EOPNOTSUPP until
extattrctl start has run (ufs_extattr.c:1048, :1165, :1291, :1323; started
only through ufs_extattr_autostart, :637, which needs /.attribute); FFS
does not start it at mount and no rc.d script does.  So on a default
install McdeSys' comment get/set answer MCDE_SYS_ENOTSUP ("This file system
keeps no comments"): the error mapping in netbsd.c is right, the feature does
nothing until an administrator sets it up.  The immutable-flag lock does not
depend on it.  Compile of netbsd.c with the cross gcc: clean.  Not run: no
NetBSD here (build/vm is gone).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 00:44:02 +00:00

42 lines
3.8 KiB
Plaintext

NetBSD extended attributes -- do file comments work on a default Makronix install? (t0200, step 1)
Read 2026-11-15 in src/ (this tree, NetBSD trunk as in src/BASE). Question: McdeSys keeps a file's comment as the
extended attribute "mcde.comment" in EXTATTR_NAMESPACE_USER (netbsd.c: mcde_sys_file_comment_get/set_backend). Does
extattr_set_file(2) work on the file system a default installation has (FFS, simple mode)?
1. What the kernel does
- sys/ufs/ufs/ufs_extattr.c, ufs_getextattr (:1032), ufs_setextattr (:1308), ufs_listextattr (:1148),
ufs_deleteextattr (:1277): each starts with
"if (!(ump->um_extattr.uepm_flags & UFS_EXTATTR_UEPM_STARTED)) return SET_ERROR(EOPNOTSUPP);"
(:1048, :1165, :1291, :1323). Without STARTED every call answers EOPNOTSUPP.
- STARTED is set by ufs_extattr_start (:372), reached from ufs_extattr_autostart (:637, the command
UFS_EXTATTR_CMD_START of extattrctl(2), :919). autostart "Does UFS_EXTATTR_FSROOTSUBDIR exist off the filesystem
root? If so, automatically start EA's." -- the directory is ".attribute" (sys/ufs/ufs/extattr.h:43), with the
subdirectories "system" and "user" (:44-45) holding one backing file per attribute (extattrctl initattr).
- sys/ufs/ffs/ffs_vfsops.c has no call of ufs_extattr_autostart (grep): FFS does not start attributes at mount.
src/etc/rc.d has no script that runs extattrctl (grep extattr src/etc/rc.d: nothing).
- The kernel option exists in GENERIC (src/sys/arch/amd64/conf/GENERIC:215, "options UFS_EXTATTR # Extended
attribute support for UFS1"); MODULAR has "-no options UFS_EXTATTR" (:58).
- extattr_get_file(2) (src/lib/libc/sys/extattr_get_file.2) lists no errors of the file system: "the file system
implementing the call may return any other errors it desires". ENOATTR for a missing attribute and
EOPNOTSUPP for "not started" are what ufs_extattr.c returns; netbsd.c handles ENOATTR and ENOTSUP/EOPNOTSUPP.
2. What follows (reading, NOT run: there is no NetBSD to run it on here and build/vm is gone)
- On a default installation nothing has run `extattrctl start` and there is no /.attribute: every comment get
returns EOPNOTSUPP -> McdeSys answers MCDE_SYS_ENOTSUP "This file system keeps no comments." and set does the
same. The error mapping is right; the FEATURE is dormant on NetBSD until an administrator creates
/.attribute/user (writable by the users) and runs `extattrctl start /`. extattrctl(8): "When a user attempts to
set a "user" or "system" extended attribute that lacks a backing file, the kernel will attempt to automatically
create it, provided .attribute/user or .attribute/system exist and are writable by the requesting user." The
maximum size of an attribute per inode is fixed when its backing file is made ("initattr ... a maximum
per-inode size for the attribute in bytes"; for an automatically made one vfs ufs_extattr_autocreate = 1024,
ufs_extattr.c:84, :259). What a comment longer than that does was not read.
- Decision for the owner of the Info window: either leave the comment as a Linux-only feature on NetBSD (the window
says why), or keep comments elsewhere on NetBSD (for example ~/.dt/ with a record per path) -- the second is
a design change, not done.
- The lock (chflags UF_IMMUTABLE, netbsd.c) does not depend on any of this: chflags(2) works on FFS for the owner.
Its error mapping answers EPERM for every failure (also a file system without flags); unmeasured, left as is.
3. What was done for t0200 step 1: netbsd.c passes x86_64--netbsd-gcc -std=gnu11 -fsyntax-only -Wall (include
<sys/extattr.h>, UF_IMMUTABLE, ENOATTR resolve) and compiled in the wm/mcde cross builds of 2026-11-14/15.
Steps 2-4 (comment round trip, lock, non-owner) need a running NetBSD.