public inbox for gnats-devel@sourceware.org
 help / color / mirror / Atom feed
From: Milan Zamazal <pdm@zamazal.org>
To: "Dirk Bergstrom" <dirk@juniper.net>
Cc: "Michael Richardson" <mcr@sandelman.ottawa.on.ca>, <help-gnats@gnu.org>
Subject: Re: Subject line processing in Gnats 4.0
Date: Fri, 02 Nov 2001 05:50:00 -0000	[thread overview]
Message-ID: <87pu5kjdy5.fsf@blackbird.zamazal.org> (raw)
In-Reply-To: <C53744A44FBC9B4BAE90EB41D2C09AC205223F@proton.jnpr.net>

[-- Attachment #1: Type: text/plain, Size: 2036 bytes --]

>>>>> "DB" == Dirk Bergstrom <dirk@juniper.net> writes:

    DB> solution: it's not clear to me why the regex is so restrictive.
    DB> i think it would make more sense for gnats to assume that any
    DB> message with a parseable PR identifier (<category>/<pr_num>) in
    DB> the subject should be appended to that PR.  that would allow for
    DB> all the real-world messages to be processed in a manner that
    DB> would not surprise the sender.

I agree, with an additional restriction described below.

    DB> furthermore, i think it should also accept "PR<pr_num>", if it is the 
    DB> first reasonable text in the subject, a regex along the lines of "^[ 
    DB> \t]*((re|fw):)?[ \t]*pr([0-9]+)".  i often see bogus PRs with this 
    DB> synopsis, which were clearly intended to be part of <pr_num>, not 
    DB> separate PRs.

I don't like this one.  I can imagine the following subject:

  PR 1234 at foo.org provides the fix for the PR 567

Generally, I think it's better to create a new PR than to have an answer
in a wrong place.

>>>>> "PT" == Paul Traina <pst@juniper.net> writes:

    PT> Negative Dirk, I had it behave that way before, and it sucked.
    PT> Every time someone sent in anything like "OS/2" it would append
    PT> it to PR #2.

