help-gnats
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: closing spam bugs


From: Chad Walstrom
Subject: Re: closing spam bugs
Date: Wed, 26 Apr 2006 16:51:43 -0500

Ralf wrote:
> Hello help-gnats readers,
> 
> I'm relatively green as gnats user with write access, so bear with
> me.
> 
> I failed to find a way to close bug reports that are spam, without
> needlessly sending a notification message to the fake originator.
> Did I overlook anything here?  If not, then you may view this as a
> feature request.  :-)
> 
> This is (not my) Gnatsweb v2.9.3, Gnats v3.113.1, by the way.

Ah-ha!  Yeah, we had this problem, too.  You have one of two options.

1) Change dbconfig to not send email to the submitter on changes.
2) Edit the PR first, changing the "From " and Originator fields, then
   close.

For some reason, gnatsweb didn't allow me to change the "From " and
"From:" fields easily, so I do it with 'query-pr ...|sed ... |pr-edit
...".

Disclaimer, this doesn't handle server error conditions well, such as
when the database is locked.  I sometimes have to
``/usr/lib/gnats/pr-edit -U'' before continuing.

#!/bin/sh
#
# spam-pr -- categorize and close PR's as spam
#
# Copyright (C) 2004 Chad Walstrom <address@hidden>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA  02111-1307  USA 
#
###############################################################################
PATH=/usr/lib/gnats:$PATH
export PATH

DEBUG=${DEBUG:-0}
MYEMAIL=${MYEMAIL:-"address@hidden"}
address@hidden

# Output messages to stderr
function log() {
        level=$1
        case ${level} in
                debug) [ $DEBUG -ne 1 ] && return ;;
        esac
        shift
        echo ${level}: $@ 1>&2
}

# Output usage to stderr
function usage() {
        cat << EOUSAGE 1>&2
Usage: spam-pr [-v] PR [PR..]

Categorize and close problem reports as spam.  Use '-v' for verbose output.
EOUSAGE
        exit 1
}

# Commandline stuff
while getopts v opt
do
        case $opt in
                v) DEBUG=1; shift;;
                *) usage;;
        esac
done

# If no further arguments, usage and exit exit
[ $# -eq 0 ] && {
        usage
}

PRS=$@
for PR in $PRS 
do
        log debug "Locking PR#${PR}"
        pr-edit --lock=${MYEMAIL} ${PR} >/dev/null

        log debug "Editing PR#${PR}"
        query-pr --full ${PR} | sed -e 's/^\(>Category:\).*$/\1       spam/g' | 
\
                formail -i "From: $NULLADDR" -i "Return-Path: $NULLADDR" | \
                pr-edit ${PR} >/dev/null

        log debug "Unlocking PR#${PR}"
        pr-edit --unlock ${PR} >/dev/null

        log debug "Closing PR#${PR}"
        echo "closed" | pr-edit --replace="State" --reason="Spam" ${PR} 
>/dev/null

        log debug "PR#${PR} closed as spam"
done

log debug "Done"
-- 
Chad Walstrom <address@hidden>           http://www.wookimus.net/
           assert(expired(knowledge)); /* core dump */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]