Bug 1949960 - Error when invalid syntax is used in search field
Summary: Error when invalid syntax is used in search field
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Search
Version: 6.8.0
Hardware: All
OS: All
medium
medium
Target Milestone: 6.14.0
Assignee: Adam Ruzicka
QA Contact: Lukáš Hellebrandt
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-15 13:32 UTC by Kshitij
Modified: 2023-07-18 13:37 UTC (History)
11 users (show)

Fixed In Version: rubygem-scoped_search-4.1.11
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github wvanbergen scoped_search pull 217 0 None Merged Fix searching on set values when only the key is provided 2023-06-01 07:43:26 UTC
Red Hat Issue Tracker SAT-18019 0 None None None 2023-06-01 07:48:06 UTC

Description Kshitij 2021-04-15 13:32:59 UTC
Description of problem:

When filtering for 'snippet' on the Provisioning Templates page, the following error is displayed.

```
Oops, we're sorry but something went wrong wrong number of bind variables (0 for 1) in: (["(\"templates\".\"snippet\" <> ?)", false])
```


Version-Release number of selected component (if applicable):

6.8

How reproducible:


Steps to Reproduce:

1. Host >> Provisioning Temaplte.
2. In the search field, fill in exactly 'snippet' (without quotation marks)
3. Search

Actual results:

Error Oops, we're sorry but something went wrong wrong number of bind variables (0 for 1) in: (["(\"templates\".\"snippet\" <> ?)", false])



Expected results:

No error.

Comment 1 Marek Hulan 2021-04-15 13:54:16 UTC
While I agree the error shouldn't cause 500 error, the correct syntax to filter snippets in the search box is "snippet = true" or "snippet = false", because it's the attribute of the template object.

Comment 3 Steffen Froemer 2021-04-15 17:58:05 UTC
(In reply to Marek Hulan from comment #1)
> While I agree the error shouldn't cause 500 error, the correct syntax to
> filter snippets in the search box is "snippet = true" or "snippet = false",
> because it's the attribute of the template object.

I would agree, if this would be the case for any attribute/search criteria.

I easily can use 'vendor' or 'template' and will get a result. This applies to many other criteria as well.
But for 'default_template', 'locked' the error is same as for snippet.

So this should be handled in a good manner, without showing any error (or even not 500)

Comment 4 Kshitij 2021-07-21 00:52:51 UTC
Hello Team,

The customer is looking for updates on this Bugzilla?

Do we have an ETA for this?

Comment 5 Marek Hulan 2021-07-21 07:33:32 UTC
No update on better handling the 500 errors on invalid syntax. The searching works.

Comment 6 Marek Hulan 2021-07-21 07:34:56 UTC
I also renamed the BZ to better describe the issue and moved it to the component that fits better.

Comment 8 Brad Buckingham 2023-05-08 12:47:51 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in a month. This message may be a repeat of a previous update and the bug is again being considered to be closed. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 10 Brad Buckingham 2023-06-12 23:21:45 UTC
Fix submitted upstream; therefore, bugzilla will not be closed via auto-closure.

Comment 11 Lukáš Hellebrandt 2023-07-18 12:49:11 UTC
Verified with Sat 6.14.0. snap 6.0.

Let "content" be any field in the template, like "name" or "description".

Searching in Hosts -> Provisioning templates:
0) snippet => all snippets
1) !snippet => all non-snippets
2) "snippet" => somewhat counter-intuitively all snippets but I could let this pass
3) "!snippet" => nothing, only would return whatever contains "!snippet" in its content - this is inconsistent with 2) where "snippet" is interpreted as "value of 'snippet' field is true"
4) name ~ snippet => all templates that contain "snippet" in their content
5) default => snippets with "default" in their content
6) default_template => templates marked as default
7) "default" => same as 5)
8) "default_template" => same as 6)
9) default_template = true => same as 7)
10) "!default_template" => nothing, again inconsistently with 8), the same issue as with 3)



Adam, look at 3) and 8) and let me know if you consider it a bug. I am inclined to consider it a very minor bug.

Comment 12 Adam Ruzicka 2023-07-18 13:37:08 UTC
It definitely doesn't feel right, but at the same time, I don't think we have the capacity to resolve that in the foreseeable future. Considering scoped_search is a third party project, how about we report it as an issue there so it doesn't get lost and in the best case, we'll get the fix for free?


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