[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Broken Eprints filter function



Hi Stefan,

I think I have experienced a similar problem in the past.  Are you using MariaDB, which is a fork or MySQL rather than MySQL itself?  If so there is this known issue which would lead to the problem you report:

https://mariadb.com/kb/en/library/why-is-order-by-in-a-from-subquery-ignored/<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmariadb.com%2Fkb%2Fen%2Flibrary%2Fwhy-is-order-by-in-a-from-subquery-ignored%2F&data=01%7C01%7C%7C6605e59ef0a64bbe5a1e08d685e590e7%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&sdata=g3uO4fIcbSe0udu496PquGNhaARYKM1hG69Cor8IeC4%3D&reserved=0>

I have made a change to perl_lib/EPrints/Database/mysql.pm to fix this (around line 399):



-        $sql .= " FROM ($select_sql) ".$self->quote_identifier( "S" );

+        # MariaDB does not order sub-queries unless limited. Using limit of 2^31-1 in case any system is using a signed 32-bit integer.

+ my $limit = " LIMIT 2147483647"; +        $limit = "" if $select_sql =~ /LIMIT/; +        $sql .= " FROM ($select_sql$limit) ".$self->quote_identifier( "S" );


Reviewing this now, the regex check for if LIMIT is set is a little
hacky, so it may be worth checking for / LIMIT / rather than just
/LIMIT/ to rule out any chance that a search term that includes the
sub-string LIMIT might getting passed through.  However, I think it is likely that
any search terms would have already been lower-cased before this point.

They will certainly be quoted as individual words, so / LIMIT / will definitively

check if the SQL LIMIT subcommand is already used.


Regards


David Newman




On Tue, 2019-01-29 at 11:58 +0000, Stefan Wellsandt via Eprints-tech wrote:
Hello,

I encountered a problem with the filter function in the ?Manage Eprints? administrator interface of our institute?s repository (v3.3). Typically, I would be able to filter by id, name or any of the columns I visualize (works for users, for instance).
However, for some reason it does not work for Eprints. I can filter by ID, but any of the other filters shows no effect. I assume I changed some configuration to make it break. Has anyone an idea, which configuration file could be the cause of this behavior?

Best regards
Stefan

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&data=01%7C01%7C%7C6605e59ef0a64bbe5a1e08d685e590e7%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&sdata=IUspdm3BXwHaO0MLkx80RTQ0%2BHzJxUF2gs2c3lbb3%2F8%3D&reserved=0>
*** EPrints community wiki: http://wiki.eprints.org/<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&data=01%7C01%7C%7C6605e59ef0a64bbe5a1e08d685e590e7%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&sdata=9KlNNc%2FuqnbKDjKWMF55UftXFd8UzyBaK%2FWfOg%2B58dM%3D&reserved=0>
*** EPrints developers Forum: http://forum.eprints.org/<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fforum.eprints.org%2F&data=01%7C01%7C%7C6605e59ef0a64bbe5a1e08d685e590e7%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&sdata=RzgoNdohlVFlUYT8c7dDggT6OyIL2SH5cN8YJksFfnU%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20190129/c823e3cf/attachment.html