asyncpg fails to build against postgresql 10.1

Bug #1747589 reported by Christian Ehrhardt 
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
asyncpg (Debian)
Fix Released
Unknown
asyncpg (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Hi,
I tried to fulfil to the promise that dpb made and tried to help with som eolder proposed migrations.
After a while I found something I can actually help, so I looked at asyncpg.
Building version 0.13.0-1 was failing on armhf [1]

Error (all 198 of them):
E ValueError: invalid literal for int() with base 10: '1 (Ubuntu 10'

That seems to do a int conversion with something that gets an "1 (Ubuntu 10" as text.
That is in function split_server_version_string
The failing variable is the argument "version_string"

That could be related to postgres 10 now being to digits.
But why only on armhf then?

It triggers the code on setup when checking for the postgres version.
Function _get_pg_version in asyncpg/cluster.py.

To get it it calls effectively:
/usr/lib/postgresql/10/bin/postgres --version

This is now the string:
"postgres (PostgreSQL) 10.1 (Ubuntu 10.1-3)"

Then it drops the prefix:
"10.1 (Ubuntu 10.1-3)"

Well all that happens on x86 as well.
If I modify the source to be a callable program and iterate a bit I see that:
$ ./test-serverversion.py "10.1 (Ubuntu 10.1-3)"
Initial 10.1 (Ubuntu 10.1-3)
parts ['10', '1 (Ubuntu 10', '1']
Traceback (most recent call last):
  File "./test-serverversion.py", line 44, in <module>
    main(sys.argv[1])
  File "./test-serverversion.py", line 33, in main
    versions = [int(p) for p in parts][:3]
ValueError: invalid literal for int() with base 10: '1 (Ubuntu 10'

I think it was broken by "build time".
On x86 I see:
postgresql-client-10_10.0-1_amd64.deb
On armhf I see:
postgresql-client-10_10.1-3_armhf.deb

The old version format was "postgres (PostgreSQL) 9.6.6"

A fix would be:
   if " (" in version_string:
       version_string = version_string[0:version_string.find(" (")]

With all that known I found [2] and [3].

I pinged [3] with the info on [2] and given an upload happens this will resolve and by that unblock part of the proposed-migration.

Further on I found, debugged, fixed and reported [4] which makes it build and work correctly again.
There might be more things that need to be addressed by upstream to follow this pg change, but for now things seem better than before.

I prepared an ubuntu1 upload to get this finally migrating in bionic.
And we can make it a sync once upstream & Debian picked things up.

[1]: https://launchpad.net/ubuntu/+source/asyncpg/0.13.0-1/+build/13670362
[2]: https://github.com/MagicStack/asyncpg/issues/250
[3]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=882017
[4]: https://github.com/MagicStack/asyncpg/issues/256

Changed in asyncpg (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Changed in asyncpg (Debian):
status: Unknown → New
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Upstream had a fix, but on another place.
So I unrolled the second part of the fix and used the upstream fix for an ubuntu2 upload.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package asyncpg - 0.13.0-1ubuntu3

---------------
asyncpg (0.13.0-1ubuntu3) bionic; urgency=medium

  * d/p/0001-Fix-unaligned-access-issues-in-host-network-byte-I-O.patch:
    fix unaligned access by backporting change from 0.14 (Closes 872408 again).

asyncpg (0.13.0-1ubuntu2) bionic; urgency=medium

  * Update (LP 1747589) to the upstream accepted fix.
    - d/p/0001-Parse-server-version-x.y-as-x.0.y-when-x-is-10.patch: backport
      upstream fix for short 10.x version parsing.
    - d/p/0001-Fix-server-version-parsing-when-it-contains-trailing.patch:
      update to match the former patch being included.

asyncpg (0.13.0-1ubuntu1) bionic; urgency=medium

  * d/p/0001-Fix-server-version-parsing-when-it-contains-trailing.patch: Fix
    server version parsing when it contains trailing data (Closes: #882017)
    (LP: #1747589)

 -- Christian Ehrhardt <email address hidden> Tue, 06 Feb 2018 18:24:39 +0100

Changed in asyncpg (Ubuntu):
status: Triaged → Fix Released
Changed in asyncpg (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.