Skip to content

shareAccessByID tests fail on pgsql 10.3 #39868

Closed

Description

@phil-davis

PR #39865
https://drone.owncloud.com/owncloud/core/34881/70/13

runsh: Total unexpected failed scenarios throughout the test run:
apiShareOperationsToShares2/shareAccessByID.feature:50
apiShareOperationsToShares2/shareAccessByID.feature:51
apiShareOperationsToShares2/shareAccessByID.feature:52
apiShareOperationsToShares2/shareAccessByID.feature:53

These scenarios fail against pgsql 10.3 - see PR
And they fail with pgsql 10.20 - #39865 (comment)
But they pass in regular CI with mariaDb.

IMO that used to pass, so there might be a regression.

These are scenarios that send an invalid share-id to try and get share information. The examples with a non-numeric invalid share-id get a 500 response rather than a 404. "something happens" (tm) with processing that with pgsql database.

Activity

  1. individual-it commented on Mar 11, 2022

    @individual-it
    Member

    need some git-bisect here

  2. kiranparajuli589 commented on Mar 11, 2022

    @kiranparajuli589
    Contributor

    according to git bisect:

    f95c3625cad1456374f1be7341d5936f063f148b is the first bad commit
    commit f95c3625cad1456374f1be7341d5936f063f148b
    Merge: 510f5c79c0 84df91ad7e
    Author: Dipak Acharya <[email protected]>
    Date:   Wed May 26 13:45:45 2021 +0545
    
        Merge pull request #38757 from owncloud/test-share-id-access
        
        [Tests-Only] add api tests for accessing shares by id
    
     .../shareAccessByID.feature                        |  68 +++++++++
     .../shareAccessByID.feature                        | 155 +++++++++++++++++++++
     .../features/bootstrap/FeatureContext.php          |   8 ++
     tests/acceptance/features/bootstrap/Sharing.php    |  66 +++++++++
     4 files changed, 297 insertions(+)
     create mode 100644 tests/acceptance/features/apiShareOperationsToRoot/shareAccessByID.feature
     create mode 100644 tests/acceptance/features/apiShareOperationsToShares/shareAccessByID.feature

    This is the PR in which the tests are initiated, so there might already was an bug 🤔

    Server Logs
    {
      "reqId": "YisZWieGQED0gnGkikTDwAAAAAk",
      "level": 3,
      "time": "2022-03-11T09:41:46+00:00",
      "remoteAddr": "::1",
      "user": "--",
      "app": "PHP",
      "method": "POST",
      "url": "/owncloud/core/index.php",
      "message": "Undefined index: dbconnectionstring at /home/kiran/www/owncloud/core/lib/private/Setup/AbstractDatabase.php#82"
    }
    

    {
    "reqId": "YisZ1U8oeAy2ZDxTcz40igAAAAI",
    "level": 2,
    "time": "2022-03-11T09:43:49+00:00",
    "remoteAddr": "127.0.0.1",
    "user": "admin",
    "app": "no app in context",
    "method": "POST",
    "url": "/owncloud/core/ocs/v1.php/apps/testing/api/v1/increasefileid",
    "message": "Inserting dummy entry with fileid bigger than max int of 32 bits for testing"
    }
    {
    "reqId": "YisZ2SXfOhjP85vKNlGGYwAAAAA",
    "level": 3,
    "time": "2022-03-11T09:43:53+00:00",
    "remoteAddr": "127.0.0.1",
    "user": "admin",
    "app": "no app in context",
    "method": "POST",
    "url": "/owncloud/core/ocs/v2.php/cloud/users",
    "message": "Exception: {"Exception":"Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException","Message":"An exception occurred while executing 'INSERT INTO \"oc_addressbooks\" (\"uri\", \"displayname\", \"description\", \"principaluri\", \"synctoken\") VALUES(?, ?, ?, ?, ?)' with params [\"system\", \"system\", \"System addressbook which holds all users of this instance\", \"principals\\\/system\\\/system\", 1]:\n\nSQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint \"addressbook_index\"\nDETAIL: Key (principaluri, uri)=(principals\/system\/system, system) already exists.","Code":0,"Trace":"#0 \/home\/kiran\/www\/owncloud\/core\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php(182): Doctrine\\DBAL\\Driver\\AbstractPostgreSQLDriver->convertException()\n#1 \/home\/kiran\/www\/owncloud\/core\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php(159): Doctrine\\DBAL\\DBALException::wrapException()\n#2 \/home\/kiran\/www\/owncloud\/core\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(2214): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery()\n#3 \/home\/kiran\/www\/owncloud\/core\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(1526): Doctrine\\DBAL\\Connection->handleExceptionDuringQuery()\n#4 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/DB\/Connection.php(234): Doctrine\\DBAL\\Connection->executeStatement()\n#5 \/home\/kiran\/www\/owncloud\/core\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Query\/QueryBuilder.php(216): OC\\DB\\Connection->executeStatement()\n#6 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/DB\/QueryBuilder\/QueryBuilder.php(141): Doctrine\\DBAL\\Query\\QueryBuilder->execute()\n#7 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/CardDAV\/CardDavBackend.php(359): OC\\DB\\QueryBuilder\\QueryBuilder->execute()\n#8 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/CardDAV\/SyncService.php(116): OCA\\DAV\\CardDAV\\CardDavBackend->createAddressBook()\n#9 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/CardDAV\/SyncService.php(287): OCA\\DAV\\CardDAV\\SyncService->ensureSystemAddressBookExists()\n#10 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/CardDAV\/SyncService.php(216): OCA\\DAV\\CardDAV\\SyncService->getLocalSystemAddressBook()\n#11 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/HookManager.php(92): OCA\\DAV\\CardDAV\\SyncService->updateUser()\n#12 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/legacy\/hook.php(103): OCA\\DAV\\HookManager->postCreateUser()\n#13 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/Server.php(341): OC_Hook::emit()\n#14 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/Hooks\/EmitterTrait.php(99): OC\\Server->OC\\{closure}(*** sensitive parameters replaced )\n#15 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/Hooks\/PublicEmitter.php(33): OC\\Hooks\\BasicEmitter->emit()\n#16 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/User\/Manager.php(432): OC\\Hooks\\PublicEmitter->emit()\n#17 \/home\/kiran\/www\/owncloud\/core\/lib\/public\/Events\/EventEmitterTrait.php(50): OC\\User\\Manager->OC\\User\\{closure}( sensitive parameters replaced )\n#18 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/User\/Manager.php(434): OC\\User\\Manager->emittingCall()\n#19 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/User\/Manager.php(408): OC\\User\\Manager->createUserFromBackend()\n#20 \/home\/kiran\/www\/owncloud\/core\/lib\/public\/Events\/EventEmitterTrait.php(50): OC\\User\\Manager->OC\\User\\{closure}( sensitive parameters replaced )\n#21 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/User\/Manager.php(414): OC\\User\\Manager->emittingCall()\n#22 \/home\/kiran\/www\/owncloud\/core\/apps\/provisioning_api\/lib\/Users.php(159): OC\\User\\Manager->createUser()\n#23 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/legacy\/api.php(179): OCA\\Provisioning_API\\Users->addUser()\n#24 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/Route\/Router.php(341): OC_API::call()\n#25 \/home\/kiran\/www\/owncloud\/core\/ocs\/v1.php(63): OC\\Route\\Router->match()\n#26 \/home\/kiran\/www\/owncloud\/core\/ocs\/v2.php(23): require_once('\/home\/kiran\/www...')\n#27 {main}","File":"\/home\/kiran\/www\/owncloud\/core\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/AbstractPostgreSQLDriver.php","Line":70}"
    }
    {
    "reqId": "YisZ2SXfOhjP85vKNlGGYwAAAAA",
    "level": 3,
    "time": "2022-03-11T09:43:53+00:00",
    "remoteAddr": "127.0.0.1",
    "user": "admin",
    "app": "no app in context",
    "method": "POST",
    "url": "/owncloud/core/ocs/v2.php/cloud/users",
    "message": "Caused by: {"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint \"addressbook_index\"\nDETAIL: Key (principaluri, uri)=(principals\/system\/system, system) already exists.","Code":"23505","Trace":"#0 \/home\/kiran\/www\/owncloud\/core\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOStatement.php(114): Doctrine\\DBAL\\Driver\\PDO\\Exception::new()\n#1 \/home\/kiran\/www\/owncloud\/core\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(1515): Doctrine\\DBAL\\Driver\\PDOStatement->execute()\n#2 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/DB\/Connection.php(234): Doctrine\\DBAL\\Connection->executeStatement()\n#3 \/home\/kiran\/www\/owncloud\/core\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Query\/QueryBuilder.php(216): OC\\DB\\Connection->executeStatement()\n#4 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/DB\/QueryBuilder\/QueryBuilder.php(141): Doctrine\\DBAL\\Query\\QueryBuilder->execute()\n#5 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/CardDAV\/CardDavBackend.php(359): OC\\DB\\QueryBuilder\\QueryBuilder->execute()\n#6 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/CardDAV\/SyncService.php(116): OCA\\DAV\\CardDAV\\CardDavBackend->createAddressBook()\n#7 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/CardDAV\/SyncService.php(287): OCA\\DAV\\CardDAV\\SyncService->ensureSystemAddressBookExists()\n#8 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/CardDAV\/SyncService.php(216): OCA\\DAV\\CardDAV\\SyncService->getLocalSystemAddressBook()\n#9 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/HookManager.php(92): OCA\\DAV\\CardDAV\\SyncService->updateUser()\n#10 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/legacy\/hook.php(103): OCA\\DAV\\HookManager->postCreateUser()\n#11 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/Server.php(341): OC_Hook::emit()\n#12 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/Hooks\/EmitterTrait.php(99): OC\\Server->OC\\{closure}(
    sensitive parameters replaced )\n#13 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/Hooks\/PublicEmitter.php(33): OC\\Hooks\\BasicEmitter->emit()\n#14 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/User\/Manager.php(432): OC\\Hooks\\PublicEmitter->emit()\n#15 \/home\/kiran\/www\/owncloud\/core\/lib\/public\/Events\/EventEmitterTrait.php(50): OC\\User\\Manager->OC\\User\\{closure}( sensitive parameters replaced )\n#16 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/User\/Manager.php(434): OC\\User\\Manager->emittingCall()\n#17 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/User\/Manager.php(408): OC\\User\\Manager->createUserFromBackend()\n#18 \/home\/kiran\/www\/owncloud\/core\/lib\/public\/Events\/EventEmitterTrait.php(50): OC\\User\\Manager->OC\\User\\{closure}( sensitive parameters replaced )\n#19 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/User\/Manager.php(414): OC\\User\\Manager->emittingCall()\n#20 \/home\/kiran\/www\/owncloud\/core\/apps\/provisioning_api\/lib\/Users.php(159): OC\\User\\Manager->createUser()\n#21 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/legacy\/api.php(179): OCA\\Provisioning_API\\Users->addUser()\n#22 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/Route\/Router.php(341): OC_API::call()\n#23 \/home\/kiran\/www\/owncloud\/core\/ocs\/v1.php(63): OC\\Route\\Router->match()\n#24 \/home\/kiran\/www\/owncloud\/core\/ocs\/v2.php(23): require_once('\/home\/kiran\/www...')\n#25 {main}","File":"\/home\/kiran\/www\/owncloud\/core\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDO\/Exception.php","Line":18}"
    }
    {
    "reqId": "YisZ2SXfOhjP85vKNlGGYwAAAAA",
    "level": 3,
    "time": "2022-03-11T09:43:53+00:00",
    "remoteAddr": "127.0.0.1",
    "user": "admin",
    "app": "no app in context",
    "method": "POST",
    "url": "/owncloud/core/ocs/v2.php/cloud/users",
    "message": "Caused by: {"Exception":"PDOException","Message":"SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint \"addressbook_index\"\nDETAIL: Key (principaluri, uri)=(principals\/system\/system, system) already exists.","Code":"23505","Trace":"#0 \/home\/kiran\/www\/owncloud\/core\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOStatement.php(112): PDOStatement->execute()\n#1 \/home\/kiran\/www\/owncloud\/core\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(1515): Doctrine\\DBAL\\Driver\\PDOStatement->execute()\n#2 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/DB\/Connection.php(234): Doctrine\\DBAL\\Connection->executeStatement()\n#3 \/home\/kiran\/www\/owncloud\/core\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Query\/QueryBuilder.php(216): OC\\DB\\Connection->executeStatement()\n#4 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/DB\/QueryBuilder\/QueryBuilder.php(141): Doctrine\\DBAL\\Query\\QueryBuilder->execute()\n#5 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/CardDAV\/CardDavBackend.php(359): OC\\DB\\QueryBuilder\\QueryBuilder->execute()\n#6 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/CardDAV\/SyncService.php(116): OCA\\DAV\\CardDAV\\CardDavBackend->createAddressBook()\n#7 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/CardDAV\/SyncService.php(287): OCA\\DAV\\CardDAV\\SyncService->ensureSystemAddressBookExists()\n#8 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/CardDAV\/SyncService.php(216): OCA\\DAV\\CardDAV\\SyncService->getLocalSystemAddressBook()\n#9 \/home\/kiran\/www\/owncloud\/core\/apps\/dav\/lib\/HookManager.php(92): OCA\\DAV\\CardDAV\\SyncService->updateUser()\n#10 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/legacy\/hook.php(103): OCA\\DAV\\HookManager->postCreateUser()\n#11 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/Server.php(341): OC_Hook::emit()\n#12 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/Hooks\/EmitterTrait.php(99): OC\\Server->OC\\{closure}(
    sensitive parameters replaced )\n#13 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/Hooks\/PublicEmitter.php(33): OC\\Hooks\\BasicEmitter->emit()\n#14 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/User\/Manager.php(432): OC\\Hooks\\PublicEmitter->emit()\n#15 \/home\/kiran\/www\/owncloud\/core\/lib\/public\/Events\/EventEmitterTrait.php(50): OC\\User\\Manager->OC\\User\\{closure}( sensitive parameters replaced )\n#16 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/User\/Manager.php(434): OC\\User\\Manager->emittingCall()\n#17 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/User\/Manager.php(408): OC\\User\\Manager->createUserFromBackend()\n#18 \/home\/kiran\/www\/owncloud\/core\/lib\/public\/Events\/EventEmitterTrait.php(50): OC\\User\\Manager->OC\\User\\{closure}( sensitive parameters replaced ***)\n#19 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/User\/Manager.php(414): OC\\User\\Manager->emittingCall()\n#20 \/home\/kiran\/www\/owncloud\/core\/apps\/provisioning_api\/lib\/Users.php(159): OC\\User\\Manager->createUser()\n#21 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/legacy\/api.php(179): OCA\\Provisioning_API\\Users->addUser()\n#22 \/home\/kiran\/www\/owncloud\/core\/lib\/private\/Route\/Router.php(341): OC_API::call()\n#23 \/home\/kiran\/www\/owncloud\/core\/ocs\/v1.php(63): OC\\Route\\Router->match()\n#24 \/home\/kiran\/www\/owncloud\/core\/ocs\/v2.php(23): require_once('\/home\/kiran\/www...')\n#25 {main}","File":"\/home\/kiran\/www\/owncloud\/core\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOStatement.php","Line":112}"
    }

  3. kiranparajuli589 commented on Mar 11, 2022

    @kiranparajuli589
    Contributor

    Step to reproduce

    • create a user uu1
    • request for a non-existent share
    ❯ curl -u uu1:uu1 http://localhost/owncloud/core/ocs/v1.php/apps/files_sharing/api/v1/shares/helloshare -v
    *   Trying 127.0.0.1:80...
    * TCP_NODELAY set
    * Connected to localhost (127.0.0.1) port 80 (#0)
    * Server auth using Basic with user 'uu1'
    > GET /owncloud/core/ocs/v1.php/apps/files_sharing/api/v1/shares/helloshare HTTP/1.1
    > Host: localhost
    > Authorization: Basic dXUxOnV1MQ==
    > User-Agent: curl/7.68.0
    > Accept: */*
    > 
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 200 OK
    < Date: Fri, 11 Mar 2022 09:53:32 GMT
    < Server: Apache/2.4.41 (Ubuntu)
    < X-Content-Type-Options: nosniff
    < X-XSS-Protection: 0
    < X-Robots-Tag: none
    < X-Frame-Options: SAMEORIGIN
    < X-Download-Options: noopen
    < X-Permitted-Cross-Domain-Policies: none
    < Set-Cookie: oczhwym1wovc=1ibu0sd0pph2d8p24lijgf5tog; path=/owncloud/core; HttpOnly; SameSite=Strict
    < Expires: Thu, 19 Nov 1981 08:52:00 GMT
    < Cache-Control: no-cache, no-store, must-revalidate
    < Pragma: no-cache
    < Set-Cookie: oc_sessionPassphrase=fm6qmOY5Dgu%2FoJjP85c0S6p2NVsV8XEV5hMe8Dq8FqyoT8QGj7xbO54nPVn%2FNM73DMZoXiBwbcSbIV9vzixwP47EKeRHLye9eSXIkPAvmg8aKrxU3mScm3Y%2F10%2BDnWAO; path=/owncloud/core; HttpOnly; SameSite=Strict
    < Content-Security-Policy: default-src 'none';manifest-src 'self';script-src 'self' 'unsafe-eval';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self';connect-src 'self';media-src 'self'
    < Set-Cookie: oczhwym1wovc=l0b50bq10envr8jahht648oe5l; path=/owncloud/core; HttpOnly; SameSite=Strict
    < Set-Cookie: cookie_test=test; expires=Fri, 11-Mar-2022 10:53:33 GMT; Max-Age=3600
    < Content-Length: 659
    < Vary: Accept-Encoding
    < Content-Type: application/xml; charset=utf-8
    < 
    <?xml version="1.0"?>
    <ocs>
     <meta>
      <status>failure</status>
      <statuscode>996</statuscode>
      <message>An exception occurred while executing 'SELECT * FROM &quot;oc_share&quot; WHERE (&quot;id&quot; = ?) AND (&quot;share_type&quot; IN (?, ?, ?)) AND ((&quot;item_type&quot; = ?) OR (&quot;item_type&quot; = ?))' with params [&quot;helloshare&quot;, 0, 1, 3, &quot;file&quot;, &quot;folder&quot;]:
    
    SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for type integer: &quot;helloshare&quot;
    CONTEXT:  unnamed portal parameter $1 = '...'</message>
      <totalitems></totalitems>
      <itemsperpage></itemsperpage>
     </meta>
     <data/>
    </ocs>
    * Connection #0 to host localhost left intact

    Expected

    ocs status to be 404

    Actual

    ocs status code is 996

  4. phil-davis commented on Mar 14, 2022

    @phil-davis
    ContributorAuthor

    Fixed by PR #39873

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions