RESOLVED FIXED 234404
WebsiteDataStore::excludeDirectoryFromBackup should set attribute for existing directories
https://bugs.webkit.org/show_bug.cgi?id=234404
Summary WebsiteDataStore::excludeDirectoryFromBackup should set attribute for existin...
Sihui Liu
Reported 2021-12-16 13:48:34 PST
...
Attachments
Patch (2.21 KB, patch)
2021-12-16 13:54 PST, Sihui Liu
ews-feeder: commit-queue-
Patch (2.21 KB, patch)
2021-12-16 13:59 PST, Sihui Liu
no flags
Patch (4.56 KB, patch)
2021-12-17 10:20 PST, Sihui Liu
no flags
Patch (4.69 KB, patch)
2021-12-20 12:35 PST, Sihui Liu
no flags
Patch (11.59 KB, patch)
2021-12-22 12:13 PST, Sihui Liu
no flags
Sihui Liu
Comment 1 2021-12-16 13:54:12 PST
Sihui Liu
Comment 2 2021-12-16 13:59:42 PST
Geoffrey Garen
Comment 3 2021-12-16 15:31:43 PST
What's the use case where the directory already exists but is not excluded? Can we add a test for that case?
Sihui Liu
Comment 4 2021-12-16 16:11:27 PST
(In reply to Geoffrey Garen from comment #3) > What's the use case where the directory already exists but is not excluded? > Can we add a test for that case? We currently create storage directories when we decide the location, for example see WebsiteDataStore::defaultLocalStorageDirectory() and WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation in WebsiteDataStoreCocoa.mm. That means when we call excludeDirectoryFromBackup, the directory should already exist (WebsiteDataStore parameters should be decided before that). I can try creating an API test.
Sihui Liu
Comment 5 2021-12-17 10:20:32 PST
Sihui Liu
Comment 6 2021-12-20 12:35:37 PST
youenn fablet
Comment 7 2021-12-21 01:43:45 PST
Comment on attachment 447618 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=447618&action=review > Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:649 > + if (![url setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil]) It would be good to log error. Maybe write something like [url setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:error]; RELEASE_LOG_ERROR_IF(error, Storage, ... +log error). > Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm:463 > + [[NSFileManager defaultManager] removeItemAtPath:url.absoluteString error:nil]; Should we create the directory without the key to make sure the new code path makes it working?
Sihui Liu
Comment 8 2021-12-21 11:00:53 PST
Comment on attachment 447618 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=447618&action=review >> Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:649 >> + if (![url setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil]) > > It would be good to log error. > Maybe write something like > [url setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:error]; > RELEASE_LOG_ERROR_IF(error, Storage, ... +log error). Sure, will add. >> Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm:463 >> + [[NSFileManager defaultManager] removeItemAtPath:url.absoluteString error:nil]; > > Should we create the directory without the key to make sure the new code path makes it working? Sure. Will add the test.
Sihui Liu
Comment 9 2021-12-22 12:13:34 PST
EWS
Comment 10 2021-12-22 15:56:25 PST
Committed r287377 (245517@main): <https://commits.webkit.org/245517@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 447825 [details].
Radar WebKit Bug Importer
Comment 11 2021-12-22 15:57:19 PST
Note You need to log in before you can comment on or make changes to this bug.