Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Ping-Bug?

From: Evan Huus <eapache@xxxxxxxxx>
Date: Fri, 1 Aug 2014 19:06:52 -0400
On Fri, Aug 1, 2014 at 7:03 PM, Gerald Combs <gerald@xxxxxxxxxxxxx> wrote:
On 8/1/14 3:58 PM, Evan Huus wrote:
> On Fri, Aug 1, 2014 at 6:52 PM, Gerald Combs <gerald@xxxxxxxxxxxxx
> <mailto:gerald@xxxxxxxxxxxxx>> wrote:
>
>     On 8/1/14 9:08 AM, Jeff Morriss wrote:
>     > On 07/13/14 14:05, Alexis La Goutte wrote:
>     >> On Fri, Jul 11, 2014 at 10:06 PM, Evan Huus <eapache@xxxxxxxxx
>     <mailto:eapache@xxxxxxxxx>> wrote:
>     >>> On Fri, Jul 11, 2014 at 4:03 PM, Gerald Combs
>     <gerald@xxxxxxxxxxxxx <mailto:gerald@xxxxxxxxxxxxx>>
>     >>> wrote:
>     >>>>
>     >>>> On 7/7/14 9:10 PM, Evan Huus wrote:
>     >>>>> On Sun, Jul 6, 2014 at 12:59 PM, Alexis La Goutte
>     >>>>> <alexis.lagoutte@xxxxxxxxx <mailto:alexis.lagoutte@xxxxxxxxx>
>     <mailto:alexis.lagoutte@xxxxxxxxx
>     <mailto:alexis.lagoutte@xxxxxxxxx>>> wrote:
>     >>>>>
>     >>>>>      On Sat, Jul 5, 2014 at 11:49 PM, Evan Huus
>     <eapache@xxxxxxxxx <mailto:eapache@xxxxxxxxx>
>     >>>>
>     >>>>
>     >>>>>      > It would be nice to have different tags for Refs-Bug and
>     >>>>>      Fixes-Bug, and have
>     >>>>>      > the bugzilla integration do The Right Thing for changes
>     that
>     >>>>> refer
>     >>>>>      to but do
>     >>>>>      > not fix a bug. Gerald, how easy is this? I believe
>     OpenStack
>     >>>>> has a
>     >>>>>      set of
>     >>>>>      > tags they use which we might look to for inspiration?
>     >>>>>      +1
>     >>>>>      I like OpenStack tags :
>     >>>>>
>     >>>>>      Closes-Bug: #1234567 -- use 'Closes-Bug' if the commit is
>     >>>>> intended
>     >>>>> to
>     >>>>>      fully fix and close the bug being referenced.
>     >>>>>      Partial-Bug: #1234567 -- use 'Partial-Bug' if the commit is
>     >>>>> only a
>     >>>>>      partial fix and more work is needed.
>     >>>>>      Related-Bug: #1234567 -- use 'Related-Bug' if the commit is
>     >>>>> merely
>     >>>>>      related to the referenced bug.
>     >>>>>
>     >>>>>
>     >>>>>
>     >>>>>
>     https://wiki.openstack.org/wiki/GitCommitMessages#Including_external_references
>     >>>>>
>     >>>>
>     >>>> How would Partial-Bug and Related-Bug differ for our purposes?
>     Wouldn't
>     >>>> they do the same thing (i.e. add a comment to the bug)? Could
>     we get
>     >>>> away with two tags:
>     >>>>
>     >>>> Ping-Bug: 12345 -- Add a comment to bug 12345
>     >>>> Bug (or Closes-Bug): 12345 -- Add a comment and mark it
>     RESOLVED FIXED.
>     >>>
>     >>>
>     >>> Just "Ping-Bug" and "Bug" works for me.
>     >> +1
>     >> (or Comment-Bug and Closes-Bug ?)
>     >
>     > So what are the current set of tags for this?  I tried using Ping-Bug
>     > (on change 3314) and it ended up closing the bug on me...
>
>     Until a few minutes ago any time "bug" followed by a number appeared in
>     the commit message Gerrit would add a comment and close it. The specific
>     _javascript_ RE was "\b[Bb]ug:?\s*#?(\d+)\b".
>
>     As of now Gerrit should update Bugzilla only for the following footers.
>     The RE is now "\b(?:[Pp]ing-)?[Bb]ug:?\s*#?(\d+)\b":
>
>     Ping-Bug: 12345 -- Only add a comment.
>     Bug: 12345 -- Add a comment to the bug and close it.
>
>
> Awesome, thanks!
>
> Just wondering, in hindsight, if we should reverse it so "Closes-Bug"
> closes and "Bug" just posts a comment. Otherwise I I'm sure somebody
> will do "blah blah blah like in bug ####" in a commit message and
> accidentally close that bug.

The current actions should be limited to footers, so we should be safe
from "bug ####" elsewhere in the commit message.

The current RE are bounded by \b which is just a word boundary. Is it safe because the RE are only run against the footers in the first place (Gerrit does that for us?) or did you mean to bound them with ^ and $ (which might be safer anyways).