I don't think it's an unsolvable problem.  The \<CATEGORY/NUMBER
expression should be accepted only if CATEGORY matches an existing
category (case-insensitive match) and NUMBER matches a PR in that
category.  Then the unlucky administrator, who created the `os'
category, could simply remove/renumber its PR #2 and the problem is
gone.

    PT> Instead, I wrote a script called refile_pr (I think it may still
    PT> be in my home directory or under bin/... that solved this
    PT> problem).  If it's gone, I can tell you how to recreate it.
    PT> WIth gnats 4.0, it's trivial, about 5 lines of real code.

The script is waiting in my long and old queue of GNATS mails for future
processing. :-(  Here it is (it was sent by Paul to this mail list some
time ago):


[-- Attachment #2: refile-pr --]
[-- Type: application/octet-stream, Size: 3271 bytes --]

#!/bin/sh
# Program to submit problem reports for GNATS.
# Copyright (C) 1999 Free Software Foundation, Inc.
# Contributed by Bob Manson (manson@juniper.net).
#
# This file is part of GNU GNATS.
#
# GNU GNATS 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, or (at your option)
# any later version.
#
# GNU GNATS 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 GNU GNATS; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

debug_print=false # or echo to get output.

LIBEXECDIR=/usr/local/libexec
BINDIR=/usr/local/bin
EDIT_USER=
EDIT_PASSWD=
version=4.0-alpha

usage="
Usage:  refile-pr [-V|--version] [-h|--help] [-d|--database database_name]
                  [-H|--host hostname] [-P|--port port_number]
                  [-v|--user userid]   [-w|--passwd password]
                  -o|--original pr-to-attach-to <pr> [<pr> ...]
"

# Parse command line.  We don't really need to do this, but that's ok.

while [ $# -gt 0 ]; do
   case "$1" in
     -V|--version|--ve*)
       echo "$version"; exit 0
       ;;

     -d | --database)
       if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
       shift ; GNATS_DB="--database=$1" ;;
     -d=* | --database=*) GNATS_DB="$1" ;;

     -H | --host)
       if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
       shift ; GNATS_HOST="--host=$1" ;;
     -H=* | --host=*) GNATS_HOST="$1" ;;

     -P | --port)
       if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
       shift ; GNATS_PORT="--port=$1" ;;
     -P=* | --port=*) GNATS_PORT="$1" ;;

     -v | --user)
       if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
       shift ; EDIT_USER="--user=$1" ;;
     -v=* | --user=*) EDIT_USER="$1" ;;

     -w | --passwd)
       if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
       shift ; EDIT_PASSWD="--passwd=$1" ;;
     -w=* | --passwd=*) EDIT_PASSWD="$1" ;;

     -o|--original*)
       if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
       shift ; ORIGINAL="$1" ;;

     -h|--help*)
       echo "$usage"; exit 0
       ;;

     -*)
       echo "$usage"; exit 1
       ;;

     *)
       break
       ;;
   esac
   shift
done

if [ $# = 0 ] ; then
   echo "$0: missing PR's to refile under original PR" 1>&2
   exit 1
fi

# set command here to always pass host and port, and directory if supplied
PR_EDIT="$LIBEXECDIR/gnats/pr-edit ${GNATS_HOST} ${GNATS_PORT} ${EDIT_USER} ${EDIT_PASSWD} ${GNATS_DB}"
QUERY_PR="$BINDIR/query-pr ${GNATS_HOST} ${GNATS_PORT} ${EDIT_USER} ${EDIT_PASSWD} ${GNATS_DB}"

QUERY_FMT='"Date: %s\nFrom: %s\nSubject: %s\n\n%s" Date: From: Subject: Description'

if [ "$ORIGINAL" = "" ]; then
    echo "$0: original PR to refile under required" 1>&2
    exit 1
fi

# Get data from bogus PRs

$QUERY_PR --format "$QUERY_FMT" "$@" | \
	$PR_EDIT --append audit-trail $ORIGINAL && \
	for pr in "$@" ; do
	    $PR_EDIT --user gnats --delete $pr
	done


[-- Attachment #3: Type: text/plain, Size: 477 bytes --]


Could someone port/test it with GNATS 4, please?  I could include it
into the distribution then.

>>>>> "MR" == Michael Richardson <mcr@sandelman.ottawa.on.ca> writes:

    MR> Simple suggestion - make the PR#s have leading zeros. 

That would be ugly, let's try nicer solutions first. :-)

Regards,

Milan Zamazal

-- 
When you're in a fight with an idiot, it's difficult for other people to tell
which one the idiot is.                       -- Bruce Perens in debian-devel

WARNING: multiple messages have this Message-ID
From: Milan Zamazal <pdm@zamazal.org>
To: "Dirk Bergstrom" <dirk@juniper.net>
Cc: "Michael Richardson" <mcr@sandelman.ottawa.on.ca>, <help-gnats@gnu.org>
Subject: Re: Subject line processing in Gnats 4.0
Date: Wed, 12 Dec 2001 15:06:00 -0000	[thread overview]
Message-ID: <87pu5kjdy5.fsf@blackbird.zamazal.org> (raw)
Message-ID: <20011212150600.4d2W_CRuRKNFU0evCCLpJEq97Y9aWBzP8xbV7sxxN6g@z> (raw)
In-Reply-To: <C53744A44FBC9B4BAE90EB41D2C09AC205223F@proton.jnpr.net>

[-- Attachment #1: Type: text/plain, Size: 2036 bytes --]

>>>>> "DB" == Dirk Bergstrom <dirk@juniper.net> writes:

    DB> solution: it's not clear to me why the regex is so restrictive.
    DB> i think it would make more sense for gnats to assume that any
    DB> message with a parseable PR identifier (<category>/<pr_num>) in
    DB> the subject should be appended to that PR.  that would allow for
    DB> all the real-world messages to be processed in a manner that
    DB> would not surprise the sender.

I agree, with an additional restriction described below.

    DB> furthermore, i think it should also accept "PR<pr_num>", if it is the 
    DB> first reasonable text in the subject, a regex along the lines of "^[ 
    DB> \t]*((re|fw):)?[ \t]*pr([0-9]+)".  i often see bogus PRs with this 
    DB> synopsis, which were clearly intended to be part of <pr_num>, not 
    DB> separate PRs.

I don't like this one.  I can imagine the following subject:

  PR 1234 at foo.org provides the fix for the PR 567

Generally, I think it's better to create a new PR than to have an answer
in a wrong place.

>>>>> "PT" == Paul Traina <pst@juniper.net> writes:

    PT> Negative Dirk, I had it behave that way before, and it sucked.
    PT> Every time someone sent in anything like "OS/2" it would append
    PT> it to PR #2.

I don't think it's an unsolvable problem.  The \<CATEGORY/NUMBER
expression should be accepted only if CATEGORY matches an existing
category (case-insensitive match) and NUMBER matches a PR in that
category.  Then the unlucky administrator, who created the `os'
category, could simply remove/renumber its PR #2 and the problem is
gone.

    PT> Instead, I wrote a script called refile_pr (I think it may still
    PT> be in my home directory or under bin/... that solved this
    PT> problem).  If it's gone, I can tell you how to recreate it.
    PT> WIth gnats 4.0, it's trivial, about 5 lines of real code.

