reva
reva copied to clipboard
shares created through the OC-10 GUI look invalid in the DB
>> ocm-share-list
+---+-----------+----------------+------------+----------------------+--------------------+-------------+------------------+-------------------------------+-------------------------------+
| # | OWNER.IDP | OWNER.OPAQUEID | RESOURCEID | TYPE | SHARETYPE | GRANTEE.IDP | GRANTEE.OPAQUEID | CREATED | UPDATED |
+---+-----------+----------------+------------+----------------------+--------------------+-------------+------------------+-------------------------------+-------------------------------+
| 1 | | | <nil> | GRANTEE_TYPE_INVALID | SHARE_TYPE_INVALID | | | 1970-01-01 00:00:00 +0000 UTC | 1970-01-01 00:00:00 +0000 UTC |
+---+-----------+----------------+------------+----------------------+--------------------+-------------+------------------+-------------------------------+-------------------------------+
When deleting that share through the GUI and then creating one through Reva CLI I see:
>> ocm-share-create -idp revaowncloud2.docker -grantee marie /home/qwer
+-----+----------------------+----------------+-------------------------------------------------------+-------------------+----------------------+------------------+-------------------------------+-------------------------------+
| # | OWNER.IDP | OWNER.OPAQUEID | RESOURCEID | TYPE | GRANTEE.IDP | GRANTEE.OPAQUEID | CREATED | UPDATED |
+-----+----------------------+----------------+-------------------------------------------------------+-------------------+----------------------+------------------+-------------------------------+-------------------------------+
| "2" | revaowncloud1.docker | einstein | storage_id:"nextcloud" opaque_id:"fileid-/home/qwer" | GRANTEE_TYPE_USER | revaowncloud2.docker | marie | 2023-08-31 09:05:55 +0000 UTC | 2023-08-31 09:05:55 +0000 UTC |
+-----+----------------------+----------------+-------------------------------------------------------+-------------------+----------------------+------------------+-------------------------------+-------------------------------+
>> ocm-share-list
error: code=CODE_INTERNAL msg="error listing shares" support_trace="189f6a1b5aae32418edaa8d0a839cc13"
>>
[Thu Aug 31 09:05:55.647318 2023] [php7:notice] [pid 1315] [client 172.18.0.11:60884] revaPathToEfssPath: Interpreting /home/qwer as qwer
[Thu Aug 31 09:05:55.647556 2023] [php7:notice] [pid 1315] [client 172.18.0.11:60884] calling newShare
[Thu Aug 31 09:05:55.650518 2023] [php7:notice] [pid 1315] [client 172.18.0.11:60884] SMSP: createInternal
[Thu Aug 31 09:05:55.650529 2023] [php7:notice] [pid 1315] [client 172.18.0.11:60884] shareWith [email protected]
[Thu Aug 31 09:05:55.650537 2023] [php7:notice] [pid 1315] [client 172.18.0.11:60884] checking if already shared qwer
172.18.0.11 - - [31/Aug/2023:09:06:07 +0000] "POST /index.php/apps/sciencemesh/~einstein/api/storage/ListFolder HTTP/1.1" 404 2644 "-" "Go-http-client/1.1"
[Thu Aug 31 09:06:07.931621 2023] [php7:notice] [pid 1312] [client 172.18.0.11:37632] RevaController init for user 'einstein'
[Thu Aug 31 09:06:07.931951 2023] [php7:notice] [pid 1312] [client 172.18.0.11:37632] checkRevadAuth
[Thu Aug 31 09:06:07.931988 2023] [php7:notice] [pid 1312] [client 172.18.0.11:37632] root folder absolute path '/'
[Thu Aug 31 09:06:07.939059 2023] [php7:notice] [pid 1312] [client 172.18.0.11:37632] user folder '/einstein/files'
[Thu Aug 31 09:06:07.939100 2023] [php7:notice] [pid 1312] [client 172.18.0.11:37632] revaPathToEfssPath: Interpreting /home as /home
[Thu Aug 31 09:06:07.952732 2023] [php7:notice] [pid 1312] [client 172.18.0.11:37632] ListFolder: /home
[Thu Aug 31 09:06:07.952755 2023] [php7:notice] [pid 1312] [client 172.18.0.11:37632] ListFolder: path not found
172.18.0.11 - - [31/Aug/2023:09:06:09 +0000] "POST /index.php/apps/sciencemesh/~einstein/api/ocm/ListShares HTTP/1.1" 500 9393 "-" "Go-http-client/1.1"
{"reqId":"Q5nb1iX5zxo7hxBSoLzu","level":3,"time":"2023-08-31T09:06:09+00:00","remoteAddr":"172.18.0.11","user":"--","app":"index","method":"POST","url":"\/index.php\/apps\/sciencemesh\/~einstein\/api\/ocm\/ListShares","message":"Exception: {\"Exception\":\"OCP\\\\Files\\\\NotFoundException\",\"Message\":\"\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/html\\\/apps\\\/sciencemesh\\\/lib\\\/Controller\\\/RevaController.php(327): OC\\\\Share20\\\\Share->getNode()\\n#1 \\\/var\\\/www\\\/html\\\/apps\\\/sciencemesh\\\/lib\\\/Controller\\\/RevaController.php(1428): OCA\\\\ScienceMesh\\\\Controller\\\\RevaController->shareInfoToCs3Share()\\n#2 \\\/var\\\/www\\\/html\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(169): OCA\\\\ScienceMesh\\\\Controller\\\\RevaController->ListSentShares()\\n#3 \\\/var\\\/www\\\/html\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(89): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController()\\n#4 \\\/var\\\/www\\\/html\\\/lib\\\/private\\\/AppFramework\\\/App.php(99): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch()\\n#5 \\\/var\\\/www\\\/html\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main()\\n#6 \\\/var\\\/www\\\/html\\\/lib\\\/private\\\/Route\\\/Router.php(344): OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke()\\n#7 \\\/var\\\/www\\\/html\\\/lib\\\/base.php(913): OC\\\\Route\\\\Router->match()\\n#8 \\\/var\\\/www\\\/html\\\/index.php(54): OC::handleRequest()\\n#9 {main}\",\"File\":\"\\\/var\\\/www\\\/html\\\/lib\\\/private\\\/Share20\\\/Share.php\",\"Line\":172}"}
[Thu Aug 31 09:06:09.576077 2023] [php7:notice] [pid 1312] [client 172.18.0.11:37632] ListSentShares
[Thu Aug 31 09:06:09.577132 2023] [php7:notice] [pid 1312] [client 172.18.0.11:37632] RevaController init for user 'einstein'
[Thu Aug 31 09:06:09.577151 2023] [php7:notice] [pid 1312] [client 172.18.0.11:37632] checkRevadAuth
[Thu Aug 31 09:06:09.577187 2023] [php7:notice] [pid 1312] [client 172.18.0.11:37632] root folder absolute path '/'
[Thu Aug 31 09:06:09.583234 2023] [php7:notice] [pid 1312] [client 172.18.0.11:37632] user folder '/einstein/files'
So here I see two lines that don't look compatible with each other:
revaPathToEfssPath: Interpreting /home/qwer as qwerrevaPathToEfssPath: Interpreting /home as /home
Yes, that has happened since: https://github.com/MahdiBaghbani/nc-sciencemesh/blob/0857131488dfb1e29b927ebded1205f587c5770a/lib/Controller/RevaController.php#L36
The Reva path prefix is REVA_PREFIX = /home/
Related issue: https://github.com/pondersource/sciencemesh-php/issues/96
>> ls /home
error: code=CODE_NOT_FOUND msg="path not found when listing container" support_trace="73563d382bbdb815507c267782c5c106"
>> ls /home/
error: code=CODE_NOT_FOUND msg="path not found when listing container" support_trace="01d0f4b25c44dc38dfb5be07c1a0ed02"
>> ls /home/qwer
>>
Would this be OK?
REVA_PREFIX = "/home"
private function revaPathToEfssPath($revaPath)
{
$ret = $this->removePrefix($revaPath, REVA_PREFIX);
$ret = EFSS_PREFIX . $this->removePrefix($ret, "/");
error_log("revaPathToEfssPath: Interpreting $revaPath as $ret");
return $ret;
}
That would be correct but I would prefer (for readability)
private function revaPathToEfssPath($revaPath)
{
if ("$revaPath/" == REVA_PREFIX) {
error_log("revaPathToEfssPath: Interpreting special case $revaPath as ''");
return '';
}
$ret = $this->removePrefix($revaPath, REVA_PREFIX);
error_log("revaPathToEfssPath: Interpreting $revaPath as $ret");
return $ret;
}
the ls /home bug is fixed now by ec996f64e4befb0dfca875f316a931fd7a6a8b05 + 6dbbad00fdae4d3fdd91c389eff6cd2cbf731f81 + 19d0dc2cfd48fc2a7cd1451364fb89310fd2aad2:
>> ls /home/
qwer
welcome.txt
>> ls /home
qwer
welcome.txt
>> ls /home/qwer
>>
I'll keep this ticket open to deal with the original error