]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1450405: Remove cf_crash_signature references (#77)
authorVladimir Panteleev <CyberShadow@users.noreply.github.com>
Sat, 13 Feb 2021 17:31:03 +0000 (17:31 +0000)
committerGitHub <noreply@github.com>
Sat, 13 Feb 2021 17:31:03 +0000 (12:31 -0500)
This is a Mozilla-specific field which has not been properly
encapsulated into the BMO extension, where most of its implementation
lies.

Remove the hard-coded references occurring outside the BMO extension.
This fixes an internal error ("Can't use cf_crash_signature as a field
name.").

Co-authored-by: Dylan Hardison <dylan@hardison.net>
Bugzilla/Bug.pm
Bugzilla/Elastic/Search.pm
Bugzilla/Search/Quicksearch.pm
extensions/BMO/web/styles/bug_modal.css
extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
js/create_bug.js
scripts/remove-non-public-data.pl
scripts/update-crash-signatures.pl [deleted file]
skins/standard/show_bug.css
template/en/default/bug/create/create.html.tmpl

index 77804bee08ea9fdc0804e20d52e07df76191f3d3..0ec61eab14c09f618e7cd8f521ece68e9742b77a 100644 (file)
@@ -412,9 +412,9 @@ sub ES_SELECT_UPDATED_SQL {
   my ($class, $mtime) = @_;
 
   my @fields = (
-    'keywords',           'short_desc', 'product',           'component',
-    'cf_crash_signature', 'alias',      'status_whiteboard', 'bug_status',
-    'resolution',         'priority',   'assigned_to',       'bug_type'
+    'keywords', 'short_desc',        'product',    'component',
+    'alias',    'status_whiteboard', 'bug_status', 'resolution',
+    'priority', 'assigned_to',       'bug_type'
   );
   my $fields = join(', ', ("?") x @fields);
 
index 449dc7437396fc0a11c38a772f490a7903d17440..c4b3109b53c81bd575160b1139741234cdaf717d 100644 (file)
@@ -37,7 +37,7 @@ my @SUPPORTED_FIELDS = qw(
   bug_id bug_type product component short_desc
   priority status_whiteboard bug_status resolution
   keywords alias assigned_to reporter delta_ts
-  longdesc cf_crash_signature classification bug_severity
+  longdesc classification bug_severity
   commenter
 );
 my %IS_SUPPORTED_FIELD = map { $_ => 1 } @SUPPORTED_FIELDS;
index 2d998d6b4ff8b357f569679d106e93245f9609fe..2fc50193a609d9a3e9602febced56a655b176908 100644 (file)
@@ -641,9 +641,6 @@ sub _default_quicksearch_word {
     if $longdesc_initial || $ELASTIC;
   addChart('content', 'matches', _matches_phrase($word), $negate)
     if $fulltext && !$ELASTIC;
-
-# BMO Bug 664124 - Include the crash signature (sig:) field in default quicksearches
-  addChart('cf_crash_signature', 'substring', $word, $negate);
 }
 
 sub _handle_urls {
index 6f481d889148fae9dd54d206231c1d948b4c1080..def5bbc98144a9b8c09adebd2b13730b27c0213c 100644 (file)
@@ -5,12 +5,6 @@
  * This Source Code Form is "Incompatible With Secondary Licenses", as
  * defined by the Mozilla Public License, v. 2.0. */
 
-#cf_crash_signature {
-  width: 100%;
-  height: 6em;
-  font-size: var(--font-size-medium);
-}
-
 #legal_disclaimer {
   margin: 16px 0;
   border: 1px solid var(--warning-message-border-color);
index de0ccb1f603e481014fbe1dd59cb469c70e12aaf..ef852de8af28e4da32a92d066fc64a838d839452 100644 (file)
   [%
     FOREACH field IN custom_fields;
       NEXT IF field.type != constants.FIELD_TYPE_TEXTAREA;
-      NEXT IF field.name == "cf_crash_signature"; # Rendered below
       Hook.process('custom_field-' _ field.name);
       NEXT IF rendered_custom_fields.exists(field.name);
       INCLUDE bug_modal/field.html.tmpl
   %]
 [% END %]
 
-[%# === Crash === %]
-
-[% WRAPPER bug_modal/module.html.tmpl
-  title = "Crash Data"
-  collapsed = 1
-  hide_on_view = bug.cf_crash_signature == ""
-%]
-  [% Hook.process('custom_field-cf_crash_signature'); %]
-[% END %]
-
 [%# === groups === %]
 
 [% WRAPPER bug_modal/module.html.tmpl
index 3716f2aefc64cf65f1de40b3c329a290905430ec..0e3daeab578da261ec8cbc96f2ff10ee1a7b7292 100644 (file)
@@ -54,9 +54,6 @@ YAHOO.util.Event.onDOMReady(function() {
   el = document.getElementById('comment');
   el.style.width = width;
 
-  el = document.getElementById('cf_crash_signature');
-  if (el) el.style.width = width;
-
   // show the bug flags if a flag is set
 
   var flag_set = false;
index de5b9270d413392fb7f0ff0d988d5342739fb2ba..d6d0ee93f2bd6190c0281437794b76041ea1a879 100755 (executable)
@@ -53,7 +53,7 @@ my %whitelist = (
       rep_platform reporter version component_id resolution
       target_milestone qa_contact status_whiteboard everconfirmed
       estimated_time remaining_time deadline alias cf_rank
-      cf_crash_signature cf_last_resolved cf_user_story votes
+      cf_last_resolved cf_user_story votes
       )
   ],
   bugs_activity => [
diff --git a/scripts/update-crash-signatures.pl b/scripts/update-crash-signatures.pl
deleted file mode 100755 (executable)
index e5b13d7..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-#!/usr/bin/env perl
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
-
-use strict;
-use warnings;
-use lib qw(. lib local/lib/perl5);
-$| = 1;
-
-
-use constant BATCH_SIZE => 100;
-
-use Bugzilla;
-use Bugzilla::Bug;
-use Bugzilla::Constants;
-use Bugzilla::Util qw( trim );
-use List::MoreUtils qw( any );
-use Text::Balanced qw( extract_bracketed extract_multiple );
-
-Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
-
-my $user = Bugzilla::User->check({name => 'automation@bmo.tld'});
-$user->{groups}       = [Bugzilla::Group->get_all];
-$user->{bless_groups} = [Bugzilla::Group->get_all];
-Bugzilla->set_user($user);
-
-my $dbh = Bugzilla->dbh;
-
-# find the bugs
-
-my $bugs = $dbh->selectall_arrayref(
-  "SELECT bug_id,cf_crash_signature FROM bugs WHERE resolution = '' AND cf_crash_signature != ''",
-  {Slice => {}}
-);
-my $count = scalar @$bugs;
-
-# update
-
-die "No bugs found\n" unless $count;
-print
-  "Found $count open bug(s) with crash signatures\nPress <Ctrl-C> to stop or <Enter> to continue..\n";
-getc();
-
-my $updated = 0;
-foreach my $rh_bug (@$bugs) {
-  my $bug_id    = $rh_bug->{bug_id};
-  my $signature = $rh_bug->{cf_crash_signature};
-
-  # check for updated signature
-  my $collapsed = collapse($signature);
-  next if is_same($signature, $collapsed);
-
- # ignore signatures malformed in a way that would result in updating on each pass
-  next if $collapsed ne collapse($collapsed);
-
-  # update the bug, preventing bugmail
-  print "$bug_id\n";
-  $dbh->bz_start_transaction;
-  my $bug = Bugzilla::Bug->check($bug_id);
-  $bug->set_all({cf_crash_signature => $collapsed});
-  $bug->update();
-  $dbh->do("UPDATE bugs SET lastdiffed = delta_ts WHERE bug_id = ?",
-    undef, $bug_id);
-  $dbh->bz_commit_transaction;
-
-  # object caching causes us to consume a lot of memory
-  # process in batches
-  last if ++$updated == BATCH_SIZE;
-}
-print "Updated $updated bugs(s)\n";
-
-sub is_same {
-  my ($old, $new) = @_;
-  $old =~ s/[\015\012]+/ /g;
-  $new =~ s/[\015\012]+/ /g;
-  return trim($old) eq trim($new);
-}
-
-sub collapse {
-  my ($crash_signature) = @_;
-
-  # ignore completely invalid signatures
-  return $crash_signature
-    unless $crash_signature =~ /\[/ && $crash_signature =~ /\]/;
-
-  # split
-  my @signatures = grep {/\S/}
-    extract_multiple($crash_signature, [sub { extract_bracketed($_[0], '[]') }]);
-  my @unbracketed = map { unbracketed($_) } @signatures;
-
-  foreach my $signature (@signatures) {
-
-    # ignore invalid signatures
-    next unless $signature =~ /^\s*\[/;
-    next if unbracketed($signature) =~ /\.\.\.$/;
-
-    # collpase
-    my $collapsed = collapse_crash_sig({
-      signature         => $signature,
-      open              => '<',
-      replacement_open  => '<',
-      close             => '>',
-      replacement_close => 'T>',
-      exceptions        => [],
-    });
-    $collapsed = collapse_crash_sig({
-      signature         => $collapsed,
-      open              => '(',
-      replacement_open  => '',
-      close             => ')',
-      replacement_close => '',
-      exceptions        => ['anonymous namespace', 'operator'],
-    });
-    $collapsed =~ s/\s+/ /g;
-
-    # ignore sigs that collapse down to nothing
-    next if $collapsed eq '[@ ]';
-
-    # don't create duplicates
-    my $unbracketed = unbracketed($collapsed);
-    next if any { $unbracketed eq $_ } @unbracketed;
-
-    push @signatures,  $collapsed;
-    push @unbracketed, $unbracketed;
-  }
-
-  return join("\015\012", map { trim($_) } @signatures);
-}
-
-sub unbracketed {
-  my ($signature) = @_;
-  $signature =~ s/(^\s*\[\s*|\s*\]\s*$)//g;
-  return $signature;
-}
-
-# collapsing code lifted from socorro:
-# https://github.com/mozilla/socorro/blob/master/socorro/processor/signature_utilities.py#L110
-
-my ($target_counter, $exception_mode, @collapsed);
-
-sub append_if_not_in_collapse_mode {
-  my ($character) = @_;
-  if (!$target_counter) {
-    push @collapsed, $character;
-  }
-}
-
-sub is_exception {
-  my ($exceptions, $remaining_original_line, $line_up_to_current_position) = @_;
-  foreach my $exception (@$exceptions) {
-    if (substr($remaining_original_line, 0, length($exception)) eq $exception) {
-      return 1;
-    }
-    if (substr($line_up_to_current_position, -length($exception)) eq $exception) {
-      return 1;
-    }
-  }
-  return 0;
-}
-
-sub collapse_crash_sig {
-  my ($params) = @_;
-
-  $target_counter = 0;
-  @collapsed      = ();
-  $exception_mode = 0;
-  my $signature = $params->{signature};
-
-  for (my $i = 0; $i < length($signature); $i++) {
-    my $character = substr($signature, $i, 1);
-    if ($character eq $params->{open}) {
-      if (is_exception(
-        $params->{exceptions},
-        substr($signature, $i + 1),
-        substr($signature, 0, $i)
-      ))
-      {
-        $exception_mode = 1;
-        append_if_not_in_collapse_mode($character);
-        next;
-      }
-      append_if_not_in_collapse_mode($params->{replacement_open});
-      $target_counter++;
-    }
-    elsif ($character eq $params->{close}) {
-      if ($exception_mode) {
-        append_if_not_in_collapse_mode($character);
-        $exception_mode = 0;
-      }
-      else {
-        $target_counter--;
-        append_if_not_in_collapse_mode($params->{replacement_close});
-      }
-    }
-    else {
-      append_if_not_in_collapse_mode($character);
-    }
-  }
-
-  return join '', @collapsed;
-}
index f5105e52f0023a062692b7912d69c31fa2ddfd08..d98439769f38d08560ba32eb05343c1a2c3c74fe 100644 (file)
@@ -95,10 +95,6 @@ table.edit_form hr {
   margin-right: 10px;
 }
 
-#cf_crash_signature {
-  width: 100%;
-}
-
 #bz_ctag_error {
   border: none;
   padding: 2px 6px;
index 0bd6abbc6fe9cedfac242e2f69e1335eab2917e9..537a5d5a4bb8420a127ce14d41de387ed8455d65 100644 (file)
@@ -56,7 +56,6 @@ function init() {
   hideElementById('attachment_true');
   showElementById('attachment_false');
   showElementById('btn_no_attachment');
-  initCrashSignatureField();
   init_take_handler('[% user.login FILTER js %]');
   bz_attachment_form.update_requirements(false);
 
@@ -69,17 +68,6 @@ function init() {
   }, { once: true });
 }
 
-function initCrashSignatureField() {
-  var el = document.getElementById('cf_crash_signature');
-  if (!el) return;
-  [% IF cf_crash_signature.length %]
-    YAHOO.util.Dom.addClass('cf_crash_signature_container', 'bz_default_hidden');
-  [% ELSE %]
-    hideEditableField('cf_crash_signature_container','cf_crash_signature_input',
-                      'cf_crash_signature_action', 'cf_crash_signature');
-  [% END %]
-}
-
 const params = new URLSearchParams(location.search);
 let bug_type_specified = params.has('bug_type') || params.has('cloned_bug_id') || params.has('regressed_by');
 let desc_edited = false;