The script is waiting in my long and old queue of GNATS mails for future
processing. :-(  Here it is (it was sent by Paul to this mail list some
time ago):


[-- Attachment #2: refile-pr --]
[-- Type: text/x-shellscript, Size: 3271 bytes --]

#!/bin/sh
# Program to submit problem reports for GNATS.
# Copyright (C) 1999 Free Software Foundation, Inc.
# Contributed by Bob Manson (manson@juniper.net).
#
# This file is part of GNU GNATS.
#
# GNU GNATS 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, or (at your option)
# any later version.
#
# GNU GNATS 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 GNU GNATS; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

debug_print=false # or echo to get output.

LIBEXECDIR=/usr/local/libexec
BINDIR=/usr/local/bin
EDIT_USER=
EDIT_PASSWD=
version=4.0-alpha

usage="
Usage:  refile-pr [-V|--version] [-h|--help] [-d|--database database_name]
                  [-H|--host hostname] [-P|--port port_number]
                  [-v|--user userid]   [-w|--passwd password]
                  -o|--original pr-to-attach-to <pr> [<pr> ...]
"

# Parse command line.  We don't really need to do this, but that's ok.

while [ $# -gt 0 ]; do
   case "$1" in
     -V|--version|--ve*)
       echo "$version"; exit 0
       ;;

     -d | --database)
       if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
       shift ; GNATS_DB="--database=$1" ;;
     -d=* | --database=*) GNATS_DB="$1" ;;

     -H | --host)
       if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
       shift ; GNATS_HOST="--host=$1" ;;
     -H=* | --host=*) GNATS_HOST="$1" ;;

     -P | --port)
       if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
       shift ; GNATS_PORT="--port=$1" ;;
     -P=* | --port=*) GNATS_PORT="$1" ;;

     -v | --user)
       if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
       shift ; EDIT_USER="--user=$1" ;;
     -v=* | --user=*) EDIT_USER="$1" ;;

     -w | --passwd)
       if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
       shift ; EDIT_PASSWD="--passwd=$1" ;;
     -w=* | --passwd=*) EDIT_PASSWD="$1" ;;

     -o|--original*)
       if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
       shift ; ORIGINAL="$1" ;;

     -h|--help*)
       echo "$usage"; exit 0
       ;;

     -*)
       echo "$usage"; exit 1
       ;;

     *)
       break
       ;;
   esac
   shift
done

if [ $# = 0 ] ; then
   echo "$0: missing PR's to refile under original PR" 1>&2
   exit 1
fi

# set command here to always pass host and port, and directory if supplied
PR_EDIT="$LIBEXECDIR/gnats/pr-edit ${GNATS_HOST} ${GNATS_PORT} ${EDIT_USER} ${EDIT_PASSWD} ${GNATS_DB}"
QUERY_PR="$BINDIR/query-pr ${GNATS_HOST} ${GNATS_PORT} ${EDIT_USER} ${EDIT_PASSWD} ${GNATS_DB}"

QUERY_FMT='"Date: %s\nFrom: %s\nSubject: %s\n\n%s" Date: From: Subject: Description'

if [ "$ORIGINAL" = "" ]; then
    echo "$0: original PR to refile under required" 1>&2
    exit 1
fi

# Get data from bogus PRs

$QUERY_PR --format "$QUERY_FMT" "$@" | \
	$PR_EDIT --append audit-trail $ORIGINAL && \
	for pr in "$@" ; do
	    $PR_EDIT --user gnats --delete $pr
	done


  parent reply	other threads:[~2001-12-12 23:06 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-01  7:16 Dirk Bergstrom
2001-11-01  7:18 ` Paul Traina
2001-11-01 14:36   ` Michael Richardson
2001-12-12 11:55     ` Michael Richardson
2001-12-11 21:45   ` Paul Traina
2001-11-01 14:36 ` Subject line processing in Gnats 4.0 , Michael Richardson
2001-12-12 11:54   ` Michael Richardson
2001-11-02  5:50 ` Milan Zamazal [this message]
2001-11-02  5:57   ` Subject line processing in Gnats 4.0 Michael Richardson
2001-12-12 15:43     ` Michael Richardson
2001-11-04  0:17   ` Yngve Svendsen
2001-12-13 12:30     ` Yngve Svendsen
2001-11-06  7:43   ` Chad C. Walstrom
2001-11-10  8:07     ` Milan Zamazal
2001-12-15  7:24       ` Milan Zamazal
2001-12-13 21:36     ` Chad C. Walstrom
2001-12-12 15:06   ` Milan Zamazal
2001-12-11 18:12 ` Dirk Bergstrom
  -- strict thread matches above, loose matches on Subject: below --
2001-11-06  5:58 Dirk Bergstrom
2001-11-09 14:17 ` Milan Zamazal
2001-11-19  0:36   ` Milan Zamazal
2001-12-23 12:36     ` Milan Zamazal
2001-12-15  7:24   ` Milan Zamazal
2001-12-13 15:09 ` Dirk Bergstrom
2001-11-02  5:49 Dirk Bergstrom
2001-11-03  1:41 ` Paul Traina
2001-12-13  9:50   ` Paul Traina
2001-11-06  5:19 ` Milan Zamazal
2001-12-13 14:39   ` Milan Zamazal
2001-12-12 14:20 ` Dirk Bergstrom
2001-11-01 15:18 Dirk Bergstrom
2001-12-12 13:03 ` Dirk Bergstrom
2001-10-28 13:34 Michael Richardson
2001-10-29 17:36 ` Milan Zamazal
2001-12-09  6:33   ` Milan Zamazal
2001-12-07 14:27 ` Michael Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pu5kjdy5.fsf@blackbird.zamazal.org \
    --to=pdm@zamazal.org \
    --cc=dirk@juniper.net \
    --cc=help-gnats@gnu.org \
    --cc=mcr@sandelman.ottawa.on.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).