Last Comment Bug 24896 - Make First/Last/Prev/Next Work with multiple buglists at once
: Make First/Last/Prev/Next Work with multiple buglists at once
[wanted-bmo][3.6 Focus]
Product: Bugzilla
Classification: Server Software
Component: Query/Bug List (show other bugs)
: unspecified
: All All
: P2 enhancement with 1 vote (vote)
: Bugzilla 4.0
Assigned To: Max Kanat-Alexander
: default-qa
: 65291 111999 (view as bug list)
Depends on:
Blocks: 376044 489028 578335 579189 600616 615574 644281 715731 715733 722113
  Show dependency treegraph
Reported: 2000-01-24 11:54 PST by Dan Erikson
Modified: 2012-01-28 18:45 PST (History)
15 users (show)
mkanat: approval+
See Also:
QA Whiteboard:
Iteration: ---
Points: ---

v1 (3.0) (13.58 KB, patch)
2008-03-22 01:49 PDT, Max Kanat-Alexander
LpSolit: review-
Details | Diff | Splinter Review
Work In Progress (17.33 KB, patch)
2010-02-10 00:18 PST, Max Kanat-Alexander
no flags Details | Diff | Splinter Review
v2 (17.33 KB, patch)
2010-02-10 03:05 PST, Max Kanat-Alexander
no flags Details | Diff | Splinter Review
Actual v2 (22.35 KB, patch)
2010-02-10 03:06 PST, Max Kanat-Alexander
no flags Details | Diff | Splinter Review
v3 (22.37 KB, patch)
2010-02-25 15:40 PST, Max Kanat-Alexander
glob: review+
Details | Diff | Splinter Review

Description Dan Erikson 2000-01-24 11:54:17 PST
When I am searching through two seperate bug list queries in two different
windows, the First, Last, Prev, Next, and Show list links work off of the
latest query that I preformed.

Steps to reproduce:
Run a query in bugzilla.
Open a bug from that query list.
Open a new window.
Run a different query in that window.
Go back to the first window and click on the Show list link.

The list shown is from the second query.

Expected Result:
Should show the list from the first query.
Comment 1 Terry Weissman 2000-01-24 12:31:25 PST
Yeah, I know.  This is because it uses cookies, and cookies are browser-wide. 
There's no way to limit a cookie to a window.

Bugzilla (and it's predecessor, BugSplat) has always had this problem.

The only way I know to fix this would be to pass around some token as a form
element or URL parameter to every page you visit.  Which is a fine technique,
but a real coding grind.

If anyone has some other suggestions, I'd love to hear them.
Comment 2 Terry Weissman 2000-04-13 07:28:33 PDT is the new owner of Bugzilla and Bonsai.  (For details,
see my posting in netscape.public.mozilla.webtools,
news:// .)
Comment 3 Gervase Markham [:gerv] 2001-01-12 14:34:29 PST
This bug has not been touched for more than nine months. In most cases, that 
means it has "slipped through the net". Please could the owner take a moment to 
add a comment to the bug with current status, and/or close it.

Thank you :-)

Comment 4 Jacob Steenhagen 2001-01-12 20:58:10 PST
*** Bug 65291 has been marked as a duplicate of this bug. ***
Comment 5 Dave Miller [:justdave] ( 2001-01-12 21:09:59 PST
Since bug 65291 got marked as a dupe of this one, and it had a lot of good 
discussion in it, here's the relevant discussion from 65291:

Original text from (Keyser Sosez):

Please please please, for the sake of the sanity of the bug triagers code 
Bugzilla so it doesnt clobber the results from the first search you do.  For 

1) Run any bugzilla query
2) On the list that comes up click on any bug to get its details
3) Open a New Window
4) Run another bugzilla query
5) Go back to first window and click on any of the links such as: Next, Prev,
First, Last
6) Watch as bugzilla goes to the first result of the other query.

This may not seem like a big deal but when your looking for duplicates of an 
unconfirmed bug, everytime you want to go to the next bug you have resubmit the 
query, thus losing your place. Its a waste of time, and drives the bug triagers 
insane. Please please fix :)

------- Additional Comments From Dave Miller 2001-01-12 18:28 -------

This was discussed in IRC this evening.  Possible solution:

Assign each query a number.  Create a new cookie with each query, with that  
number in the cookie name.  Each time a user does a query, use whatever the next  
unused number is.  That number can then be placed in the "Prev", "Next", "Show  
List", etc. links so it knows which one to use when the link is clicked in that  
particular window.

Pick a reasonable number of queries (10?) and start deleting cookies when you get 
more than that many of them, to prevent cookie bloat.

------- Additional Comments From Jesse Ruderman 2001-01-12 20:33 -------

Can this be done without destroying the "visited" state of buglinks on query  
result pages?

------- Additional Comments From Dave Miller 2001-01-12 20:42 -------

Ooohhh...  yeah, you'd need to have some way in the bug link to tell the newly- 
viewed bug which buglist it was linked to from.  Hadn't thought about that.   

------- Additional Comments From Dave Miller 2001-01-12 20:50 -------

Hmm, thought on that subject....
The cookies actually store a list of bug numbers (in the current implementation 
already in use).  If it continues to do that, all it would need to do is look to 
see which cookie it's mentioned in, then use that one.  If it was a hit in more 
than one query, perhaps supply more than one set of Next/Prev/First/Last/Show 
links, with the query numbers in front of each line...
Comment 6 Dave Miller [:justdave] ( 2001-02-27 19:23:02 PST
moving to real milestones...
Comment 7 Zach Lipton [:zach] 2001-08-25 17:48:28 PDT
Comment 8 Dave Miller [:justdave] ( 2001-08-28 01:12:53 PDT
correcting version field lost in product move
Comment 9 Gervase Markham [:gerv] 2001-10-14 20:03:28 PDT
Another way to fix this bug is based on the way people actually use buglists.

You often have one big buglist you are working through, and make loads of other
little queries, e.g. to try and find dupes. You normally don't iterate through
those queries, but scan them by looking down the list.

So, the solution is to have a checkbox on query.cgi which stops Bugzilla from
updating the cookie. Something like "Do not generate navigational links for this
query" or something. You'd check that when you did the little queries.

Or, you could have two submit buttons. This might be quicker.

Comment 10 Dave Miller [:justdave] ( 2001-11-17 18:17:16 PST
We are currently trying to wrap up Bugzilla 2.16.  We are now close enough to
release time that anything that wasn't already ranked at P1 isn't going to make
the cut.  Thus this is being retargetted at 2.18.  If you strongly disagree with
this retargetting, please comment, however, be aware that we only have about 2
weeks left to review and test anything at this point, and we intend to devote
this time to the remaining bugs that were designated as release blockers.
Comment 11 John Vandenberg 2002-04-18 19:00:00 PDT
Gerv's suggestion is a very simple solution which will save users a lot of time,
and reduce the number of times queries are run.  I have raised bug 138351 to
propose it as an interim solution.
Comment 12 José Henrique F. Melman 2003-07-31 08:47:16 PDT
A possible solution: when searching, the generated page's links should contain
the timestamp of the search. The cookie BUGLIST should be renamed to something
like  BUGLIST20030731123405. When clicking on a link in the generated page, the
server would receive the timestamp of the search and read the appropriate cookie.

I don't know much about cookies, I don't know if it is possible to have numbers
in the cookie name, but a "translation" should not be difficult: just get the
NTP timestamp in hex form and then make 0 become A, 1 become B, ... , F become P.
Comment 13 Dave Miller [:justdave] ( 2004-03-14 23:17:47 PST
Enhancements which don't currently have patches on them which are targetted at
2.18 are being retargetted to 2.20 because we're about to freeze for 2.18. 
Consideration will be taken for moving items back to 2.18 on a case-by-case
basis (but is unlikely for enhancements)
Comment 14 Dave Miller [:justdave] ( 2004-09-18 18:08:35 PDT
Bugzilla 2.20 feature set is now frozen as of 15 Sept 2004.  Anything flagged
enhancement that hasn't already landed is being pushed out.  If this bug is
otherwise ready to land, we'll handle it on a case-by-case basis, please set the
blocking2.20 flag to '?' if you think it qualifies.
Comment 15 Wayne Mery (:wsmwk, NI for questions) 2005-07-18 08:41:38 PDT
(In reply to comment #12)
> A possible solution: when searching, the generated page's links should contain
> the timestamp of the search. The cookie BUGLIST should be renamed to something
> like  BUGLIST20030731123405. When clicking on a link in the generated page, the
> server would receive the timestamp of the search and read the appropriate cookie.

my preference of the options presented. I am not against a check box ala gerv's
comment 9 (bug 138351) but the suggestion above would be more helpful. (hmm,
according to comment 8 patch in Bug 138351 is bitrotted)

Cookie expiration becomes the next issue.

(surprised nothing has been implemented, as it seems easy to address and is
definitely benificial to triagers - mulitiple query lists are a frequent occurrenc)
Comment 16 Frédéric Buclin 2005-11-17 07:08:21 PST
The trunk is now frozen to prepare Bugzilla 2.22. Only bug fixes are accepted, no enhancement bugs. As this bug has a pretty low activity (especially from the assignee), it's retargetted to ---. If you want to work on it and you think you can have it fixed for 2.24, please retarget it accordingly (to 2.24).
Comment 17 Frédéric Buclin 2008-03-20 08:59:14 PDT
Max, isn't it something you implemented as part of the b.m.o customization?
Comment 18 Max Kanat-Alexander 2008-03-22 01:32:20 PDT
Indeed, I did. I wrote the code for 3.0, but it will probably apply to 4.0 pretty easily.
Comment 19 Max Kanat-Alexander 2008-03-22 01:49:25 PDT
Created attachment 311126 [details] [diff] [review]
v1 (3.0)

I haven't actually tried to apply this to the trunk, but you could still look it over and let me know what you think about the design, and so on. I think maybe we should have an object for the last searches instead of just a hash.
Comment 20 Frédéric Buclin 2008-04-07 05:56:55 PDT
Comment on attachment 311126 [details] [diff] [review]
v1 (3.0)

The implementation on b.m.o made some users unhappy, because history was broken due to the appended arguments to URLs. I think that's a valid point as I also look at links to determine if a bug has already been visited or not. That's not something we should break.
Comment 21 Jesse Ruderman 2008-04-07 15:20:47 PDT
(See bug 425601, "&last_list in show_bug URLs breaks visited link coloring".)
Comment 22 Max Kanat-Alexander 2009-02-10 17:07:00 PST
We can fix this by:

1. Including a search_id argument in the buglist.cgi URL somehow.
2. When you click on a bug, it checks its Referer to see if it's coming from
   buglist.cgi, and pulls the correct list out of the Referer.
3. Once the bug is loaded, the First/Prev/Next/Last buttons just use the
   search_id directly and don't need to check the Referer.

The tricky part is #1.
Comment 23 Max Kanat-Alexander 2009-02-10 17:08:04 PST
We can possibly accomplish #1 by doing it during the POST conversion step of buglist.cgi (that is, where it shortens the search URL), since we have the whole search there anyhow.
Comment 24 Max Kanat-Alexander 2010-02-10 00:18:54 PST
Created attachment 426195 [details] [diff] [review]
Work In Progress

Here's a work-in-progress patch for the Referer-based solution.
Comment 25 Max Kanat-Alexander 2010-02-10 03:05:00 PST
Created attachment 426222 [details] [diff] [review]

Okay, here it is.

The bug lists of searches are saved to the database after they are run. They are given an id, and this id appears in the URL after the search is redirected from the initial POST from query.cgi.

When viewing a bug, it attempts various ways to figure out what list the bug is associated with. When you've actually used the First/Prev/Next/Last buttons, it's a no-brainer, because they include the list_id in their links. But to preserve visited-link coloring in the bug lists, we don't include list_id in the links there--instead, when viewing a bug, we check the Referer header for a list_id.

If you view a bug without having come from a bug list, and if there's no list_id in query parameters, then we simply look for the most-recent search that contains this particular bug, and we decide that that's the list. (This is how things will work for Saved Searches currently, since they have no list_id in their header, since they go from a GET.)

It still uses the BUGLIST cookie for logged-out users.
Comment 26 Max Kanat-Alexander 2010-02-10 03:06:12 PST
Created attachment 426224 [details] [diff] [review]
Actual v2

I attached the wrong patch last time.
Comment 27 Eric Black 2010-02-17 16:52:10 PST
I started with a functional test and I came across the following bug:

1. Run a search from the query.cgi page

2. Go into one of the bugs in the list

3. Click on the 'show last search results', which has a URL like:

4. It goes back to the original list ok.

5. Click on 'edit search', which has a URL like(doesn't seem right to me):

6. The query.cgi page displays with no original parameters selected and only has the first bug number from #5 url (bug 1) in the 'Only include bugs numbered:' edit box.

I reverted the changes and the url for 'edit search' was and had bug 1,2,3 in 
the 'Only include bugs numbered:' edit box. (That in itself seems like a bug since it isn't returning my original search parameters like the original buglist 'edit search' URL which was

BTW, shouldn't bug 138351 be marked as depending on this bug or linked to it so if this bug fixes the problem, bug 138351 can be marked obsolete.
Comment 28 Eric Black 2010-02-17 17:25:19 PST
(In reply to comment #27)

> I reverted the changes and the url for 'edit search' was
> and had bug 1,2,3 in 
> the 'Only include bugs numbered:' edit box. (That in itself seems like a bug
> since it isn't returning my original search parameters like the original
> buglist 'edit search' URL which was

I created Bug 546821 for the problem that isn't from this patch, so only item 6 in comment #27 is from the patch.
Comment 29 Max Kanat-Alexander 2010-02-25 15:40:23 PST
Created attachment 429011 [details] [diff] [review]

Thanks for the review, Eric! This version of the patch fixes the problem that Eric found with editing searches.
Comment 30 Max Kanat-Alexander 2010-04-27 16:30:15 PDT
*** Bug 111999 has been marked as a duplicate of this bug. ***
Comment 31 Byron Jones ‹:glob› [PTO until 2017-01-09] 2010-06-15 18:33:45 PDT
Comment on attachment 429011 [details] [diff] [review]

Comment 32 Max Kanat-Alexander 2010-06-15 18:41:10 PDT
Woohooo!! :-)

Committing to: bzr+ssh://
modified buglist.cgi
modified Bugzilla/
modified Bugzilla/
modified Bugzilla/
modified Bugzilla/
modified Bugzilla/
modified Bugzilla/DB/
added Bugzilla/Search/
modified template/en/default/bug/navigate.html.tmpl
modified template/en/default/global/user-error.html.tmpl                       
Committed revision 7210.
Comment 33 Max Kanat-Alexander 2010-10-18 14:36:29 PDT
Added to the release notes in bug 604256.

Note You need to log in before you can comment on or make changes to this bug.