This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add mark_spam.py script
On 08/12/2016 06:10 PM, Joseph Myers wrote:
> On Wed, 10 Aug 2016, Martin Liška wrote:
>
>> On 08/10/2016 10:49 PM, Joseph Myers wrote:
>>> The latest spam bugs have spam attachments as well. I'm not sure if the
>>> API can delete attachments, but it would be helpful for the script to do
>>> as much as possible with them (change filenames, descriptions, MIME types,
>>> mark them as obsolete).
>>>
>>
>> I'm testing this, if it's working I'll install the patch.
>
> Thanks, this script is very useful, some more observations on spam bugs:
That's good, but I would appreciate to have a more precise spam filter ;)
>
> Attachment filenames can be spammish (e.g. see bug 74852), is it possible
> to change those to "spam" as well?
>
> Although most spam attachments seem to be application/pdf, some are image
> types and get displayed inline, so changing the MIME type to
> application/x-spam would be an improvement in those cases.
>
> A few spam bugs have URL set to a spam link, so emptying URL in all cases
> when marking as spam would make sense.
>
Implemented in the attached patch, I'll commit it after weekend if there
are not comments.
Martin
diff --git a/contrib/mark_spam.py b/contrib/mark_spam.py
index 569a03d..960ba51 100755
--- a/contrib/mark_spam.py
+++ b/contrib/mark_spam.py
@@ -49,6 +49,7 @@ def mark_as_spam(id, api_key, verbose):
'cc': {'remove': cc_list},
'priority': 'P5',
'severity': 'trivial',
+ 'url': '',
'assigned_to': 'unassigned@gcc.gnu.org' }
r = requests.put(u, json = data)
@@ -74,7 +75,12 @@ def mark_as_spam(id, api_key, verbose):
for a in attachments:
attachment_id = a['id']
url = '%sbug/attachment/%d' % (base_url, attachment_id)
- r = requests.put(url, json = {'ids': [attachment_id], 'summary': 'spam', 'comment': 'spam', 'is_obsolete': True, 'api_key': api_key})
+ r = requests.put(url, json = {'ids': [attachment_id],
+ 'summary': 'spam',
+ 'file_name': 'spam',
+ 'content_type': 'application/x-spam',
+ 'is_obsolete': True,
+ 'api_key': api_key})
if verbose:
print(r)
print(r.text)