Closed Bug 274428 Opened 20 years ago Closed 20 years ago

checksetup should fixup flagtypes with spaces or commas

Categories

(Bugzilla :: Administration, task)

2.18
task
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: nb+bz, Assigned: nb+bz)

Details

Attachments

(1 file, 1 obsolete file)

We now disallow flag names which contain spaces or commas in their names (see
bug 182375).  Users who upgrade an installation will have difficulty unless they
rename their flagtypes (see also bug 262268).  Checksetup should either error or
fix up bad flag names.  I have a patch, tested against the 2.18 branch and the
trunk, which renames flag types by replacing either spaces or commas with
underscores (when possible), printing messages so that the administrator can see
what is happening.  I'll attach my patch.
Herewith the patch.  Output generated looks like this, when run against a
database with lots of bad cases (when the underscore substitution hits an
existing flag name).  Most databases won't have any bad cases, of course.

Creating table whine_events ...
Checking flag type names for spaces and commas...
  Bad flag type name "a b" ...
  ... can't rename as "a_b" ...
  renamed flag type "a b" as "a_b'"
  Bad flag type name "b,c" ...
  ... can't rename as "b_c" ...
  ... can't rename as "b_c'" ...
  ... can't rename as "b_c''" ...
  renamed flag type "b,c" as "b_c'''"
  Bad flag type name "123456789 123456789 123456789 123456789 1234567890" ...
  ... can't rename as "123456789_123456789_123456789_123456789_1234567890" ...
  renamed flag type "123456789 123456789 123456789 123456789 1234567890" as
"123456789_123456789_123456789_123456789_1234567..."
  Bad flag type name "foo, bar baz" ...
  renamed flag type "foo, bar baz" as "foo__bar_baz"
... done.
Adding new field grant_type to table group_group_map ...

Maybe adding single-quote characters to uniquify a flag name is ugly, but it
works.	I could easily change it to do something else.
Attachment #168614 - Flags: review?
Comment on attachment 168614 [details] [diff] [review]
patch v1 for 2.18 branch or for trunk

You need to put $tryflagname into %flagtypes on a successful rename.

+	     $dbh->do("UPDATE flagtypes SET name = \"$tryflagname\" " .
+		      "WHERE id = " . $flagtypes{$flagname});

Nit: this is nicer with a bound parameter.
Attachment #168614 - Flags: review? → review-
Attached patch v2Splinter Review
Fixed those two problems.  How's that?
Attachment #168614 - Attachment is obsolete: true
Attachment #168619 - Flags: review?
Flags: blocking2.20?
Flags: blocking2.18?
Comment on attachment 168619 [details] [diff] [review]
v2

That's good. Thank you!
Attachment #168619 - Flags: review? → review+
Assignee: justdave → Nick.Barnes
Flags: blocking2.20?
Flags: blocking2.18?
Flags: approval?
Flags: approval2.18?
Whiteboard: patch awaiting approval
Flags: blocking2.20?
Flags: blocking2.18?
Flags: blocking2.20?
Flags: blocking2.20+
Flags: blocking2.18?
Flags: blocking2.18+
Flags: approval?
Flags: approval2.18?
Flags: approval2.18+
Flags: approval+
Target Milestone: --- → Bugzilla 2.18
Checking in checksetup.pl;
/cvsroot/mozilla/webtools/bugzilla/checksetup.pl,v  <--  checksetup.pl
new revision: 1.289.2.14; previous revision: 1.289.2.13
done

Checking in checksetup.pl;
/cvsroot/mozilla/webtools/bugzilla/checksetup.pl,v  <--  checksetup.pl
new revision: 1.316; previous revision: 1.315
done
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Whiteboard: patch awaiting approval
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: