Repository navigation
Require the GLib versions the code needs - #1140
Conversation
Does passing 0 already have the G_REGEX_MATCH_DEFAULT meaning in the 2.46 case? |
|
It'd be useful to add a build test in the github workflow for e.g. an old image to check against regressions on this. |
module_utils.c passes G_REGEX_MATCH_DEFAULT to g_regex_replace, but GLib only introduced this name in 2.74, as a name for 0, which means no match options in all versions. Pass the literal value 0 instead, as the other calls to the GRegex functions in speechd do.
libspeechd hands strings allocated by GLib to callers who release them with free(), for instance the error string of spd_open2. GLib only guarantees that this works since 2.46, from which g_malloc always uses the system malloc. Check for that version in configure, which used to accept 2.36.
The kitten module calls g_string_new_take (src/modules/kitten_utilities.c), which GLib introduced in 2.78. configure now builds the module only with that version, and fails when --with-kitten=yes is given with an older GLib.
176497c to
ad586a8
Compare
Yes:
I see two ways to check this, which test different things. The first is to build with The second is the old image you suggest. I tried Debian stretch (GLib 2.50) in a container: with this PR, speech-dispatcher builds and I would suggest adding the first to this PR, since it makes visible what used to go unnoticed, and keeping the old image for a separate PR. Would that suit you? |
Yes, that looks good |
speak_queue.c used g_memdup2 whenever the installed GLib is 2.68 or newer. It now tests GLIB_VERSION_MAX_ALLOWED instead, which is the installed version unless the build restricts the GLib API to an older one: in that case it uses g_memdup, which that older GLib has.
A new job builds with GLIB_VERSION_MIN_REQUIRED and GLIB_VERSION_MAX_ALLOWED set to the minimum GLib version that configure.ac requires, read from configure.ac, and with deprecation warnings made errors, so that using a newer GLib API fails the build. The kitten module, which requires a newer GLib, is not built.
0f4d173 to
e7bb705
Compare
|
Thanks, done in the last two commits. The first makes the version check in To check that the job catches the problem, I ran it on master with these two commits added: it fails on |
|
Thanks! |
configure.acasks for GLib 2.36, but the code needs more than that:src/modules/module_utils.cpassesG_REGEX_MATCH_DEFAULTtog_regex_replace. GLib introduced this name for0in 2.74, so the output modules do not build with an older GLib.g_string_new_take(GLib 2.78) insrc/modules/kitten_utilities.c, andg_memdup2(GLib 2.68) insrc/modules/kitten_worker.c.free()(for instance theerrorstring ofspd_open2). This is only guaranteed since GLib 2.46, from whichg_mallocalways uses the systemmalloc; this came up in the review of Share the per-user socket path definition #1139.The first commit passes
0instead ofG_REGEX_MATCH_DEFAULT, as the other GRegex calls in speechd do;0means no match options in every GLib version. The second makesconfigurerequire 2.46. The third builds the kitten module only with GLib 2.78 or later, like its other dependencies: it is skipped otherwise, and--with-kitten=yesfails. Requiring 2.78 everywhere would instead prevent building speech-dispatcher on Debian bookworm (2.74) for the sake of an optional module.To find the newest GLib API in use, I built every module with
GLIB_VERSION_MIN_REQUIREDandGLIB_VERSION_MAX_ALLOWEDdefined toGLIB_VERSION_2_46, which makes GLib warn about anything newer: with this PR, only kitten's calls remain. The shims do not use GLib. I also built this PR on Debian stretch (GLib 2.50), wheremake checkpasses and master fails onG_REGEX_MATCH_DEFAULT.The last two commits keep this from happening again. The fourth makes the version check around
g_memdup2insrc/common/speak_queue.ctestGLIB_VERSION_MAX_ALLOWEDinstead of the installed GLib, which changes nothing in a normal build. The fifth adds abuild-glib-minjob to the CI: it reads the minimum fromconfigure.ac, sets both macros to it, and makes deprecation warnings errors (GLib reports newer API as deprecated), so that a newer GLib API fails the build. The kitten module is left out, since it requires 2.78. On master with these two commits, the job fails onG_REGEX_MATCH_DEFAULTand on nothing else; on this PR, it passes.