Closed
Bug 27309
Opened 25 years ago
Closed 23 years ago
SplitEnumType should handle apostrophe in enum value for Bugzilla parameter values
Categories
(Bugzilla :: Bugzilla-General, enhancement, P2)
Bugzilla
Bugzilla-General
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: randall.whitman, Assigned: justdave)
Details
Attachments
(1 file)
1.32 KB,
text/plain
|
Details |
As stated in the comments above SplitEnumType in globals.pl: "Assumes that enums don't ever contain an apostrophe!". This is due to the following line in sub SplitEnumType: while ($guts =~ /^\'([^\']*)\',(.*)$/) { At our site, we tried to use "Won't Fix" rather than "WONTFIX" when we customized the Resolution values. While customization of resolutions may be considered not supported by Bugzilla, customization of severities, platforms, OSs, and priorities definitely are supported. These are also enum types, and SplitEnumType is used on all of them. It is not at all far-fetched that someone would want a severity such as "Can't Run" or "Won't Run". We worked around the problem by avoiding the apostrophe, but I submit the following regexp for consideration, to force parsing up to the next occurence of "',", rather than stopping at an apostrophe in the middle of a value (not immediately followed by a comma): /^\'(.*?)\',(.*)$/ I have unit-tested it on the following strings: my @testcases; push @testcases, qq{enum('','Fixed','Invalid','Won''t Fix','Future Version','Remind','Duplicate','Cannot Reproduce')}; push @testcases, qq{enum('','Fixed','Invalid','Won''t Fix','Good, Bad, Ugly','Remind','Duplicate','Cannot Reproduce')}; push @testcases, qq{enum('Cannot Reproduce')}; However, the above is not sufficient, due to MySQL quoting conventions, where an apostrophe is expressed as a double apostrophe in the output of "desc" (see attachment: demo of apostrophe in enum value). The extra apostrophe can be handled by changing the loop in SplitEnumType to the following. I have unit-tested it successfully on the test strings listed above. while ($guts =~ /^\'(.*?)\',(.*)$/) { $guts = $2; (my $temp = $1) =~ s/''/'/; push @result, $temp; } An alternate patch is to rewrite SplitEnumType using split(). I have unit-tested this successfully on the test strings listed above. sub SplitEnumType { my ($str) = (@_); my @result = (); if ($str =~ /^enum\('(.*)'\)$/) { $str = $1; @result = split(/','/, $str); for my $index ($[..$#result) { $result[$index] =~ s/''/'/; } } return @result; } We acknowledge a question of whether it is desirable to add extra code for a special case, which may and may not be considered to be supported. But if apostrophes are to be officially not supported, then this should be documented in an appropriate place, namely the README and/or comments in localconfig. Note: the issue of whether using enums in Bugzilla is a good idea at all is discussed in bug #17453.
Reporter | ||
Comment 1•25 years ago
|
||
Comment 2•25 years ago
|
||
tara@tequilarista.org is the new owner of Bugzilla and Bonsai. (For details, see my posting in netscape.public.mozilla.webtools, news://news.mozilla.org/38F5D90D.F40E8C1A%40geocast.com .)
Assignee: terry → tara
enums are going away with a new schema. evaluate for 2.12
Assignee: tara → cyeh
Whiteboard: 2.12
dropping 2.12 from whiteboard. i put an annotation in checksetup.pl so that if someone were to go tweak the enum values, there's a comment there that we don't support it. enums are the first thing to go away after 2.12, so i'm going to leave this bug as open and assigned until they are gone.
Status: NEW → ASSIGNED
Whiteboard: 2.12
Updated•24 years ago
|
QA Contact: matty
Whiteboard: 2.14
Updated•24 years ago
|
Whiteboard: 2.14 → 2.16
Assignee | ||
Comment 5•24 years ago
|
||
moving to real milestones...
Target Milestone: --- → Bugzilla 2.16
Updated•24 years ago
|
Priority: P3 → P2
Assignee | ||
Comment 6•23 years ago
|
||
Taking all of cyeh's Bugzilla bugs.
Assignee: Chris.Yeh → justdave
Status: ASSIGNED → NEW
Updated•23 years ago
|
Component: Bugzilla → Bugzilla-General
Product: Webtools → Bugzilla
Version: other → unspecified
Assignee | ||
Comment 7•23 years ago
|
||
Bug 17453 is going to negate the need for this by removing the enums, and thus we'll have no need to split them anymore.
Status: NEW → RESOLVED
Closed: 23 years ago
No longer depends on: bz-enums
OS: Linux → All
Hardware: PC → All
Resolution: --- → WONTFIX
Target Milestone: Bugzilla 2.16 → ---
Updated•12 years ago
|
QA Contact: matty_is_a_geek → default-qa
You need to log in
before you can comment on or make changes to this bug.
Description
•