Skip to content

Get rid of now broken fluidsynth_1 #141508

@sternenseemann

Description

@sternenseemann

fluidsynth_1 no longer compiles with GLib 2.70:

In file included from /nix/store/rrmzjd6gybl8ynnlnclxmla9rvcpw0cc-glib-2.70.0-dev/include/glib-2.0/glib/deprecated/gthread.h:124,
                 from /nix/store/rrmzjd6gybl8ynnlnclxmla9rvcpw0cc-glib-2.70.0-dev/include/glib-2.0/glib.h:112,
                 from /build/source/src/utils/fluidsynth_priv.h:25,
                 from /build/source/src/drivers/fluid_jack.c:31:
/build/source/src/drivers/fluid_jack.c:103:42: error: extra brace group at end of initializer
  103 | static fluid_mutex_t last_client_mutex = G_STATIC_MUTEX_INIT;     /* Probably not necessary, but just in case drivers are created by multiple threads */
      |                                          ^~~~~~~~~~~~~~~~~~~
/build/source/src/drivers/fluid_jack.c:103:42: note: (near initialization for 'last_client_mutex')
/build/source/src/drivers/fluid_jack.c:103:42: error: extra brace group at end of initializer
  103 | static fluid_mutex_t last_client_mutex = G_STATIC_MUTEX_INIT;     /* Probably not necessary, but just in case drivers are created by multiple threads */
      |                                          ^~~~~~~~~~~~~~~~~~~
/build/source/src/drivers/fluid_jack.c:103:42: note: (near initialization for 'last_client_mutex')
In file included from /nix/store/f1r94qx7a8m8iz7fxvlq655gbawql7xf-glibc-2.33-50-dev/include/bits/thread-shared-types.h:74,
                 from /nix/store/f1r94qx7a8m8iz7fxvlq655gbawql7xf-glibc-2.33-50-dev/include/bits/pthreadtypes.h:23,
                 from /nix/store/f1r94qx7a8m8iz7fxvlq655gbawql7xf-glibc-2.33-50-dev/include/sys/types.h:227,
                 from /nix/store/f1r94qx7a8m8iz7fxvlq655gbawql7xf-glibc-2.33-50-dev/include/stdlib.h:394,
                 from /nix/store/rrmzjd6gybl8ynnlnclxmla9rvcpw0cc-glib-2.70.0-dev/include/glib-2.0/glib/gutils.h:433,
                 from /nix/store/rrmzjd6gybl8ynnlnclxmla9rvcpw0cc-glib-2.70.0-dev/include/glib-2.0/glib/gthread.h:34,
                 from /nix/store/rrmzjd6gybl8ynnlnclxmla9rvcpw0cc-glib-2.70.0-dev/include/glib-2.0/glib/gasyncqueue.h:32,
                 from /nix/store/rrmzjd6gybl8ynnlnclxmla9rvcpw0cc-glib-2.70.0-dev/include/glib-2.0/glib.h:32,
                 from /build/source/src/utils/fluidsynth_priv.h:25,
                 from /build/source/src/drivers/fluid_jack.c:31:
/build/source/src/drivers/fluid_jack.c:103:42: error: extra brace group at end of initializer
  103 | static fluid_mutex_t last_client_mutex = G_STATIC_MUTEX_INIT;     /* Probably not necessary, but just in case drivers are created by multiple threads */
      |                                          ^~~~~~~~~~~~~~~~~~~
/build/source/src/drivers/fluid_jack.c:103:42: note: (near initialization for 'last_client_mutex')
/build/source/src/drivers/fluid_jack.c:103:42: warning: excess elements in union initializer
  103 | static fluid_mutex_t last_client_mutex = G_STATIC_MUTEX_INIT;     /* Probably not necessary, but just in case drivers are created by multiple threads */
      |                                          ^~~~~~~~~~~~~~~~~~~
/build/source/src/drivers/fluid_jack.c:103:42: note: (near initialization for 'last_client_mutex')
/build/source/src/drivers/fluid_jack.c:103:13: warning: Deprecated pre-processor symbol: replace with "g_mutex_init"
  103 | static fluid_mutex_t last_client_mutex = G_STATIC_MUTEX_INIT;     /* Probably not necessary, but just in case drivers are created by multiple threads */
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/libfluidsynth.dir/build.make:90: src/CMakeFiles/libfluidsynth.dir/drivers/fluid_jack.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:258: src/CMakeFiles/libfluidsynth.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

The failure looks patchable: We'd need to replace the use of G_STATIC_MUTEX_INIT in fluid_jack.c by an equivalent call to g_mutex_init. However I'm not quite confident about the right place to call it, since we need to avoid calling it twice (which is UB according to the GLib documentation) and it looks like there are two different intialization routines that'd need to initialize the lock, new_fluid_jack_client and new_fluid_jack_midi_driver.

Therefore I think should try to make an effort to finally get rid of this vulnerable version of fluidsynth (#124624). Remaining uses:

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.skill: sprintableA larger issue which is split into distinct actionable tasks9.needs: clean-upSomebody please clean up this mess!
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions