[Samba] Possible Bug in vfs_fruit with encoding=native

Dominik Vogel windoze345 at googlemail.com
Wed Nov 3 15:27:44 UTC 2021


Hello,

I have problems with setting custom folder-icons from a Mac on a samba share.
My system is macOS 10.15.7 the server is Debian 11 with Samba 4.13.5 (Default Package in Debian).
I also tried 4.15.1 from "apt.van-belle.nl“ but the results were worse (More details below).
All the tests were done with a fresh Debian-VM.

With Samba 4.13.5 it works when I set „fruit:encoding = private“.
In the log-file It looks to me that „ad_convert_delete_adfile“ gets the non-converted filename
and then fails since the file was created with the converted name.

I replaced the Carriage-Return character in the snippets with <CR> to make it clearer.
"Datei oder Verzeichnis nicht gefunden“ is „File or Directory not Found“ in English.
----------------------------------------
Log snippet from 4.13.5 „fruit:encoding = native“

You can see the name correctly converted in the first lines but the deletion uses the original one and fails.


[2021/11/03 14:46:21.190135, 10, pid=1039, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:1389(check_reduced_name)
  check_reduced_name realpath [._Icon] -> [/srv/share1/a/._Icon<CR>]
[2021/11/03 14:46:21.190149,  5, pid=1039, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:1495(check_reduced_name)
  check_reduced_name: ._Icon reduced to /srv/share1/a/._Icon<CR>
[2021/11/03 14:46:21.190165, 10, pid=1039, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_streams_xattr.c:387(streams_xattr_openat)
  streams_xattr_open called for ._Icon<CR> with flags 0x20802
[2021/11/03 14:46:21.190186,  4, pid=1039, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:939(vfs_ChDir)
  vfs_ChDir to /srv/share1
[2021/11/03 14:46:21.190217,  5, pid=1039, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:1001(vfs_ChDir)
  vfs_ChDir: vfs_ChDir got /srv/share1
[2021/11/03 14:46:21.190237,  2] ../../source3/smbd/open.c:1518(open_file)
  dv opened file a/._Icon read=Yes write=Yes (numopen=1)
[2021/11/03 14:46:21.190296, 10, pid=1039, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_streams_xattr.c:1011(streams_xattr_pread)
  streams_xattr_pread: offset=0, size=82
[2021/11/03 14:46:21.190326,  0] ../../source3/lib/adouble.c:1374(ad_convert_delete_adfile)
  ad_convert_delete_adfile: Unlinking [a/._Icon] failed: Datei oder Verzeichnis nicht gefunden
[2021/11/03 14:46:21.190534, 10, pid=1039, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_streams_xattr.c:522(streams_xattr_close)
  streams_xattr_close: streams_xattr_close called [a/._Icon] fd [50]
[2021/11/03 14:46:21.190559,  2] ../../source3/smbd/close.c:824(close_normal_file)
  dv closed file a/._Icon (numopen=0) NT_STATUS_OK
[2021/11/03 14:46:21.190574,  0] ../../source3/modules/vfs_fruit.c:3992(fruit_create_file)
  fruit_create_file: ad_convert() failed

----------------------------------------
Log snippet from 4.13.5 „fruit:encoding = private“

Since the special characters aren’t converted with this setting, the deletion with the original name succeeds.
The Icon is correctly shown in the macOS Finder.


[2021/11/03 14:46:23.416321, 10, pid=1039, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:1389(check_reduced_name)
  check_reduced_name realpath [._Icon] -> [/srv/share2/a/._Icon]
[2021/11/03 14:46:23.416335,  5, pid=1039, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:1495(check_reduced_name)
  check_reduced_name: ._Icon reduced to /srv/share2/a/._Icon
[2021/11/03 14:46:23.416351, 10, pid=1039, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_streams_xattr.c:387(streams_xattr_openat)
  streams_xattr_open called for ._Icon with flags 0x20802
[2021/11/03 14:46:23.416372,  4, pid=1039, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:939(vfs_ChDir)
  vfs_ChDir to /srv/share2
[2021/11/03 14:46:23.416401,  5, pid=1039, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:1001(vfs_ChDir)
  vfs_ChDir: vfs_ChDir got /srv/share2
[2021/11/03 14:46:23.416421,  2] ../../source3/smbd/open.c:1518(open_file)
  dv opened file a/._Icon read=Yes write=Yes (numopen=1)
[2021/11/03 14:46:23.416471, 10, pid=1039, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_streams_xattr.c:1011(streams_xattr_pread)
  streams_xattr_pread: offset=0, size=82
[2021/11/03 14:46:23.416533,  1] ../../source3/lib/adouble.c:1380(ad_convert_delete_adfile)
  ad_convert_delete_adfile: Unlinked [a/._Icon] after conversion
[2021/11/03 14:46:23.416602, 10, pid=1039, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_streams_xattr.c:522(streams_xattr_close)
  streams_xattr_close: streams_xattr_close called [a/._Icon] fd [50]
[2021/11/03 14:46:23.416671,  2] ../../source3/smbd/close.c:824(close_normal_file)
  dv closed file a/._Icon (numopen=0) NT_STATUS_OK

----------------------------------------
Log snippet from 4.15.1 „fruit:encoding = native“

I have basically the same error only the path / filenames aren’t shown in the „check_reduced_name“ lines


[2021/11/03 15:25:12.022604, 10, pid=5813, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:1323(check_reduced_name)
  check_reduced_name: check_reduced_name [.] [/srv/share1]
[2021/11/03 15:25:12.022679, 10, pid=5813, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:1387(check_reduced_name)
  check_reduced_name realpath [.] -> [/srv/share1]
[2021/11/03 15:25:12.022701,  5, pid=5813, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:1493(check_reduced_name)
  check_reduced_name: . reduced to /srv/share1
[2021/11/03 15:25:12.022720, 10, pid=5813, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_streams_xattr.c:333(streams_xattr_openat)
  streams_xattr_open called for . with flags 0x30000
[2021/11/03 15:25:12.022754, 10, pid=5813, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_streams_xattr.c:463(streams_xattr_close)
  streams_xattr_close: streams_xattr_close called [/srv/share1] fd [52]
[2021/11/03 15:25:12.022799,  5, pid=5813, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:1000(vfs_ChDir)
  vfs_ChDir: vfs_ChDir got /srv/share1
[2021/11/03 15:25:12.022831,  0] ../../source3/lib/adouble.c:1411(ad_convert_delete_adfile)
  ad_convert_delete_adfile: Unlinking [a/._Icon] failed: Datei oder Verzeichnis nicht gefunden
[2021/11/03 15:25:12.023111, 10, pid=5813, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_streams_xattr.c:463(streams_xattr_close)
  streams_xattr_close: streams_xattr_close called [a] fd [49]
[2021/11/03 15:25:12.023165, 10, pid=5813, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_streams_xattr.c:463(streams_xattr_close)
  streams_xattr_close: streams_xattr_close called [a/._Icon] fd [48]
[2021/11/03 15:25:12.023200,  0] ../../source3/modules/vfs_fruit.c:4171(fruit_create_file)
  fruit_create_file: ad_convert() failed

----------------------------------------
Log snippet from 4.15.1 „fruit:encoding = private“

Here the deletion succeeds (same as 4.13.5) but the icon still doesn’t show up in the macOS Finder.
If I look on the server directly I see the "._Icon“ file but it is only 82 bytes long (should be about 980kB with my test-icon).
So there seems to be an additional regression in the ea / adouble handling somewhere between 4.13.5 and 4.15.1.
If I set an icon with 4.13.5 and only switch to 4.15.1 the icon still shows up correctly in the Finder.
I can delete the icon successfully but can’t set a new one. So it’s only the writing which doesn’t work the reading seems fine.


[2021/11/03 16:04:38.200513, 10, pid=6879, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:1323(check_reduced_name)
  check_reduced_name: check_reduced_name [.] [/srv/share2]
[2021/11/03 16:04:38.200530, 10, pid=6879, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:1387(check_reduced_name)
  check_reduced_name realpath [.] -> [/srv/share2]
[2021/11/03 16:04:38.200545,  5, pid=6879, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:1493(check_reduced_name)
  check_reduced_name: . reduced to /srv/share2
[2021/11/03 16:04:38.200560, 10, pid=6879, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_streams_xattr.c:333(streams_xattr_openat)
  streams_xattr_open called for . with flags 0x30000
[2021/11/03 16:04:38.200588, 10, pid=6879, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_streams_xattr.c:463(streams_xattr_close)
  streams_xattr_close: streams_xattr_close called [/srv/share2] fd [54]
[2021/11/03 16:04:38.200608,  5, pid=6879, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/smbd/vfs.c:1000(vfs_ChDir)
  vfs_ChDir: vfs_ChDir got /srv/share2
[2021/11/03 16:04:38.200642,  1] ../../source3/lib/adouble.c:1418(ad_convert_delete_adfile)
  ad_convert_delete_adfile: Unlinked [a/._Icon] after conversion
[2021/11/03 16:04:38.200657, 10, pid=6879, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_streams_xattr.c:463(streams_xattr_close)
  streams_xattr_close: streams_xattr_close called [a] fd [52]

----------------------------------------
My smb.conf

[global]
    ea support = yes
    fruit:aapl = yes
    fruit:delete_empty_adfiles = yes
    fruit:encoding = native
    fruit:locking = none
    fruit:metadata = netatalk
    fruit:model = RackMac
    fruit:resource = file
    fruit:veto_appledouble = no
    fruit:wipe_intentionally_left_blank_rfork = yes
    guest account = guestusr
    log file = /var/log/samba/log.%m
    log level = 2 vfs:99
    map to guest = Bad User
    max log size = 1000
    mdns name = mdns
    multicast dns register = yes
    nt acl support = no
    obey pam restrictions = yes
    pam password change = yes
    panic action = /usr/share/samba/panic-action %d
    passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
    passwd program = /usr/bin/passwd %u
    printcap name = cups
    printing = cups
    server signing = auto
    streams_xattr:prefix = user.
    streams_xattr:store_stream_type = no
    time server = yes
    unix extensions = no
    unix password sync = yes
    username map = /etc/samba/smbusers
    vfs objects = catia fruit streams_xattr

[Share1]
    create mask = 0771
    directory mask = 02770
    force create mode = 0660
    force directory mode = 02770
    path = /srv/share1
    writeable = yes
    fruit:encoding = native

[Share2]
    create mask = 0771
    directory mask = 02770
    force create mode = 0660
    force directory mode = 02770
    path = /srv/share2
    writeable = yes
    fruit:encoding = private

----------------------------------------

If you need additional information, let me know.

Regards,
Dominik Vogel




More information about the samba mailing list