Bug 1949960

Summary: Error when invalid syntax is used in search field
Product: Red Hat Satellite Reporter: Kshitij <kupadhya>
Component: SearchAssignee: Adam Ruzicka <aruzicka>
Status: CLOSED ERRATA QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.8.0CC: afeferku, apatel, aruzicka, Il-linux.adminext, kgaikwad, lhellebr, mhulan, mkushwah, pcreech, rlavi, sfroemer
Target Milestone: 6.14.0Keywords: Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: rubygem-scoped_search-4.1.11 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-08 14:17:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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?

Comment 15 errata-xmlrpc 2023-11-08 14:17:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.14 security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:6818