Product and component mismatch , a product without any component gets component of other projects in advance search

RESOLVED FIXED in Bugzilla 4.0

Status

()

Bugzilla
Query/Bug List
P4
minor
RESOLVED FIXED
7 years ago
6 years ago

People

(Reporter: Digambar, Assigned: Frédéric Buclin)

Tracking

Bugzilla 4.0
Bug Flags:
approval4.2 +
approval4.0 +

Details

Attachments

(1 attachment)

656 bytes, patch
Max Kanat-Alexander
: review+
Details | Diff | Splinter Review
(Reporter)

Description

7 years ago
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

7 years ago
We probably won't fix this, since products with no components can't be used for anything in any part of Bugzilla.
Priority: -- → P5
(Assignee)

Comment 2

7 years ago
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.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
Priority: P5 → P4
Hardware: x86 → All
Version: unspecified → 4.0
(Assignee)

Updated

7 years ago
Duplicate of this bug: 636084
(Assignee)

Comment 4

7 years ago
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.
(Assignee)

Comment 5

7 years ago
Also, note that this fix isn't needed in 4.1. It's working fine there.
(Assignee)

Comment 6

7 years ago
(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

7 years ago
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
(Assignee)

Updated

6 years ago
Duplicate of this bug: 648899
(Assignee)

Updated

6 years ago
Duplicate of this bug: 660947

Updated

6 years ago
Duplicate of this bug: 667903
(Assignee)

Updated

6 years ago
Duplicate of this bug: 673582

Comment 12

6 years ago
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

6 years ago
sorry I meant sanitycheck.pl of course

s/checksetup.pl/sanitycheck.pl
(Assignee)

Updated

6 years ago
Depends on: 661476

Comment 14

6 years ago
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.
(Assignee)

Comment 15

6 years ago
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

6 years ago
(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.
(Assignee)

Comment 17

6 years ago
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.
Attachment #514560 - Flags: review?(mkanat)

Comment 18

6 years ago
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.
Attachment #514560 - Flags: review?(mkanat) → review-

Comment 19

6 years ago
  I would agree to put the workaround into the branches where the sanitycheck isn't going, though.
(Assignee)

Comment 20

6 years ago
(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

6 years ago
Comment on attachment 514560 [details] [diff] [review]
workaround

Okay. r+ only for those branches, then. :-)
Attachment #514560 - Flags: review- → review+
(Assignee)

Comment 22

6 years ago
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.
Assignee: query-and-buglist → LpSolit
Status: NEW → ASSIGNED
Flags: approval4.2+
Flags: approval4.0+
Target Milestone: --- → Bugzilla 4.0
(Assignee)

Comment 23

6 years ago
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.
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
(Assignee)

Updated

6 years ago
Duplicate of this bug: 713098
You need to log in before you can comment on or make changes to this bug.