Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iquest cannot match names containing apostrophes via = operator if it's not the last condition in the where clause #5727

Closed
2 tasks done
lwesterhof opened this issue Jul 2, 2021 · 3 comments
Assignees
Milestone

Comments

@lwesterhof
Copy link

lwesterhof commented Jul 2, 2021

  • main
  • 4-3-stable

Bug Report

iRODS Version, OS and Version

iRODS v4.2.9
CentOS 7

What did you try to do?

Query for data objects in collections with an apostrophe. (A special case of #4887)

Observed behavior (including steps to reproduce, if applicable)

We have a collection (lazlo's test) with two data objects (lazlo's file and yoda-metadata.json):

bash-4.2$ iquest "select DATA_NAME, COLL_NAME where COLL_NAME = '/tempZone/home/research-initial/lazlo's test'"
DATA_NAME = lazlo's file
COLL_NAME = /tempZone/home/research-initial/lazlo's test
------------------------------------------------------------
DATA_NAME = yoda-metadata.json
COLL_NAME = /tempZone/home/research-initial/lazlo's test
------------------------------------------------------------

Querying for yoda-metadata.json works fine when the collection name (with apostrophe) is the last condition in the where clause:

bash-4.2$ iquest "select DATA_NAME, COLL_NAME where DATA_NAME = 'yoda-metadata.json' AND COLL_NAME = '/tempZone/home/research-initial/lazlo's test'"
DATA_NAME = yoda-metadata.json
COLL_NAME = /tempZone/home/research-initial/lazlo's test

The query does not work when the collection name is not the latest condition in the where clause:

bash-4.2$ iquest "select DATA_NAME, COLL_NAME where COLL_NAME = '/tempZone/home/research-initial/lazlo's test' AND DATA_NAME = 'yoda-metadata.json'"
CAT_NO_ROWS_FOUND: Nothing was found matching your query

Quering for a data object with an apostrophe inside the collection with an apostrophe returns no results:

bash-4.2$ iquest "select DATA_NAME, COLL_NAME where DATA_NAME = 'lazlo's file' AND COLL_NAME = '/tempZone/home/research-initial/lazlo's test'"
CAT_NO_ROWS_FOUND: Nothing was found matching your query
bash-4.2$ iquest "select DATA_NAME, COLL_NAME where COLL_NAME = '/tempZone/home/research-initial/lazlo's test' and DATA_NAME = 'lazlo's file'"
CAT_NO_ROWS_FOUND: Nothing was found matching your query
@alanking
Copy link
Contributor

I ran into this inadvertently via a genquery being used internally for the creation of data objects (#5759).

This will possibly be solved via a new GenQuery parser implementation which has been in the works for some time now, but I'm just noting that this has been reproduced and can lead to some pretty subtle bugs.

@korydraughn korydraughn self-assigned this Aug 18, 2021
@korydraughn korydraughn added this to the 4.2.11 milestone Aug 18, 2021
@trel trel modified the milestones: 4.2.11, 4.3.0 Sep 28, 2021
@alanking alanking modified the milestones: 4.3.0, 4.3.1 Apr 4, 2022
@alanking alanking modified the milestones: 4.3.1, 4.3.2 Dec 2, 2022
lwesterhof added a commit to UtrechtUniversity/yoda-ruleset that referenced this issue Dec 22, 2022
This is a workaround for irods/irods#5727

Co-authored-by: Lazlo Westerhof <l.r.westerhof@uu.nl>
@korydraughn
Copy link
Collaborator

Related #3902.

@korydraughn
Copy link
Collaborator

This situation is resolved by the GenQuery2 parser (#7570). See the following:

$ iquery "select DATA_NAME, COLL_NAME where COLL_NAME = '/tempZone/home/rods/lazlo\x27s test' and DATA_NAME = 'lazlo\x27s file'" | jq
[
  [
    "lazlo's file",
    "/tempZone/home/rods/lazlo's test"
  ]
]

A test capturing this is all that is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants