Fix R CMD check failures: suppress GLib and libfluidsynth non-critical log messages#5
Fix R CMD check failures: suppress GLib and libfluidsynth non-critical log messages#5
Conversation
…synth logging callback When new_fluid_settings() is called in a restricted environment (where HOME is not accessible), libfluidsynth logs "Home directory not accessible: Permission denied" at FLUID_WARN level. This message went through the logging_callback using REprintf() directly to stderr, which cannot be suppressed by R's suppressMessages(). R CMD check detected this as an uncapturable startup message and caused cascading failures. Fix: restrict logging_callback to only print PANIC and ERR level messages; also register the callback for FLUID_DBG to capture all log levels. Co-authored-by: jeroen <216319+jeroen@users.noreply.github.com>
|
@copilot why does new_fluid_settings write in the home directory? What is it writing? Can we set it to write elsewhere? |
…ling a GLib log handler The "Home directory not accessible: Permission denied" message comes from GLib (via g_warning()), not from libfluidsynth's own logging system. Since libfluidsynth is compiled against GLib on Linux/Mac, GLib's log handler writes directly to stderr when HOME is inaccessible, bypassing R's suppressMessages() entirely. Changes: - src/init.c: Added HAVE_GLIB conditional to install a GLib log handler that silently discards WARNING/MESSAGE/INFO/DEBUG level messages from the default GLib log domain. PANIC and CRITICAL levels are NOT intercepted. - configure: Added check for glib.h availability using fluidsynth's pkg-config cflags; sets -DHAVE_GLIB when GLib headers are found (Linux/Mac). Co-authored-by: jeroen <216319+jeroen@users.noreply.github.com>
Co-authored-by: jeroen <216319+jeroen@users.noreply.github.com>
The message doesn't come from libfluidsynth itself — it comes from GLib (which fluidsynth depends on). When any GLib function is first called (e.g. triggered by It reads (not writes) the home directory — it's looking for GLib's standard user config/data directories. There's no fluidsynth API to prevent this; fluidsynth doesn't expose control over GLib's own directory lookups. Fixed in commit Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
In restricted build environments (e.g. r-universe) where
HOMEis inaccessible, the message"Home directory not accessible: Permission denied"appears on stderr during R CMD check. This message comes from GLib (viag_warning()), which libfluidsynth depends on as its OS abstraction layer. When GLib lazily initializes user directory paths (triggered by the first libfluidsynth API call), it attemptsg_get_home_dir()and logs the warning directly to stderr, bypassing R'ssuppressMessages()entirely. R CMD check treats this uncapturable stderr output as a broken startup message and cascades failures across multiple check steps.Changes in
src/init.clogging_callback: only emits output forFLUID_PANICandFLUID_ERR;FLUID_WARN,FLUID_INFO, andFLUID_DBGare silently dropped. Critical errors still surface; operational/informational chatter does not.FLUID_DBG: addedfluid_set_log_function(FLUID_DBG, logging_callback, NULL)so all libfluidsynth log levels are intercepted by our handler rather than falling through to libfluidsynth's default stderr handler.glib_log_suppress()installed viag_log_set_handler()for the default GLib log domain atWARNING | MESSAGE | INFO | DEBUGlevels. This intercepts GLib's "Home directory not accessible" warning before it reaches stderr.G_LOG_LEVEL_CRITICALandG_LOG_LEVEL_ERRORare deliberately not suppressed. Guarded by#ifdef HAVE_GLIB.Changes in
configureglib.his accessible using the fluidsynth pkg-config cflags (which already include GLib include paths on Linux/Mac, since fluidsynth depends on GLib). Sets-DHAVE_GLIBwhen GLib headers are found.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.