[BUG FIX]: invalid meson version detection

Started by Sergey Solovievover 2 years ago2 messageshackers

Thread notes

1 note#bug#not-a-bug
hackorum-bot#bug#not-a-bug
hackorum-bot
1 day ago

@global #bug #not-a-bug

#bug#not-a-bug
Jump to latest
#1Sergey Soloviev
sergey.soloviev@tantorlabs.ru

Hi.

I looked at meson.build file at found an incorrectly used function to

determine postgres version.

if pg_version.endswith('devel')
   pg_version_arr = [pg_version.split('devel')[0], '0']

There should be `pg_version.contains('devel')`, not `endswith`. Like this:

-if pg_version.endswith('devel')
+if pg_version.contains('devel')

Next statement seems to be valid:

elif pg_version.contains('beta')
  pg_version_arr = [pg_version.split('beta')[0], '0']
elif pg_version.contains('rc')
  pg_version_arr = [pg_version.split('rc')[0], '0']
else
  pg_version_arr = pg_version.split('.')
endif

I created a single line patch for it.

Attachments:

t50117_1
0001-Invalid-version-string-split-in-meson.patchtext/x-patch; charset=UTF-8; name=0001-Invalid-version-string-split-in-meson.patchDownload+1-2
#2Heikki Linnakangas
hlinnaka@iki.fi
In reply to: Sergey Soloviev (#1)
Re: [BUG FIX]: invalid meson version detection

On 14/08/2024 17:02, Sergey Solovev wrote:

I looked at meson.build file at found an incorrectly used function to

determine postgres version.

if pg_version.endswith('devel')
   pg_version_arr = [pg_version.split('devel')[0], '0']

There should be `pg_version.contains('devel')`, not `endswith`. Like this:

-if pg_version.endswith('devel')
+if pg_version.contains('devel')

I believe it's correct as it is. With "beta" and "rc" version, the
version strings look like "17beta1" or "16rc2", i.e. there's a number at
the end of the string. But the "devel" version strings never have that,
e.g. "17devel" or "18devel".

See also src/tools/version_stamp.pl

--
Heikki Linnakangas
Neon (https://neon.tech)