RESOLVED FIXED 183051
[Curl] Cookie Database files are wrongfully getting deleted when the database is opened
https://bugs.webkit.org/show_bug.cgi?id=183051
Summary [Curl] Cookie Database files are wrongfully getting deleted when the database...
Christopher Reid
Reported 2018-02-22 12:12:25 PST
The file stat logic in CookieJarDB::checkDatabaseCorruptionAndRemoveIfNeeded is backwards causing persistence issues. The database is wrongfully deleted when opened because it thinks it's corrupted.
Attachments
Patch (1.86 KB, patch)
2018-02-22 12:19 PST, Christopher Reid
no flags
Patch (1.84 KB, patch)
2018-02-23 14:25 PST, Christopher Reid
no flags
Patch for landing (2.02 KB, patch)
2018-02-23 16:03 PST, Christopher Reid
no flags
Christopher Reid
Comment 1 2018-02-22 12:19:40 PST
Don Olmstead
Comment 2 2018-02-23 12:51:10 PST
Comment on attachment 334465 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=334465&action=review LGTM. I'm not sure how liberally we should be using auto or not. > Source/WebCore/platform/network/curl/CookieJarDB.cpp:166 > + FileSystem::PlatformFileHandle handle = FileSystem::openFile(getCorruptionMarkerPath(), FileSystem::FileOpenMode::Write); Maybe auto here?
Christopher Reid
Comment 3 2018-02-23 14:01:36 PST
(In reply to Don Olmstead from comment #2) > Comment on attachment 334465 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=334465&action=review > > LGTM. I'm not sure how liberally we should be using auto or not. > > > Source/WebCore/platform/network/curl/CookieJarDB.cpp:166 > > + FileSystem::PlatformFileHandle handle = FileSystem::openFile(getCorruptionMarkerPath(), FileSystem::FileOpenMode::Write); > > Maybe auto here? It looks like auto is used quite a bit with openFile in the FileSystem implementation files so it makes sense to use it here too. I'll update the patch.
Christopher Reid
Comment 4 2018-02-23 14:25:28 PST
Per Arne Vollan
Comment 5 2018-02-23 15:15:10 PST
Comment on attachment 334547 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=334547&action=review R=me. > Source/WebCore/platform/network/curl/CookieJarDB.cpp:167 > + FileSystem::closeFile(handle); Should we check whether 'handle' is valid before closing?
Christopher Reid
Comment 6 2018-02-23 15:55:02 PST
Thanks for the review! (In reply to Per Arne Vollan from comment #5) > Comment on attachment 334547 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=334547&action=review > > R=me. > > > Source/WebCore/platform/network/curl/CookieJarDB.cpp:167 > > + FileSystem::closeFile(handle); > > Should we check whether 'handle' is valid before closing? Ah, right now all the closeFile implementations have a check but it seems safer to have a check here too in case more functionality is added to that file.
Christopher Reid
Comment 7 2018-02-23 16:03:52 PST
Created attachment 334550 [details] Patch for landing
WebKit Commit Bot
Comment 8 2018-02-23 18:01:41 PST
Comment on attachment 334550 [details] Patch for landing Clearing flags on attachment: 334550 Committed r228971: <https://trac.webkit.org/changeset/228971>
WebKit Commit Bot
Comment 9 2018-02-23 18:01:42 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 10 2018-02-23 18:02:59 PST
Note You need to log in before you can comment on or make changes to this bug.