After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 796811 - browse.cgi does not work if a project is closed for new bug entry
browse.cgi does not work if a project is closed for new bug entry
Status: RESOLVED FIXED
Product: bugzilla.gnome.org
Classification: Infrastructure
Component: general
unspecified
Other Linux
: Normal critical
: ---
Assigned To: André Klapper
Bugzilla Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-07-14 16:37 UTC by Michael Catanzaro
Modified: 2019-02-27 09:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (849 bytes, patch)
2019-02-26 10:38 UTC, Carlos Garnacho
none Details | Review
Check for "if($product)" in way too many places down the road, but works locally (21.57 KB, text/plain)
2019-02-26 14:48 UTC, André Klapper
  Details
patch (1.02 KB, patch)
2019-02-26 15:13 UTC, Carlos Garnacho
none Details | Review

Description Michael Catanzaro 2018-07-14 16:37:02 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.
Comment 1 André Klapper 2018-07-16 13:03:34 UTC
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.
Comment 2 Bastien Nocera 2018-12-09 13:14:53 UTC
(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?
Comment 3 André Klapper 2019-02-26 06:37:17 UTC
(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.
Comment 4 Carlos Garnacho 2019-02-26 10:38:20 UTC
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).
Comment 5 André Klapper 2019-02-26 14:48:40 UTC
Created attachment 374204 [details]
Check for "if($product)" in way too many places down the road, but works locally

Thanks for the pointer.
Comment 6 Carlos Garnacho 2019-02-26 15:13:57 UTC
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.
Comment 7 André Klapper 2019-02-26 15:28:19 UTC
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.)
Comment 8 Carlos Garnacho 2019-02-26 16:31:51 UTC
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.
Comment 9 André Klapper 2019-02-27 00:13:22 UTC
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.
Comment 10 André Klapper 2019-02-27 09:32:45 UTC
Works now.
Comment 11 Alexandre Franke 2019-02-27 09:34:30 UTC
<3