Closed Bug 395603 Opened 19 years ago Closed 19 years ago

ERROR: "invalid bug attribute remaining_time" with timetrackinggroup set to blank

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

3.1.1
defect
Not set
blocker

Tracking

()

RESOLVED FIXED
Bugzilla 3.2

People

(Reporter: ddkilzer, Assigned: LpSolit)

References

Details

Attachments

(1 file, 1 obsolete file)

* SUMMARY With a local installation of bugzilla-tip, attempting to mark a bug as duplicate results in an error with the timetrackinggroup parameter set to blank: Software error: invalid bug attribute remaining_time at Bugzilla/Bug.pm line 3010 Bugzilla::Bug::AUTOLOAD('Bugzilla::Bug=HASH(0x1b915b0)') called at Bugzilla/Bug.pm line 2077 Bugzilla::Bug::check_status_change_triggers('Bugzilla::Bug', 'duplicate', 'ARRAY(0x1acc224)', 'HASH(0x1b28b18)') called at /Users/ddkilzer/Projects/Perl/bugzilla-tip/process_bug.cgi line 847 * STEPS TO REPRODUCE 1. Set timetrackinggroup parameter in Group Security to blank (no value). 2. Access a bug (or create a new one). 3. Mark bug as duplicate of another bug. * EXPECTED RESULTS Duplicate bug action should succeed. * ACTUAL RESULTS Duplicate bug action fails with an error: Software error: invalid bug attribute remaining_time at Bugzilla/Bug.pm line 3010 Bugzilla::Bug::AUTOLOAD('Bugzilla::Bug=HASH(0x1b915b0)') called at Bugzilla/Bug.pm line 2077 Bugzilla::Bug::check_status_change_triggers('Bugzilla::Bug', 'duplicate', 'ARRAY(0x1acc224)', 'HASH(0x1b28b18)') called at /Users/ddkilzer/Projects/Perl/bugzilla-tip/process_bug.cgi line 847 * REGRESSION I assume this is a regression since Bugzilla 3.1 or 3.1.1. (My version is reported as 3.1.1+.) * NOTES May be related to fix for Bug 388149.
Yes, I can reproduce the crash. Not sure that's related to bug 388149 though.
Severity: major → blocker
Flags: blocking3.1.2+
OS: Mac OS X → All
Hardware: Macintosh → All
Target Milestone: --- → Bugzilla 3.2
Version: unspecified → 3.1.1
This is a regression due to bug 389916. I have a patch ready.
Depends on: 389916
Attached patch patch, v1 (obsolete) — — Splinter Review
Trivial fix. Only check $bug->remaining_time > 0 if the user is in the timetracking group to know if we should display the message or not. If the user is not in this group, we already know we won't display the message. What my patch does is to call $bug->_zero_remaining_time in all cases, even if the remaining time was already 0, in which case this doesn't hurt as it will do nothing (and it alters the internal remaining_time parameter so it doesn't have to call the method).
Assignee: create-and-change → LpSolit
Status: NEW → ASSIGNED
Attachment #280335 - Flags: review?(mkanat)
Comment on attachment 280335 [details] [diff] [review] patch, v1 > # DUPLICATE bugs should have no time remaining. > foreach my $bug (@$bugs) { >+ if (Bugzilla->user->in_group(Bugzilla->params->{'timetrackinggroup'})) { In this case, I think the check for the timetrackinggroup may be pulled outside of the loop: if (Bugzilla->user->in_group(Bugzilla->params->{'timetrackinggroup'})) { foreach my $bug (@$bugs) { [...] } } > if ($action ne 'change_resolution') { > foreach my $b (@$bugs) { > if ($b->bug_status ne $action) { >+ if (Bugzilla->user->in_group(Bugzilla->params->{'timetrackinggroup'})) { In this case, do you want to set a variable outside the foreach loop so you don't have to call it within the loop? if ($action ne 'change_resolution') { my $userInTimeTrackingGroup = Bugzilla->user->in_group(Bugzilla->params->{'timetrackinggroup'}); foreach my $b (@$bugs) { if ($b->bug_status ne $action) { if ($userInTimeTrackingGroup) { [...]
(In reply to comment #4) > In this case, I think the check for the timetrackinggroup may be pulled outside > of the loop: No, this doesn't work. You would omit the whole loop if you are not in the timetracking group, which is wrong as you still have to silently clear the remaining time. > In this case, do you want to set a variable outside the foreach loop so you > don't have to call it within the loop? No, doesn't help. Groups are cached in the user object already, so there is no perf issue.
(In reply to comment #5) > No, this doesn't work. You would omit the whole loop if you are not in the > timetracking group, which is wrong as you still have to silently clear the > remaining time. You are correct. Sorry, didn't see the additional call within the foreach loop. > No, doesn't help. Groups are cached in the user object already, so there is no > perf issue. Great!
Comment on attachment 280335 [details] [diff] [review] patch, v1 I think instead we should remove this from Bug->fields: # Conditional Fields Bugzilla->params->{'useqacontact'} ? "qa_contact" : (), Bugzilla->params->{'timetrackinggroup'} ? qw(estimated_time remaining_time actual_time deadline) : (), There's no reason to *throw an error* if we try to access those things when they're disabled. Disabling them should just hide them from the UI. user->in_group('') will always return false, so we're safe there.
Attachment #280335 - Flags: review?(mkanat) → review-
Attached patch patch, v2 — — Splinter Review
Add time-related fields in all cases. I leave qa_contact alone though (which is out of the topic of this bug anyway).
Attachment #280335 - Attachment is obsolete: true
Attachment #280394 - Flags: review?(mkanat)
Comment on attachment 280394 [details] [diff] [review] patch, v2 Yeah, this looks much better.
Attachment #280394 - Flags: review?(mkanat) → review+
Flags: approval+
Checking in Bugzilla/Bug.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v <-- Bug.pm new revision: 1.202; previous revision: 1.201 done
Status: ASSIGNED → RESOLVED
Closed: 19 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: