Bug 201733 - block-spammers should obtain credentials the same way as webkit-patch
Summary: block-spammers should obtain credentials the same way as webkit-patch
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-09-12 12:54 PDT by David Kilzer (:ddkilzer)
Modified: 2019-09-15 07:16 PDT (History)
7 users (show)

See Also:


Attachments
Patch v1 (2.17 KB, patch)
2019-09-12 12:57 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v2 (2.17 KB, patch)
2019-09-12 13:00 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v3 (5.32 KB, patch)
2019-09-12 21:21 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v4 (5.37 KB, patch)
2019-09-12 21:24 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2019-09-12 12:54:26 PDT
The block-spammers script should obtain credentials the same way as webkit-patch.
Comment 1 David Kilzer (:ddkilzer) 2019-09-12 12:57:50 PDT
Created attachment 378669 [details]
Patch v1
Comment 2 Alexey Proskuryakov 2019-09-12 13:00:36 PDT
Comment on attachment 378669 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=378669&action=review

> Tools/Scripts/block-spammers:34
> +from webkitpy.common.net.credentials import Credentials

Does this work when you don't have autoimported modules in place yet?
Comment 3 David Kilzer (:ddkilzer) 2019-09-12 13:00:51 PDT
Created attachment 378670 [details]
Patch v2
Comment 4 David Kilzer (:ddkilzer) 2019-09-12 13:01:43 PDT
(In reply to David Kilzer (:ddkilzer) from comment #3)
> Created attachment 378670 [details]
> Patch v2

Changed double quotes to single quotes in one place.
Comment 5 David Kilzer (:ddkilzer) 2019-09-12 13:05:48 PDT
(In reply to Alexey Proskuryakov from comment #2)
> Comment on attachment 378669 [details]
> Patch v1
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=378669&action=review
> 
> > Tools/Scripts/block-spammers:34
> > +from webkitpy.common.net.credentials import Credentials
> 
> Does this work when you don't have autoimported modules in place yet?

No clue what that is, why I'd want it, or how to test it.

If you're set up that way, could you take two minutes to apply the patch and test it?

Since this uses the exact same code path as webkit-patch, I presume that tool would also be broken if that configuration isn't supported.
Comment 6 Alexey Proskuryakov 2019-09-12 13:16:31 PDT
What happens if you "rm -rf Tools/Scripts/webkitpy/thirdparty/autoinstalled", and run this script? Webkitpy has installed those modules for you the first time you used it.

The code path in webkitpy is not exactly the same, and autoimport setup is subtle.
Comment 7 Alexey Proskuryakov 2019-09-12 13:17:28 PDT
(what should happen is that everything works anyway, and that the keyring module re-appears in autoinstalled)
Comment 8 David Kilzer (:ddkilzer) 2019-09-12 13:29:08 PDT
(In reply to Alexey Proskuryakov from comment #6)
> What happens if you "rm -rf
> Tools/Scripts/webkitpy/thirdparty/autoinstalled", and run this script?
> Webkitpy has installed those modules for you the first time you used it.
> 
> The code path in webkitpy is not exactly the same, and autoimport setup is
> subtle.

(In reply to Alexey Proskuryakov from comment #7)
> (what should happen is that everything works anyway, and that the keyring
> module re-appears in autoinstalled)

$ mv Tools/Scripts/webkitpy/thirdparty/autoinstalled Tools/Scripts/webkitpy/thirdparty/autoinstalled.BAK
$ ./Tools/Scripts/block-spammers millay.moede@gmail.com
No handlers could be found for logger "webkitpy.common.net.credentials"
Fetching account activity...
[...]

Seems to work in the case where the credentials are already in the keychain.
Comment 9 Alexey Proskuryakov 2019-09-12 15:04:12 PDT
> No handlers could be found for logger "webkitpy.common.net.credentials"

This looks like a regression from this patch that this line is logged.
Comment 10 Alexey Proskuryakov 2019-09-12 17:36:15 PDT
Not trying to be difficult, but I think that the new console spew needs to be fixed before landing.
Comment 11 David Kilzer (:ddkilzer) 2019-09-12 21:20:16 PDT
(In reply to Alexey Proskuryakov from comment #10)
> Not trying to be difficult, but I think that the new console spew needs to
> be fixed before landing.

No worries. I had to leave work early, then I had figure out how to fix the logging warning, then I decided to refactor a bit of credentials.py.
Comment 12 David Kilzer (:ddkilzer) 2019-09-12 21:21:15 PDT
Created attachment 378710 [details]
Patch v3
Comment 13 David Kilzer (:ddkilzer) 2019-09-12 21:24:03 PDT
Created attachment 378712 [details]
Patch v4
Comment 14 David Kilzer (:ddkilzer) 2019-09-12 21:25:25 PDT
(In reply to David Kilzer (:ddkilzer) from comment #12)
> Created attachment 378710 [details]
> Patch v3

This fixed the new warning and refactored credentials.py.

(In reply to David Kilzer (:ddkilzer) from comment #13)
> Created attachment 378712 [details]
> Patch v4

This changed the logging level to info, which matches webkit-patch, so now they behave the same way (including the same console output) when reading credentials from the keychain.
Comment 15 WebKit Commit Bot 2019-09-15 07:15:05 PDT
Comment on attachment 378712 [details]
Patch v4

Clearing flags on attachment: 378712

Committed r249884: <https://trac.webkit.org/changeset/249884>
Comment 16 WebKit Commit Bot 2019-09-15 07:15:06 PDT
All reviewed patches have been landed.  Closing bug.
Comment 17 Radar WebKit Bug Importer 2019-09-15 07:16:17 PDT
<rdar://problem/55378246>