Incorrectly parsing some geos versions
groeneman opened this issue · comments
Hi,
I was having some issues with some missing methods in my Geos::LinearRing
class that none of my coworkers could reproduce. We eventually tracked the issue down to lib/ffi-geos/geometry.rb:425
, which checks the Geos::GEOS_VERSION
value. On my machine which was running Geos version 3.6.2-CAPI-1.10.2 4d2925d6
, Geos::GEOS_VERSION
was returning 0.0.0
, whereas on my coworker's machine, which was running Geos version 3.6.1-CAPI-1.10.1 r0
, Geos::GEOS_VERSION
was returning 3.6.1
.
We tracked that down to the VersionConstants
module in lib/ffi-geos.rb
. The regex that parses out the version doesn't support those trailing hex digits.
/^
((\d+)\.(\d+)\.(\d+)((?:dev|rc|beta|alpha)\d*)?)
-CAPI-
((\d+)\.(\d+)\.(\d+))
(?:\s+r(\d+))?
$/x
Making that last r
optional (r+
) and changing the last \d
to a \h
fixes the issue for me. For context, I installed geos
via homebrew (as opposed to by building from some random commit on GitHub), so I would've expected the version string to be acceptable.
Thanks!
Fixed and released in ffi-geos 1.2.1.