-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"chflags uunlink foo" on FreeBSD fails with EOPNOSUPP ("chflags sunlink foo" works) #16809
Comments
ngie-eign
added a commit
to ngie-eign/kyua
that referenced
this issue
Nov 29, 2024
The testcases prior to this change relied on setting UF_UNLINK, which is unfortunately bugged on ZFS: ZFS does not treat UF_UNLINK as a valid value for fflags, which causes the testcases to fail. Switch to SF_UNLINK. This particular fflag requires root privileges, so add the needed metadata to the Kyuafile. As part of this, I needed to convert the test from atf-c++(3) to atf-c(3). The atf-c++(3) APIs do not have the printf-like equivalent formatting, so it was very difficult figuring out why things weren't working in atf-c++(3). While here, clean up the code to DRY some of the repeated logic that it contained. The UF_UNLINK bug has been reported in openzfs/zfs#16809 .
Ah neat. Easy fix incoming... fbsd-current# mdconfig -a -t malloc -s 100m
md0
fbsd-current# mdconfig -a -t malloc -s 100m
md1
fbsd-current# zpool create howitzer md0 md1
fbsd-current# cd /howitzer
fbsd-current# : > foo
fbsd-current# chflags uunlink foo
fbsd-current# ls -l
total 1
-rw-r--r-- 1 root wheel 0 Nov 29 10:44 foo
fbsd-current# rm foo
rm: foo: Operation not permitted
fbsd-current# chflags nouunlink foo
fbsd-current# rm foo
fbsd-current# |
ngie-eign
added a commit
to ngie-eign/openzfs-zfs
that referenced
this issue
Nov 29, 2024
The `UF_NOUNLINK` chflags fflag is analogous to `SF_NOUNLINK`, but instead of requiring superuser privileges when setting `SF_NOUNLINK`, unprivileged users (in addition to root) can set `UF_NOUNLINK` on compatible paths. This makes commands like `chflags uunlink <foo>` work on FreeBSD. This closes openzfs#16809. Signed-off-by: Enji Cooper <[email protected]>
13 tasks
ngie-eign
added a commit
to ngie-eign/openzfs-zfs
that referenced
this issue
Nov 29, 2024
The `UF_NOUNLINK` chflags fflag is analogous to `SF_NOUNLINK`, but instead of requiring superuser privileges when setting `SF_NOUNLINK`, unprivileged users (in addition to root) can set `UF_NOUNLINK` on compatible paths. This makes commands like `chflags uunlink <foo>` work on FreeBSD. This closes openzfs#16809. Signed-off-by: Enji Cooper <[email protected]>
ngie-eign
added a commit
to ngie-eign/kyua
that referenced
this issue
Nov 30, 2024
The testcases prior to this change relied on setting UF_NOUNLINK, which is unfortunately bugged on ZFS: ZFS does not treat UF_NOUNLINK as a valid value for fflags, which causes the testcases to fail. Switch to SF_NOUNLINK. This particular fflag works work ZFS, unlike UF_NOUNLINK, but requires root privileges, so add the needed metadata to the Kyuafile. As part of this, I needed to convert the test from atf-c++(3) to atf-c(3). The atf-c++(3) APIs do not have the printf-like equivalent formatting, so it was very difficult figuring out why things weren't working in atf-c++(3). While here, clean up the code to DRY some of the repeated logic that it contained. The UF_NOUNLINK bug has been reported in openzfs/zfs#16809 .
ngie-eign
added a commit
to ngie-eign/kyua
that referenced
this issue
Dec 1, 2024
The testcases prior to this change relied on setting UF_NOUNLINK, which is unfortunately bugged on ZFS: ZFS does not treat UF_NOUNLINK as a valid value for fflags, which causes the testcases to fail. Switch to SF_NOUNLINK. This particular fflag works work ZFS, unlike UF_NOUNLINK, but requires root privileges, so add the needed metadata to the Kyuafile. As part of this, I needed to convert the test from atf-c++(3) to atf-c(3). The atf-c++(3) APIs do not have the printf-like equivalent formatting, so it was very difficult figuring out why things weren't working in atf-c++(3). While here, clean up the code to DRY some of the repeated logic that it contained. The UF_NOUNLINK bug has been reported in openzfs/zfs#16809 . Fixes: e26c804
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chflags sunlink foo
works, butchflags uunlink foo
does not.Example:
This is probably because
zfs_freebsd_setattr(..)
does not mapUF_UNLINK
to a valid fflags attribute:zfs/module/os/freebsd/zfs/zfs_vnops_os.c
Lines 4813 to 4816 in d2b0ca9
Discovered when running a kyua unittest on /tmp backed by ZFS.
Reported on FreeBSD bugzilla as well.
The text was updated successfully, but these errors were encountered: