Closed Bug 269398 Opened 20 years ago Closed 20 years ago

request.cgi fails with error in SQL when no products available for user

Categories

(Bugzilla :: Bugzilla-General, defect)

2.18
defect
Not set
critical

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: sergey, Assigned: LpSolit)

References

Details

Attachments

(1 file)

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686) Opera 7.54  [ru]
Build Identifier: 

This happens when all products restricted to their groups (selected 'Entry' and 
'Canedit') and a user that don't belongs to any of this groups attemps to query 
'My requests'. request.cgi does't handle situation when no products returned by 
query.

DBD::mysql::st execute failed: You have an error in your SQL syntax.  Check the 
manual that corresponds to your MySQL server version for the right syntax to use 
near ') ORDER BY name' at line 1 [for Statement "SELECT name, product_id FROM 
components WHERE product_id IN () ORDER BY name"] at Bugzilla/DB.pm line 62
        Bugzilla::DB::SendSQL('SELECT name, product_id FROM components WHERE 
product_id IN (...') called at globals.pl line 592
        main::GetSelectableProductHash() called at /var/www/html/bugzilla/
request.cgi line 263
        main::queue() called at /var/www/html/bugzilla/request.cgi line 50

Reproducible: Always
Steps to Reproduce:
1.For each product in Group Access Controls set 'Entry' and 'Canedit' flags.
2.Login as user that don't belongs to any of this groups.
3.Press 'My requests' link




This affects version 2.18rc3
Version: unspecified → 2.18
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking2.18?
OS: Linux → All
Hardware: PC → All
Flags: blocking2.20?
Flags: blocking2.20?
Flags: blocking2.20+
Flags: blocking2.18?
Flags: blocking2.18+
Target Milestone: --- → Bugzilla 2.18
crash on page linked direct from main menu = critical
Severity: normal → critical
I think I have found the reason, see globals.pl line 626:

GetSelectableProducts(1) returns an empty list if the user cannot access any
product. But then, we request components, versions and milestones without
checking first if the product list is empty or not, so that we have something
like "WHERE product_id IN () ORDER BY...".

I think this is the reason why we get this error. I will check now and submit a
patch in a few minutes if I'm right.
Whiteboard: bug awaiting patch
This solves the problem for me.
Assignee: justdave → LpSolit
Status: NEW → ASSIGNED
Attachment #168412 - Flags: review?
Whiteboard: bug awaiting patch → patch awaiting review
Comment on attachment 168412 [details] [diff] [review]
checks the number of products available

diff -w shows a one-liner on this patch :-)

This indeed solves the crash. r=vladd

We could as a nit display: no products available so can't query for requests,
but that's a nit and the important thing here, 2.18 blocking wise, is so solve
the crash.
Attachment #168412 - Flags: review? → review+
Flags: approval?
Flags: approval2.18?
Whiteboard: patch awaiting review → patch awaiting approval
Flags: approval?
Flags: approval2.18?
Flags: approval2.18+
Flags: approval+
Checking in globals.pl;
/cvsroot/mozilla/webtools/bugzilla/globals.pl,v  <--  globals.pl
new revision: 1.270.2.3; previous revision: 1.270.2.2
done

Checking in globals.pl;
/cvsroot/mozilla/webtools/bugzilla/globals.pl,v  <--  globals.pl
new revision: 1.278; previous revision: 1.277
done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Whiteboard: patch awaiting approval
*** Bug 232669 has been marked as a duplicate of this bug. ***
*** Bug 252373 has been marked as a duplicate of this bug. ***
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: