[PATCH] Re: fruit_rename() prepend ._ again if fruit:ressource=file

Jones Syue jonessyue at qnap.com
Wed Jun 28 01:32:57 UTC 2017


Hello Ralph,

Found another workaround for windows clients,
if with a temporary filename as a intermediate file,
finally could rename to "._newfile.txt" without a windows
explorer's warning: The file or folder does not exist.

For example, "._newfile_tmp.txt" is a intermediate file,
need 2 steps from a windows client,
1. rename "newfile.txt" to "._newfile_tmp.txt"
2. rename "._newfile_tmp.txt" to "._newfile.txt"

Some (power?) users might want to rename these files
directly without a intermediate file as temporary,
hence please help consider this special case:
do not call 2nd rename() if the source appledouble basename
matched destination basename, because these reasons
1. to avoid windows explorer warning.
2. to avoid a intermediate file as temporary.
3. for netatalk (afp) compatibility.

So far not get further details from these users, i guess this scenario
might a bit like backup/restore files among different machines,
including the appledouble files by manually handled from windows clients.

smb.conf
[global]
fruit:nfs_aces = no
fruit:veto_appledouble = no
vfs objects =  shadow_copy2 catia fruit streams_depot aio_pthread

--
Regards,
Jones Syue | 薛懷宗
QNAP Systems, Inc.

On Tue, Jun 27, 2017 at 6:11 PM, Jones Syue <jonessyue at qnap.com> wrote:

> Hellp Ralph,
>
> Thank you for kindly feedback!
>
> 1. How about  fruit:resource=stream?
>
> Yes as you mentioned the reason is design for netatalk (afp)
> compatibility, hence so far fruit:resource=file is preferred.
>
> 2. Why rename with prefix string "._" from Windows client?
>
> Some (power?) users might want to manually handle the
> AppleDouble files from Windows clients,
> because macOS Finder is not allowed do this:
> rename a file with prefix string "._" or prefix char "." (single dot).
> But im not quite sure the scenario or objective so far,
> will ask for more details and come back to list soon.
>
> With earlier version if "vfs objects = fruit" is not set,
> they could rename files with prefix string "._" from an Windows client.
> But now if "vfs objects = fruit" is set,
> they might a bit confuse because finally the destination name
> with prefix string "._._" is not as expected prefix "._",
> hence might consider to keep this special rename case with vfs_fruit.
>
>
>
> --
> Regards,
> Jones Syue | 薛懷宗
> QNAP Systems, Inc.
>
> On Tue, Jun 27, 2017 at 4:46 PM, Ralph Böhme <slow at samba.org> wrote:
>
>> On Tue, Jun 27, 2017 at 03:02:14PM +0800, Jones Syue via samba-technical
>> wrote:
>> > Hello list,
>> >
>> > Test master (4.7.0pre1-GIT-bcfa12c) also has this symptom,
>> > refer to attach gdb log,
>> > 1st rename() and 2nd rename() are came from fruit_rename(),
>> > which call SMB_VFS_NEXT_RENAME() twice.
>> >
>> > Attached patch could address this issue,
>> > this patch checks if the source appledouble basname matched
>> > the destination basename; if they are matched,
>> > would goto done and avoid 2nd rename().
>> > Please help review and any suggestions are appreciated,
>> > thank you.
>> >
>> > For example,
>> > a text file called "newfile.txt",
>> > and win8.1 windows explorer renamed it to "._newfile.txt".
>> > In fruit_rename(),
>> > 1. The 1st SMB_VFS_NEXT_RENAME() do rename:
>> >    ./newfile.txt -> ./_.newfile.txt
>> > 2. Then this patch check and found that the source appbledouble
>> >    basename (._newfile.txt) matched the destination basename
>> >    (._newfile.txt), would goto done.
>> >    Hence the 2nd SMB_VFS_NEXT_RENAME() is not called.
>> >
>> > Here is the smb.conf
>> > [global]
>> > fruit:nfs_aces = no
>> > fruit:veto_appledouble = no
>> > vfs objects =  shadow_copy2 catia fruit streams_depot aio_pthread
>>
>> fwiw, unless you need Netatalk compatibility, as you're using
>> streams_depot for
>> the streams and not streams_xattr, you could enable
>> fruit:resource=stream. That
>> would also fix the rename issue.
>>
>> Cheerio!
>> -slow
>>
>
>


More information about the samba-technical mailing list