Bug 224393 - Update to www/nextcloud 12.0.4 caused INVALID_HASH PostgreSqlSchemaManager.php
Summary: Update to www/nextcloud 12.0.4 caused INVALID_HASH PostgreSqlSchemaManager.php
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
Depends on: 225449
  Show dependency treegraph
Reported: 2017-12-17 00:53 UTC by peo
Modified: 2018-01-26 15:54 UTC (History)
3 users (show)

See Also:
linimon: maintainer-feedback? (loic.blot)


Note You need to log in before you can comment on or make changes to this bug.
Description peo 2017-12-17 00:53:09 UTC
Relates to Bug 224142, looks like the checksum was mot recalculated after the change

    - 3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php:
      - expected: 9c9a80a71990dc784914780024b780189f7f68d38ee98f49439d5db9adce290d1105a17fb8a670090fa92b65760775fb942bc3060b368bf16b82702fa2d5f9f2
      - current: 5839a5ca8dacedb7eb8ab40e9025614a042741557346ddd228f3e0aa38a6bb352226c59b3b429057651ad6c58ba20f69a4049178c39aedf7a9a7c462faa042d4

--- PostgreSqlSchemaManager.php 2017-12-17 01:40:25.826548000 +0100
+++ ./nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php     2017-12-04 08:19:01.000000000 +0100
@@ -289,16 +289,7 @@
             $sequenceName = $sequence['relname'];
-        $version = floatval($this->_conn->getWrappedConnection()->getServerVersion());
-        if ($version >= 10) {
-           $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = \'public\' AND sequencename = '.$this->_conn->quote($sequenceName));
-        }
-        else
-        {
-            $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName));
-        }
-//        $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName));
+        $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName));
         return new Sequence($sequenceName, $data[0]['increment_by'], $data[0]['min_value']);
Comment 1 loic.blot 2017-12-17 09:17:03 UTC
is this due to nextcloud code signing check ?
Comment 2 Marko Cupać 2018-01-04 11:17:11 UTC
(In reply to loic.blot from comment #1)
It is due to nextcloud code signing check.

Could patch-3rdparty_doctrine_dbal_lib_Doctrine_DBAL_Schema_PostgreSqlSchemaManager.php be made optional for those who need it? I guess I am not the only one to use mysql, having no need for the patch whatsoever, except that now I have to look at this warning all the time I'm logged into nextcloud as admin.
Comment 3 loic.blot 2018-01-04 11:18:56 UTC
I think the updated patched file should include the hash checking patch too
Comment 4 Marko Cupać 2018-01-04 11:30:34 UTC
(In reply to loic.blot from comment #3)

"Code Signing" page at docs.nextcloud.com states that "By supporting Code Signing we add another layer of security by ensuring that nobody other than authorized persons can push updates for applications, and ensuring proper upgrades.":

If vanilla Nextcloud doesn't work for some FreeBSD users using postgres, I guess the right thing to do would be to ask Nextcloud developers to include patch upstream, or come out with their own solution.

Not that I have any experience with software packaging and maintenance.
Comment 5 loic.blot 2018-01-04 11:41:06 UTC
We already opened and ask them to fix that third party library code but they didn't shipit with 12.0.4, it seems 13 fixed it.


Comment 6 Marko Cupać 2018-01-04 12:02:50 UTC
(In reply to loic.blot from comment #5)

Thank you for clarification. I understand upstream change is difficult for 12.X, and lots of users would be affected in worse ways than having to see a warning in a fully functional deployment if the patch was removed for 12.X.

I was also amused to see FreeBSD is not "officially supported" OS for Nextcloud!? It sure works great for me on FreeBSD for some years now. Actually I would never use it if I would have to use it on Linux :)
Comment 7 commit-hook freebsd_committer 2018-01-25 22:15:22 UTC
A commit references this bug:

Author: brnrd
Date: Thu Jan 25 22:14:21 UTC 2018
New revision: 459964
URL: https://svnweb.freebsd.org/changeset/ports/459964

  www/nextcloud: Bugfix update to 12.0.5

   - Fix INVALID_HASH error for non-pgsql10 users [1]

  PR:		225449, 224393 [1]
  Reported by:	peo@nethead.se [1]
  Approved by:	loic-blot@unix-experience.fr (maintainer)