Closed Bug 567303 Opened 16 years ago Closed 16 years ago

VALIDATOR_DEPENDENCIES doesn't always sort field validation properly

Categories

(Bugzilla :: Bugzilla-General, defect)

defect
Not set
critical

Tracking

()

RESOLVED FIXED
Bugzilla 4.0

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

Attachments

(1 file, 2 obsolete files)

Perl uses quicksort, which of course means that it does not compare every value in an array to every other value in an array. Also, it assumes that: A > B > C === A > C So if it's already compared A and B, and it's already compared B and C, then it doesn't compare A and C. In _cmp_dependency, we are currently doing a "cmp" call if we don't explicitly match a dependency. But then we get into the A, B, C situation above. For example: bug_status > bug_severity bug_severity > product Thus, bug_status comes before product, even though it shouldn't. The simple solution is to make the comparison function always sort non-depdendent fields before any fields with dependencies, because that will assure that fields with dependencies fields always have their comparison done properly against each other.
Attached patch v1 (obsolete) — Splinter Review
So, I think that this will fix the problem. I'm going to do some more extensive testing to be sure.
Assignee: general → mkanat
Status: NEW → ASSIGNED
Attachment #446652 - Flags: review?(LpSolit)
Attachment #446652 - Flags: review?(LpSolit) → review-
Comment on attachment 446652 [details] [diff] [review] v1 Okay, this doesn't work either. If I pretend like "custom" depends on "visibility_value_id" in Bugzilla::Field, it doesn't work right. I may have to write a custom sort function.
Attached patch v2 (obsolete) — Splinter Review
Wow, welcome to Computer Science land. Okay, here's a patch using a sorting algorithm that is not fast, but is pretty simple and only operates on small sets of data, so we're OK. In all my testing (both on paper and with actual data), this sorts things properly.
Attachment #446652 - Attachment is obsolete: true
Attachment #446845 - Flags: review?(timello)
Alright! I'll check this very soon.
Blocks: 567281
Blocks: 567296
Attached patch v3Splinter Review
Oh, um, actually *using* the function might be good, too. :-)
Attachment #446845 - Attachment is obsolete: true
Attachment #446903 - Flags: review?(timello)
Attachment #446845 - Flags: review?(timello)
Comment on attachment 446903 [details] [diff] [review] v3 It looks good! As you mentioned, we could sort the @$has_deps alphabetically as we do for the @$no_deps for consistency.
Attachment #446903 - Flags: review?(timello) → review+
Thanks for the review, timello! :-) Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/Object.pm modified Bugzilla/Install/Requirements.pm modified template/en/default/global/code-error.html.tmpl Committed revision 7195.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Flags: approval?
Flags: approval? → approval+
Max, I see that you change the List::MoreUtils requirement version to 0.23 but the latest version I can see is 0.22. install-module.pl scripts says 0.22 is the latest one. Is that right?
right!
Reopening! 0.23 doesn't exist, and 0.25_02 is a dev release.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Maybe you meant 0.13?, see: 0.13 Wed Nov 9 16:29:02 CET 2005 - nearly all functions receiving a CODE-block as first argument had a hefty memory-leak: Fixed (spotted by Thomas A. Lowery <tlowery AT cc3 DOT com>)
(In reply to comment #11) > Maybe you meant 0.13? No, 0.23: http://cpansearch.perl.org/src/VPARSEVAL/List-MoreUtils-0.25_02/Changes fixed: Big memory leak with XS part() But 0.23 and 0.24 are not (no longer?) available.
Right, they had critical bugs. I've emailed the maintainer to see if he is going to come out with a newer version. In the mean time, I've reduced the requirement to 0.22 so people will at least be able to run 3.7.1: Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/Install/Requirements.pm Committed revision 7199.
Status: REOPENED → RESOLVED
Closed: 16 years ago16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: