Bug 13642 - vfs_fruit should be able to cleanup AppleDouble files
Summary: vfs_fruit should be able to cleanup AppleDouble files
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-05 10:41 UTC by Ralph Böhme
Modified: 2018-11-06 08:09 UTC (History)
1 user (show)

See Also:


Attachments
Patch for 4.8 and 4.9 cherry-picked from master (26.54 KB, patch)
2018-11-01 12:55 UTC, Ralph Böhme
jra: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Böhme 2018-10-05 10:41:34 UTC
Giving the following scenario:

1. Samba server used for some time *without* any of the streams modules and with macOS clients.

2. When macOS clients create files on the server, the macOS internal APIs will create AppleDouble files (._FILE) on the server.

3. These AppleDouble contain the following marshalled data, some of it optional:
   a) FinderInfo (mandatory, fixed size 32 bytes)
   b) Extended Attributes (optional, variable size, if present part of FinderInfo)
   c) Resource Fork (optional, variable size)

4. The Resource Fork (3c) often doesn't contain real user data, instead the macOS internal API put the following fixed size 286 bytes into it:

    Entry ID   : 00000002 : Resource Fork
    Offset     : 00000052 : 82
    Length     : 0000011E : 286
    
    -RAW DUMP--:  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F : (ASCII)
    00000000   : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................
    00000010   : 54 68 69 73 20 72 65 73 6F 75 72 63 65 20 66 6F : This resource fo
    00000020   : 72 6B 20 69 6E 74 65 6E 74 69 6F 6E 61 6C 6C 79 : rk intentionally
    00000030   : 20 6C 65 66 74 20 62 6C 61 6E 6B 20 20 20 00 00 :  left blank   ..
    00000040   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    00000050   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    00000060   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    00000070   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    00000080   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    00000090   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    000000A0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    000000B0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    000000C0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    000000D0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    000000E0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    000000F0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    00000100   : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................
    00000110   : 00 00 00 00 00 00 00 00 00 1C 00 1E FF FF       : ..............

5. Sometimes later, the server is configured to use vfs_fruit *and* one of the streams module.

6. vfs_fruit already contains routines to convert 3a and 3b.

7. What is missing is the capability to detect this unneeded Resource Fork data with an option to discard it. I've seen systems with hundreds of thousands of such files.

8. With 7 in place, we would be able to nicely convert all relevant data from the AppleDouble files, we could safely delete the AppleDouble file.
Comment 1 Ralph Böhme 2018-11-01 12:55:10 UTC
Created attachment 14555 [details]
Patch for 4.8 and 4.9 cherry-picked from master

Karolin, please apply the backport for following dependent bugs in this order:

bug 13649
bug 13642 (this one)
bug 13646
Comment 2 Jeremy Allison 2018-11-01 18:09:51 UTC
Comment on attachment 14555 [details]
Patch for 4.8 and 4.9 cherry-picked from master

LGTM.
Comment 3 Jeremy Allison 2018-11-01 18:10:16 UTC
Re-assigning to Karolin for inclusion in 4.8.next, 4.9.next.
Comment 4 Karolin Seeger 2018-11-02 09:31:03 UTC
(In reply to Jeremy Allison from comment #3)
Pushed to autobuild-v4-{9,8}-test.
Comment 5 Karolin Seeger 2018-11-06 08:09:04 UTC
(In reply to Karolin Seeger from comment #4)
Pushed to both branches.
Closing out bug report.

Thanks!