Closed Bug 340884 Opened 18 years ago Closed 17 years ago

Searches break on <select> fields whose values have commas

Categories

(Bugzilla :: Query/Bug List, defect)

2.22
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 67036

People

(Reporter: gabriel.sales, Assigned: jjclark1982)

Details

Attachments

(1 file, 3 obsolete files)

If you add a new field value for platform, OS, and other fields with a comma like "HACK,HACK" the search for bugs with that value will be broken because the search engine split values by commas. A simple check for commas in new values should fix this.
OS: Linux → All
Hardware: PC → All
Whiteboard: [Good intro bug]
Whiteboard: [Good intro bug] → [Good Intro Bug]
Attached patch v1 (obsolete) (deleted) — Splinter Review
Multiple custom field values were being joined and later split by commas to construct an "anyexact" search. This can be fixed by keeping them in an array instead of joining them. The array has to be dereferenced when printing debug text.
Attachment #277760 - Flags: review?(LpSolit)
Summary: editvalues.cgi needs to check if the new field value has "commas" → Searches break on <select> fields whose values have commas
Comment on attachment 277760 [details] [diff] [review] v1 >@@ -1111,7 +1110,7 @@ > }, > ",anyexact" => sub { > my @list; >- foreach my $w (split(/,/, $v)) { >+ foreach my $w (@$v) { I'm pretty sure this will break using anyexact from the Boolean Charts. >+ my $f = $params->param("field$chart-$row-$col"); >+ my $t = $params->param("type$chart-$row-$col"); >+ my $v = $params->param("value$chart-$row-$col"); >+ $v = join ',', @$v if (ref $v eq 'ARRAY'); You can't redefine $f, $t, and $v. At the least, you can't "my" them again. >@@ -1366,6 +1367,7 @@ >+ my $v = join ',', @$v if (ref $v eq 'ARRAY'); > push(@debugdata, "$f / $t / $v / " . Same here.
Attachment #277760 - Flags: review?(LpSolit) → review-
Assignee: general → jjclark1982
Component: Bugzilla-General → Query/Bug List
Attached patch v2 (obsolete) (deleted) — Splinter Review
This version uses more descriptive variable names in debug blocks and supports both arrays and strings for anyexact searches. Anyexact searches made from the list selection work correctly. Anyexact searches from the Boolean Charts have no way to escape commas, but can be replaced with multiple exact searches. Custom field values with commas can be successfully searched for in the Boolean Charts by exact, but not by anyexact.
Attachment #277760 - Attachment is obsolete: true
Attachment #277804 - Flags: review?(mkanat)
Comment on attachment 277804 [details] [diff] [review] v2 $rhs is treated as a string above your code. Also, you should do: join(',', @$rhs) if ref $rhs eq 'ARRAY' That avoids ambiguity of what the "if" is "iffing". :-) Same for $debug_v at the bottom. Any idea why sometimes we use "|" in the debug, and sometimes we use "/"?
Attachment #277804 - Flags: review?(mkanat) → review-
Attached patch v3 (obsolete) (deleted) — Splinter Review
Dereferenced $rhs at the correct place, and clarified if statements.
Attachment #277804 - Attachment is obsolete: true
Attachment #278124 - Flags: review?(LpSolit)
Attachment #278124 - Flags: review?(LpSolit) → review?(mkanat)
Comment on attachment 278124 [details] [diff] [review] v3 >+ @values = split(/,/, $v); Nit: Just do ',' instead of /,/. >@@ -1351,6 +1358,7 @@ > $q = $dbh->quote($v); > trick_taint($q); > my $rhs = $v; >+ $rhs = join(',', @$rhs) if ref $rhs eq 'ARRAY'; > $rhs =~ tr/,//; Wait, so you join them with commas and then remove all the commas? That doesn't make sense.
Attachment #278124 - Flags: review?(mkanat) → review-
(In reply to comment #6) > >+ @values = split(/,/, $v); > > Nit: Just do ',' instead of /,/. I personally prefer the /,/ syntax and is the syntax used in |perldoc -f split|. Keep it!
Status: NEW → ASSIGNED
Attached patch v4 (deleted) — Splinter Review
> $rhs =~ tr/,//; This line wasn't actually deleting commas since it lacked the 'd' flag. So in the unpatched version, searching for the name of an operation would invoke that operation if it was listed earlier than the correct operation in @funcdefs. For example, a Boolean Chart search for "OS/Version" "contains any of the words" "anyexact,Windows" would invoke an anyexact search instead of an anywords search and return nothing. I have added stricter conditions to the keys in @funcdefs to ensure that search type will not be matched by value text. This also makes it unnecessary to remove commas from $rhs. Requiring patterns to match from the beginning of the string is probably safer than just matching the function name.
Attachment #278124 - Attachment is obsolete: true
Attachment #278517 - Flags: review?
Attachment #278517 - Flags: review? → review?(justdave)
Attachment #278517 - Flags: review?(justdave) → review?(mkanat)
Hey Jesse. Now I think you're overlapping with bug 67036. Actually, I think this bug might even be a duplicate of that bug. What do you think?
Yes, this is the same bug. Joel's approach is probably the most robust. Perhaps it is time to revive it.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
Attachment #278517 - Flags: review?(mkanat)
Whiteboard: [Good Intro Bug]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: