Closed
Bug 271048
Opened 20 years ago
Closed 20 years ago
Classification list is blank on query.cgi
Categories
(Bugzilla :: Query/Bug List, defect)
Bugzilla
Query/Bug List
Tracking
()
RESOLVED
FIXED
Bugzilla 2.20
People
(Reporter: jlawson-mozbug, Assigned: altlist)
Details
Attachments
(1 file, 2 obsolete files)
|
825 bytes,
patch
|
justdave
:
review+
|
Details | Diff | Splinter Review |
I've enabled the new Classifications feature on my bugzilla installation made from a current head checkout (Nov 21 06:37:30 UTC 2004) and the Classification selection box is always empty. I have traced the bug to being in that sort() is interpreting its argument as the sorting function, rather than the list to be sorted.
| Reporter | ||
Comment 1•20 years ago
|
||
| Reporter | ||
Comment 2•20 years ago
|
||
My bugzilla is using Perl 5.6.1 on Redhat ES 2.1 x86, if that's of any interest.
Updated•20 years ago
|
Flags: blocking2.20?
| Reporter | ||
Updated•20 years ago
|
Attachment #166644 -
Flags: review?
Comment 3•20 years ago
|
||
Comment on attachment 166644 [details] [diff] [review] use a temporary list to workaround sort issue Sort doesn't interpret its argument as the sorting function, that would be illogical. This is a hack because it provides a solution without understanding the root cause. By taking a look at the sort perldoc documentation ('perldoc -f sort' in the command line) I could see that: >> In scalar context, the behaviour of "sort()" is undefined. << So I wonder if GetSelectableClassifications() doesn't return a scalar context by any chance. This would also explain why your hack works. So I took a look in globals.pl and the return statement for the "sub GetSelectableClassifications()" is: return (@selectable_classes); I wonder if removing those () around the @selectable_classes would solve the issue for you. Jeff, can you test that (reverse your change, remove the () in globals.pl, retest, and if it works, re-diff, attach a new patch and request review again)? Thanks!
Attachment #166644 -
Flags: review? → review-
Updated•20 years ago
|
OS: Windows XP → All
Hardware: PC → All
Target Milestone: --- → Bugzilla 2.20
| Reporter | ||
Comment 4•20 years ago
|
||
vladd, I just tried it. Reverting my change to query.cgi and changing the globals.pl as you suggest does not work. In fact prior to creating my patch, I had tried adding both a "die" and a debugging "print STDERR" just inside the sub GetSelectableClassifications and my message was not printed at all. That is how I came to the conclusion that sort() was getting confused and interpreting its argument as a sort function with an empty array.
Comment 5•20 years ago
|
||
I found this which might be useful: http://london.pm.org/pipermail/london.pm/Week-of-Mon-20011210/007882.html Quote: The indirect object slot is tricky. What's happening is that "sort $scalar" is theoretically ambiguous - it could be "sort the list consisting of this scalar with the default sort routine" or "sort, with the routine whose name is in $scalar (or to which $scalar contains a reference, a list that I'm going to give you in a second", and the tokeniser(?) has to find out which it is. perldoc -f sort (5.6.1) says "SUBNAME may be a scalar variable name (unsubscripted), in which case the value provides the name of (or a reference to) the actual subroutine to use." Note the "unsubscripted" thing. AFAIK, that's the criterion the tokeniser uses to determine whether it's a data item or a SUBNAME; it doesn't lookahead very far.
Comment 6•20 years ago
|
||
Ok, so 5.6 sucks.
We could use "sort {$a cmp $b} Get..."; it's less intrusive, doesn't require an
additional variable and it doesn't change the code that the interpreter will try
to execute. Jeff, could we try that instead?| Reporter | ||
Comment 7•20 years ago
|
||
That works as well.
Attachment #166644 -
Attachment is obsolete: true
Updated•20 years ago
|
Attachment #166657 -
Flags: review+
Updated•20 years ago
|
Assignee: justdave → jlawson-mozilla
Flags: approval?
| Reporter | ||
Comment 8•20 years ago
|
||
i don't have commit privs, so someone else will eventually have to commit it once approved
| Assignee | ||
Comment 9•20 years ago
|
||
Jeff, can you try this patch instead? GetSelectableClassifications ought to always return a sorted list, similar to GetSelectableProducts. This way, any future code won't have to explicitly sort (and potential create another sort bug).
| Reporter | ||
Comment 10•20 years ago
|
||
Albert, that patch works ok too.
| Assignee | ||
Comment 11•20 years ago
|
||
Thanks Jeff. Vlad, I don't have review permissions, but would like to request we use the newer patch to fix this bug.
Updated•20 years ago
|
Attachment #166657 -
Attachment is obsolete: true
Updated•20 years ago
|
Attachment #167451 -
Flags: review+
Updated•20 years ago
|
Flags: blocking2.20?
Flags: blocking2.20+
Flags: approval?
Flags: approval+
Updated•20 years ago
|
Assignee: jlawson-mozilla → altlst
Comment 12•20 years ago
|
||
Checking in globals.pl; /cvsroot/mozilla/webtools/bugzilla/globals.pl,v <-- globals.pl new revision: 1.276; previous revision: 1.275 done Checking in query.cgi; /cvsroot/mozilla/webtools/bugzilla/query.cgi,v <-- query.cgi new revision: 1.133; previous revision: 1.132 done
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
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
•