Bug 13709 - Setting User Tags (colour codes in OS X) extended attribute fails in finder but is actually successful using vfs_fruit
Summary: Setting User Tags (colour codes in OS X) extended attribute fails in finder b...
Status: RESOLVED INVALID
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: 4.8.7
Hardware: All Mac OS X
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-10 16:25 UTC by Ryan Launchbury
Modified: 2018-12-14 13:52 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Launchbury 2018-12-10 16:25:13 UTC
The finder reports the following errors when setting any extended attributes on samba volumes.

smb_ntstatus_error_to_errno: Couldn't map ntstatus (0xc0000161) to errno returning EIO
smbfs_vnop_setxattr: error 5 test9:com.apple.metadata:_kMDItemUserTags

However, the above attribute has actually been set on the file system and the colour code is visible.

[root@mag-ldn-mcn02 NETATALK_SMB]# getfattr -d createdonsmb.txt
# file: createdonsmb.txt
user.com.apple.metadata:_kMDItemUserTags=0sYnBsaXN0MDChAVZCbHVlCjQICgAAAAAAAAEBAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAARAA==


I'm assuming setting any other extended attribute from within the finder fails and is not visible on the file due to the fact that fruit doesn't support any other attributes except colours etc:

xattr -w user.com.apple.metadata:_test "True" /Volumes/NETATALK_SMB/createdonsmb.txt
xattr: [Errno 5] Input/output error: '/Volumes/NETATALK_SMB/createdonsmb.txt'
Comment 1 Ralph Böhme 2018-12-10 16:40:13 UTC
Does the version you've tested include the fixes for bug #13646 ?
Comment 2 Ryan Launchbury 2018-12-11 09:50:43 UTC
(In reply to Ralph Böhme from comment #1)

It doesn't appear to be in any of the release notes for 4.8.x no. I'll see if I can build 4.8.7 with the patch.
Comment 3 Ryan Launchbury 2018-12-11 10:13:36 UTC
Patch fails against 4.8.6 and 4.8.7:

patch -p1 <smbpatch.diff
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 2044 (offset -257 lines).
Hunk #2 succeeded at 2101 (offset -257 lines).
Hunk #3 succeeded at 2117 (offset -257 lines).
patching file source3/modules/vfs_streams_xattr.c
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 1970 (offset -141 lines).
Hunk #2 FAILED at 2190.
Hunk #3 succeeded at 4490 (offset -257 lines).
1 out of 3 hunks FAILED -- saving rejects to file source4/torture/vfs/fruit.c.rej
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 3413 (offset -262 lines).
Hunk #2 succeeded at 3424 (offset -262 lines).
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 2791 (offset -262 lines).
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 2044 (offset -262 lines).
Hunk #2 succeeded at 2163 (offset -262 lines).
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 2870 (offset -262 lines).
Hunk #2 succeeded at 2887 (offset -262 lines).
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 2970 (offset -262 lines).
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 3917 (offset -262 lines).
Hunk #2 succeeded at 3969 (offset -262 lines).
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 3188 (offset -262 lines).
Hunk #2 succeeded at 3233 (offset -262 lines).
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 3829 (offset -262 lines).
Hunk #2 succeeded at 3869 (offset -262 lines).
patching file selftest/knownfail.d/samba3.vfs.fruit
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file selftest/knownfail.d/samba3.vfs.fruit.rej
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 1904 (offset -141 lines).
patching file selftest/knownfail.d/samba3.vfs.fruit
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file selftest/knownfail.d/samba3.vfs.fruit.rej
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 3312 (offset -263 lines).
Hunk #2 succeeded at 3401 (offset -263 lines).
patching file selftest/knownfail.d/samba3.vfs.fruit
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file selftest/knownfail.d/samba3.vfs.fruit.rej
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 4719 (offset -262 lines).
Hunk #2 succeeded at 4823 (offset -262 lines).
Hunk #3 succeeded at 4894 (offset -262 lines).
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 5019 (offset -263 lines).
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 5528 (offset -263 lines).
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 1669 (offset -141 lines).
Hunk #2 succeeded at 1790 (offset -141 lines).
Hunk #3 succeeded at 3679 (offset -262 lines).
Hunk #4 succeeded at 4648 (offset -262 lines).
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 5604 (offset -263 lines).
patching file selftest/knownfail.d/samba3.vfs.fruit
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file selftest/knownfail.d/samba3.vfs.fruit.rej
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 5315 (offset -263 lines).
Hunk #2 succeeded at 5366 (offset -263 lines).
Hunk #3 succeeded at 5637 (offset -263 lines).
patching file source4/torture/smb2/util.c
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 2820 (offset -262 lines).
patching file selftest/knownfail.d/samba3.vfs.fruit
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file selftest/knownfail.d/samba3.vfs.fruit.rej
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 2820 (offset -262 lines).
Hunk #2 succeeded at 2879 (offset -262 lines).
Hunk #3 succeeded at 4997 (offset -262 lines).
Hunk #4 FAILED at 5912.
1 out of 4 hunks FAILED -- saving rejects to file source4/torture/vfs/fruit.c.rej
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 2111 (offset -263 lines).
Hunk #2 succeeded at 2132 (offset -263 lines).
Hunk #3 succeeded at 4536 (offset -263 lines).
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 5453 (offset -263 lines).
Hunk #2 succeeded at 5500 (offset -263 lines).
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 471 (offset -43 lines).
Hunk #2 succeeded at 5600 (offset -263 lines).
Hunk #3 succeeded at 5651 (offset -263 lines).
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 474 (offset -43 lines).
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 4222 (offset -263 lines).
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 3931 (offset -263 lines).
Hunk #2 succeeded at 4030 (offset -263 lines).
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 4709 (offset -169 lines).
Hunk #2 succeeded at 4724 (offset -169 lines).
Hunk #3 succeeded at 4885 (offset -263 lines).
Hunk #4 succeeded at 5154 (offset -263 lines).
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 4143 (offset -263 lines).
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 5069 (offset -263 lines).
Hunk #2 succeeded at 5081 (offset -263 lines).
Hunk #3 succeeded at 5138 (offset -263 lines).
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 4281 (offset -263 lines).
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 5119 (offset -263 lines).
Hunk #2 succeeded at 5143 (offset -263 lines).
patching file selftest/knownfail.d/samba3.vfs.fruit
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file selftest/knownfail.d/samba3.vfs.fruit.rej
patching file source3/modules/vfs_fruit.c
Hunk #1 succeeded at 3140 (offset -263 lines).
Hunk #2 succeeded at 3210 (offset -263 lines).
Hunk #3 succeeded at 3254 (offset -263 lines).
Hunk #4 succeeded at 3278 (offset -263 lines).
patching file source4/torture/vfs/fruit.c
Hunk #1 succeeded at 5199 (offset -262 lines).
Comment 4 Ryan Launchbury 2018-12-11 12:48:45 UTC
(In reply to Ralph Böhme from comment #1)

patched 4.8.6 and 4.8.7, problem remains when tagging files with colours.
Comment 5 Ryan Launchbury 2018-12-11 12:50:36 UTC
(In reply to ryan from comment #4)
In fact since patching I can no longer write files at all.
Comment 6 Ryan Launchbury 2018-12-11 13:35:29 UTC
(In reply to Ralph Böhme from comment #1)

Apologies, i can now in fact write custom xattrs since patching (I had a different issue stopping me from creating files):

touch test2
xattr -w user.test test test2 
xattr -l test2 
user.test: test


However, I still receive "error code -8058" when setting colour attributes in the finder. Yet they are actually being set:

xattr -l test2 
user.test: test
com.apple.FinderInfo:
00000000  00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00  |................|
00000010  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
00000020
Comment 7 Ryan Launchbury 2018-12-11 14:37:23 UTC
(In reply to ryan from comment #6)

It seems restricted to apple xattr for some reason. The first test works fine:

xattr -w hello Red test 
xattr -l test 
DosStream.test: test
hello: Red
com.apple.FinderInfo:
00000000  00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00  |................|
00000010  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
00000020


If I reference com.apple.metadata when writing an xattr it fails:

xattr -w com.apple.metadata:_kMDItemUserTags Red test 
xattr: [Errno 5] Input/output error: 'test'

xattr -w com.apple.metadata:testing Red test 
xattr: [Errno 5] Input/output error: 'test'
Comment 8 Guenther Deschner 2018-12-11 14:48:40 UTC
Just asking, are these operations done on a local filesystem or on a glusterfs volume?
Comment 9 Ryan Launchbury 2018-12-11 14:56:58 UTC
(In reply to Guenther Deschner from comment #8)

It is gluster yes.

I have disabled fruit and apple xattr's are added successfully:

xattr -l test4 
com.apple.FinderInfo:
00000000  00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00  |................|
00000010  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
00000020
com.apple.metadata:_kMDItemUserTags:
00000000  62 70 6C 69 73 74 30 30 A1 01 58 50 75 72 70 6C  |bplist00..XPurpl|
00000010  65 0A 33 08 0A 00 00 00 00 00 00 01 01 00 00 00  |e.3.............|
00000020  00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 13                                   |.....|
00000035

Albeit these are not visible when mounted via Netatalk. It certainly seems to be a fruit issue.
Comment 10 Ralph Böhme 2018-12-11 15:11:16 UTC
Hm, works for me:

Inti:~ slow$ xattr /Volumes/fruit_metadata_stream/file
com.apple.FinderInfo
com.apple.metadata:_kMDItemUserTags
Inti:~ slow$ xattr -w foo bar /Volumes/fruit_metadata_stream/file
Inti:~ slow$ xattr /Volumes/fruit_metadata_stream/file
foo
com.apple.FinderInfo
com.apple.metadata:_kMDItemUserTags
Inti:~ slow$ xattr -l /Volumes/fruit_metadata_stream/file
foo: bar
com.apple.FinderInfo:
00000000  00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00  |................|
00000010  00 00 00 00 00 00 00 00 80 00 00 00 00 00 00 00  |................|
00000020
com.apple.metadata:_kMDItemUserTags:
00000000  62 70 6C 69 73 74 30 30 A5 01 02 03 04 05 55 52  |bplist00......UR|
00000010  6F 74 0A 36 56 47 72 61 75 0A 31 56 4C 69 6C 61  |ot.6VGrau.1VLila|
00000020  0A 33 56 47 65 6C 62 0A 35 66 00 47 00 72 00 FC  |.3VGelb.5f.G.r..|
00000030  00 6E 00 0A 00 32 08 0E 14 1B 22 29 00 00 00 00  |.n...2....")....|
00000040  00 00 01 01 00 00 00 00 00 00 00 06 00 00 00 00  |................|
00000050  00 00 00 00 00 00 00 00 00 00 00 36              |...........6|
0000005c
Inti:~ slow$
Comment 11 Ralph Böhme 2018-12-11 15:12:16 UTC
(In reply to Ralph Böhme from comment #10)
Config:
[fruit_metadata_stream]
    path = /shares/test
    vfs objects = fruit streams_xattr acl_xattr
    fruit:metadata = stream
Comment 12 Guenther Deschner 2018-12-11 15:48:26 UTC
Is the behavior the same when you disable the mdcache?

gluster volume set <VOLUME> performance.cache-samba-metadata off
Comment 13 Ryan Launchbury 2018-12-11 15:56:25 UTC
(In reply to Ralph Böhme from comment #11)

Tried your smb.conf, still not working (removed my other fruit options and streams options from global):

[NETATALK_SMB]
vfs objects = fruit streams_xattr acl_xattr
fruit:metadata = stream
path = "/mnt/mcv02/data/NETATALK_SMB"
read only = no
guest ok = yes
valid users = "nobody" @"DEV\Domain users"
force directory mode = 0777
force create mode = 0777

My previous options were:

[GLOBAL]
fruit:aapl = yes
readdir_attr:aapl_rsize = yes
readdir_attr:aapl_finder_info = yes
readdir_attr:aapl_max_access = no
fruit:nfs_aces = no
fruit:time machine = no
fruit:locking = netatalk
fruit:encoding = native
fruit:metadata = netatalk
fruit:resource = xattr
streams_xattr:prefix = user.
streams_xattr:store_stream_type = yes
hide files = /.DS_Store/Network Trash Folder/TheFindByContentFolder/TheVolumeSettingsFolder/Temporary Items/.TemporaryItems/.VolumeIcon.icns/Icon?/.FBCIndex/.FBCLockFolder/

[NETATALK_SMB]
vfs objects = catia fruit streams_xattr
path = "/mnt/mcv02/data/NETATALK_SMB"
read only = no
guest ok = yes
valid users = "nobody" @"DEV\Domain users"
force directory mode = 0777
force create mode = 0777

This is with 4.8.7 patched with:

https://bugzilla.samba.org/show_bug.cgi?id=13649
https://bugzilla.samba.org/show_bug.cgi?id=13642
https://bugzilla.samba.org/show_bug.cgi?id=13646

Same result with both config options.
Comment 14 Ryan Launchbury 2018-12-11 15:58:42 UTC
(In reply to Guenther Deschner from comment #12)

Behaviour appears to be the same with metadata caching off
Comment 15 Ralph Böhme 2018-12-11 18:38:34 UTC
As documented in man vfs_fruit "fruit:resource = xattr" only works on Solarish OSes and eventually FreeBSD.
Comment 16 Ryan Launchbury 2018-12-12 09:02:06 UTC
(In reply to Ralph Böhme from comment #15)

I have already tested both file and stream, and I receive the same error.

This is on 10.14.1.
Comment 17 Ryan Launchbury 2018-12-14 13:52:32 UTC
Found the rogue config:

unix charset = ISO8859-15

Removed and all working.