Hi Jakob,

Since you have an active MarkLogic Technical Support account, can you create a 
support ticket for this?.  Our Support team can look into the regression and 
file an RFE on your behalf.

Thanks,
Rick Pelton
Director, Global Support Services
MarkLogic Corporation
www.marklogic.com<http://www.marklogic.com/>


From: [email protected] 
[mailto:[email protected]] On Behalf Of Jakob Fix
Sent: Wednesday, February 03, 2016 9:14 AM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] fn:error bug?

Hello,

we've discovered the following issue in the latest release (8.0-4.2) on 
Windows: execute the following one-liner will throw an error in the qconsole 
(but not in the ErrorLog.txt):

xquery version "1.0-ml"; (: same with "1.0" :)
fn:error(xs:QName('err'), ' "a-b" ')

=> File status error: GetFileAttributes 'C:\Program Files\MarkLogic\Messages\ 
"a-en_US.xml': The filename, directory name, or volume label syntax is 
incorrect.

Interestingly, execute it again, and it will be fine, in the sense that the 
expected error is raised. (To reproduce the error again, you'll have to restart 
the server.) This seems to be a regression from version 7 that we noticed when 
upgrading to 8.

From what we understand it seems like a string/regex parse/escape problem where 
a string consisting of a space followed by a double quote followed by some 
characters followed by a hyphen is not correctly parsed and escaped, and for 
some reason it then attempts to load the corresponding error class message file 
in the default locale message file, in this case supposedly called ' 
"a-en_US.xml"'.

The full message is shown in a popup and contains this (running this in the 
qconsole, we suppose that the error itself is caught and therefore doesn't end 
up in the ErrorLog.txt file, even with level set to finest):

SVC-FILSTAT: let $set := amped-common:appservices-expire-headers() let 
$params-map := rest:process-request($http-opts) let $action := 
map:get($params-map, "action") let $qid := map:get($params-map, "qid") let 
$name := map:get($params-map, "name") let $active := map:get($params-map, 
"active") let $focus := map:get($params-map, "focus") let $mode := 
fn:lower-case(map:get($params-map, "mode")) let $content-source := 
map:get($params-map, "content-source") let $wsid := map:get($params-map, 
"wsid") let $sid := map:get($params-map, "sid") let $dbid := 
map:get($params-map, "dbid") let $crid := map:get($params-map, "crid") let 
$query-type := map:get($params-map, "querytype") let $query-text := 
xdmp:get-request-body("text") let $sql-query := "import module namespace 
amped-qconsole = "http://marklogic...."; let $sparql-query := "import module 
namespace amped-qconsole = "http://marklogic...."; let $sparql-update-query := 
"import module namespace amped-qconsole = "http://marklogic...."; return if 
(fn:exists($qid) and fn:not(qconsole-model:is-query-found($qid))) then let $msg 
:= fn:concat("Query with this ID ", $qid, " does not exist") let $code := 
xdmp:set-response-code(404, $msg) return json:transform-to-json-string({ $msg 
}, json:config("custom")) else let $query := $query-text let $new-query := if 
(fn:empty($qid) and $wsid) then let $new-query := 
amped-qconsole:qconsole-eval("import module namespace qconsole-model = 
"http://marklogic....";, (fn:QName("","wsid"), $wsid), ()) return xdmp:set($qid, 
$new-query/id) else () let $eval-opts := if ($sid or $dbid) then 
amped-qconsole:qconsole-get-eval-options($sid, $dbid, fn:true()) else () let 
$result := if ($action eq "eval") then if ($query-type eq "xquery") then 
(qceval:do-eval($qid, $query, "", $eval-opts, $query-type), 
qceval:replica-database-set-response-message($sid, $dbid)) else if ($query-type 
eq "sql") then (qceval:do-eval($qid, $query, $sql-query, $eval-opts, 
$query-type), qceval:replica-database-set-response-message($sid, $dbid)) else 
if ($query-type eq "sparql") then (qceval:do-eval($qid, $query, $sparql-query, 
$eval-opts, $query-type), qceval:replica-database-set-response-message($sid, 
$dbid)) else if ($query-type eq "sparql-update") then (qceval:do-eval($qid, 
$query, $sparql-update-query, $eval-opts, $query-type), 
qceval:replica-database-set-response-message($sid, $dbid)) else () else if 
($action eq "profile") then if ($query-type eq "xquery") then 
(qceval:do-profile($qid, $query, "", $eval-opts, $query-type), 
qceval:replica-database-set-response-message($sid, $dbid)) else if ($query-type 
eq "sql") then (qceval:do-profile($qid, $query, $sql-query, $eval-opts, 
$query-type), qceval:replica-database-set-response-message($sid, $dbid)) else 
if ($query-type eq "sparql") then (qceval:do-profile($qid, $query, 
$sparql-query, $eval-opts, $query-type), 
qceval:replica-database-set-response-message($sid, $dbid)) else if ($query-type 
eq "sparql-update") then (qceval:do-profile($qid, $query, $sparql-update-query, 
$eval-opts, $query-type), qceval:replica-database-set-response-message($sid, 
$dbid)) else () else if ($action eq "cancel") then qceval:do-cancel($crid) else 
() return $result -- File status error: GetFileAttributes 'C:\Program 
Files\MarkLogic\Messages\ "a-en_US.xml': The filename, directory name, or 
volume label syntax is incorrect.

So, MarkLogic seems to parse the $message argument which is supposed to hold a 
localisable string, but which apparently it thinks contains an error family 
code like XDMP or PKG ....  (which I guess would be more appropriate in the 
first argument).  This reminds me that it seems that MarkLogic is traditionally 
not using the XPath standard way of error reporting as raised by @mblakele 
here: https://github.com/robwhitby/xray/pull/11

Quote: "leave arg1 empty, put the code in arg2, and put anything else into 
arg3" and @robwhitby answering that it "doesn't seem to match the spec 
http://www.w3.org/TR/xpath-functions/#func-error";

I guess it's rather late in the game, but would MarkLogic consider an RFE that 
requests to conform to the XPath specification for fn:error?

cheers,
Jakob.
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to