GNOME Bugzilla – Bug 796811
browse.cgi does not work if a project is closed for new bug entry
Last modified: 2019-02-27 09:34:30 UTC
Visit the URL: https://bugzilla.gnome.org/page.cgi?id=browse.html&product=epiphany I see this error message: "Sorry, entering a bug into the product epiphany has been disabled." But I'm just trying to view existing bugs, not report a new one.
I guess someone needs to understand and fix https://gitlab.gnome.org/Infrastructure/bugzilla-gnome-org-customizations/blob/master/extensions/Browse/lib/Util.pm#L199 : # We need to check and make sure that the user has permission # to enter a bug against this product. $user->can_enter_product($product ? $product->name : $product_name, THROW_ERROR); I have no idea why that check is in place.
(In reply to André Klapper from comment #1) > I guess someone needs to understand and fix > https://gitlab.gnome.org/Infrastructure/bugzilla-gnome-org-customizations/ > blob/master/extensions/Browse/lib/Util.pm#L199 : > > # We need to check and make sure that the user has permission > # to enter a bug against this product. > $user->can_enter_product($product ? $product->name : $product_name, > THROW_ERROR); > > I have no idea why that check is in place. Are there any easy ways to check that what we would be changing works here?
(In reply to Bastien Nocera from comment #2) > Are there any easy ways to check that what we would be changing works here? Disabling that one line allows viewing the Browse page of products disabled for new bug entry, but it also triggers the error message Can't call method "name" on an undefined value at /loader/0x55da7a33afb8/Bugzilla/Extension/Browse/Util.pm line 204. when entering a product name which does not exist, such as https://bugzilla.gnome.org/page.cgi?id=browse.html&product=nonexisting I've just installed Bugzilla locally, so if anyone knows Perl, wants to take a look at https://gitlab.gnome.org/Infrastructure/bugzilla-gnome-org-customizations/blob/master/extensions/Browse/lib/Util.pm#L199 and has an idea / patch, I'd be happy to test locally.
Created attachment 374203 [details] [review] patch Probably this helps getting past that error when commenting the user permission check out, I have no idea if it makes sense to disable on all circumstances (I guess it's safe to do so).
Created attachment 374204 [details] Check for "if($product)" in way too many places down the road, but works locally Thanks for the pointer.
Created attachment 374205 [details] [review] patch Maybe this is a bit easier? :) AFAIU the !$product thing happens if the product is unknown or if there's multiple components, not sure we can do without the latter.
Heh, I appreciate input by folks who are actually developers. :P Applying your last patch I get "Undefined subroutine &Bugzilla::Extension::Browse::Util::ThrowUserError called at /loader/0x55ed4a7aac80/Bugzilla/Extension/Browse/Util.pm line 205." when passing a product name which does not exist. (It works for existing products though.)
Hmm, not sure with just reading the code... AFAICS that ThrowUserError() is used in a couple of places above in the same _page_browse function. Somehow those paths are also broken? I think replacing the ThrowUserError() call with the line we just commented would handle invalid products prettily, like: if (!$product) { $user->can_enter_product(...) } Anyway, it seems like you have working patch :), so I won't deter anymore. This taps into bugzilla APIs which I just don't know.
In theory this should be fixed by https://gitlab.gnome.org/Infrastructure/bugzilla-gnome-org-customizations/commit/60cb5f612ca14d0cfae4a47435dadcd47a7e87a1 In practice I'm waiting for production to pick up the change.
Works now.
<3