meganz / sdk

MEGA C++ SDK
BSD 2-Clause "Simplified" License
1.33k stars 504 forks source link

WIP: SDK-1400. Endless loop checking path while syncing on HFS (hotfix to v.3.8.2) #2567

Closed sergiohs84 closed 3 years ago

sergiohs84 commented 3 years ago

In HFS+ in MacOS, when a new file is added to a synced folder, fsevents notifies it and the FileAccess::fopen() cannot read it (yet) until it's fully written to disk (see usage of kMagicBusyCreationDate). Since it's taken as a transient error, a notification is added to the notifyq[RETRY]. However, since the LocalNode doesn't exist, the filename to notify should not include the absolute path to the sync, but only the leaf name. Otherwise, when the notification is processed later in checkpath(), it will build a new name repeating the root of the sync. Ie. if you have the synced folder A and a new file myfile.bin is copied into that folder, the notification from fsevents is n=myfile.bin (and l=<localnode_of_A_folder>). When the notification to retry is queued, it should be myfile.bin. If we use the localpathNew, which is A/myfile.bin, then the next processing of the notification will result on A//myfile.bin, and next one will be A/A/myfile.bin.

JenkinsMega commented 3 years ago

megasdk-crossAndroid-PRs SUCCEDED (1613) :+1:

JenkinsMega commented 3 years ago

megasdk_PR SUCCEDED (3956) :+1:

JenkinsMega commented 3 years ago

megasdk-winx64-PRs SUCCEDED (1439) :+1: