Last Comment Bug 622487 - Product and component mismatch , a product without any component gets component of other projects in advance search
: Product and component mismatch , a product without any component gets compon...
Status: RESOLVED FIXED
:
Product: Bugzilla
Classification: Server Software
Component: Query/Bug List (show other bugs)
: 4.0
: All All
: P4 minor (vote)
: Bugzilla 4.0
Assigned To: Frédéric Buclin
: default-qa
Mentors:
: 636084 648899 660947 667903 673582 713098 (view as bug list)
Depends on: 661476
Blocks:
  Show dependency treegraph
 
Reported: 2011-01-02 21:59 PST by Digambar
Modified: 2011-12-22 14:07 PST (History)
9 users (show)
LpSolit: approval4.2+
LpSolit: approval4.0+
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
workaround (656 bytes, patch)
2011-02-23 12:02 PST, Frédéric Buclin
mkanat: review+
Details | Diff | Review

Description Digambar 2011-01-02 21:59:15 PST
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100216 Fedora/3.5.8-1.fc11 Firefox/3.5.8
Build Identifier: 4.0rc1

We have already few products in bugzilla, each with its own component list. 
Recently we create 3 products in bugzilla two of them without any component.
These new products are placed in between the existing product line up and not at the end (the way it is shown in advance search product listing). 

When we select a product from product in drop down box , there corresponding components are populated in components drop down. But as two products dont have any components they should have been empty. Instead these product shows components from other products. 

The cpts and vers array created for each product is not creating an empty array when a product dont have any  component.

When the product drop down shows 10 products the cpts and vers array size should be 10 and  not less.

Reproducible: Always

Steps to Reproduce:
1. Create product a b c  with sub compoents a1 b1 and c1
2. check the advance search that when you click a you get a1 and when you click b gets b1 in component
3. Create a product aa without any components
4. Now check the advance search 
      product a should show a1 as component but product aa shows b1 as its component and 
      prodct b shows c1 as component  and 
      product c shows no component.
Actual Results:  
Product component Mismatching 

Expected Results:  
There should not been any mismatch between product and component association. 

cpts and vers array population need to handle products with no compoents.
Comment 1 Max Kanat-Alexander 2011-01-02 22:46:08 PST
We probably won't fix this, since products with no components can't be used for anything in any part of Bugzilla.
Comment 2 Frédéric Buclin 2011-01-03 04:39:24 PST
Well, I'm rather surprised these products are listed in the search form. Products without components are excluded by get_enterable_products(), but not by get_selectable_products() which is used in query.cgi. We should fix it.
Comment 3 Frédéric Buclin 2011-02-23 11:23:25 PST
*** Bug 636084 has been marked as a duplicate of this bug. ***
Comment 4 Frédéric Buclin 2011-02-23 12:02:34 PST
Created attachment 514560 [details] [diff] [review]
workaround

Here is a workaround for query.cgi. Initially, I wanted to fix get_selectable_products() to exclude products with no components (thanks to INNER JOIN components), but the problem is that this method is called by some admin methods (such as Bugzilla::Version->create and Bugzilla::Miletone->create) and so these methods were throwing an error, complaining that the admin wasn't allowed to see this new product. So ideally, we would need check_can_admin_product() not call can_see_product(), but run its own query, without "INNER JOIN components". To avoid code duplication, this would mean some refactoring in User.pm. Not sure it worths the effort, though.
Comment 5 Frédéric Buclin 2011-02-23 12:03:51 PST
Also, note that this fix isn't needed in 4.1. It's working fine there.
Comment 6 Frédéric Buclin 2011-02-23 12:06:23 PST
(In reply to comment #5)
> Also, note that this fix isn't needed in 4.1. It's working fine there.

I take that back. This was working fine because I had classifications enabled. Else the problem is still present.
Comment 7 Chirag Raval 2011-02-23 19:59:27 PST
I have 10 Product and i did not have a component for the 2nd Product, Once i created a component this is working fine now.

Chirag
Comment 8 Frédéric Buclin 2011-04-10 15:23:44 PDT
*** Bug 648899 has been marked as a duplicate of this bug. ***
Comment 9 Frédéric Buclin 2011-06-02 09:33:19 PDT
*** Bug 660947 has been marked as a duplicate of this bug. ***
Comment 10 Andrej Dorusinec 2011-06-28 21:58:49 PDT
*** Bug 667903 has been marked as a duplicate of this bug. ***
Comment 11 Frédéric Buclin 2011-07-22 16:44:02 PDT
*** Bug 673582 has been marked as a duplicate of this bug. ***
Comment 12 Bernhard Merkle 2011-07-27 08:26:50 PDT
I also discovered this bug.
Please consider bug 674542 to avoid this.
I would prefer if checksetup.pl reports a warning/error if there are products without components. (as it makes no sense)
Comment 13 Bernhard Merkle 2011-07-27 08:30:28 PDT
sorry I meant sanitycheck.pl of course

s/checksetup.pl/sanitycheck.pl
Comment 14 Max Kanat-Alexander 2011-08-02 16:42:00 PDT
The ultimate solution here is to always create a default component called "General" (l10n-able) when creating a product and have it have the product creator as the default assignee.
Comment 15 Frédéric Buclin 2011-08-02 16:48:22 PDT
In bug 661476, I changed the "create a new product" UI to also let the admin create a component at the same time.
Comment 16 Max Kanat-Alexander 2011-08-02 18:20:51 PDT
(In reply to comment #15)
> In bug 661476, I changed the "create a new product" UI to also let the admin
> create a component at the same time.

  Okay. I'll respond over there.
Comment 17 Frédéric Buclin 2011-08-17 04:14:07 PDT
Comment on attachment 514560 [details] [diff] [review]
workaround

This workaround is enough. No need to hack the code even more for something which doesn't happen so often, and which is now caught by sanitycheck.cgi.
Comment 18 Max Kanat-Alexander 2011-08-25 14:45:18 PDT
Comment on attachment 514560 [details] [diff] [review]
workaround

Honestly, I don't even want to do this. I feel like agreeing to do this would also mean agreeing to do it everywhere else that it might cause a problem in the future, and I don't want to commit to that. I think the sanitycheck check is enough--my viewpoint is that if sanitycheck is failing, you can't expect Bugzilla to behave properly.
Comment 19 Max Kanat-Alexander 2011-08-25 14:47:04 PDT
  I would agree to put the workaround into the branches where the sanitycheck isn't going, though.
Comment 20 Frédéric Buclin 2011-08-25 14:48:43 PDT
(In reply to Max Kanat-Alexander from comment #19)
>   I would agree to put the workaround into the branches where the
> sanitycheck isn't going, though.

That's what I was going to suggest. :)
Comment 21 Max Kanat-Alexander 2011-08-25 16:09:07 PDT
Comment on attachment 514560 [details] [diff] [review]
workaround

Okay. r+ only for those branches, then. :-)
Comment 22 Frédéric Buclin 2011-08-26 07:57:30 PDT
OK, I will commit this patch for 4.0.3 and 4.2rc1 only. This patch is not needed for 5.0 thanks to bug 661476.
Comment 23 Frédéric Buclin 2011-08-27 02:34:41 PDT
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.2/
modified query.cgi
Committed revision 7912.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.0/
modified query.cgi
Committed revision 7646.
Comment 24 Frédéric Buclin 2011-12-22 14:07:59 PST
*** Bug 713098 has been marked as a duplicate of this bug. ***

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