Skip to content

Commit 2011fa5

Browse files
author
Grok Compression
committed
fix(plugin): remove stdout fprintf that corrupts binary pipe output
The [plugin] diagnostic messages were printed to stdout, which corrupts binary data when grk_decompress pipes output (e.g. PNG) to stdout. Remove all fprintf(stdout) calls from grk_plugin_load() and the success message from grk_plugin_init(). Failure messages remain on stderr. Fixes test_stdio.py::TestDecompressToStdout failures in CI.
1 parent 87a82fd commit 2011fa5

1 file changed

Lines changed: 0 additions & 15 deletions

File tree

src/lib/core/grok.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,12 +1195,10 @@ bool grk_plugin_load(grk_plugin_load_info info)
11951195
{
11961196
auto pluginPath = std::string(info.pluginPath) +
11971197
static_cast<char>(std::filesystem::path::preferred_separator) + pluginName;
1198-
fprintf(stdout, "[plugin] Attempting to load plugin from '%s'\n", pluginPath.c_str());
11991198
int32_t rc = minpf_load_from_path(pluginPath.c_str(), nullptr);
12001199
if(!rc)
12011200
{
12021201
pluginLoaded = true;
1203-
fprintf(stdout, "[plugin] Successfully loaded plugin '%s'\n", pluginName.c_str());
12041202
return true;
12051203
}
12061204
}
@@ -1209,12 +1207,10 @@ bool grk_plugin_load(grk_plugin_load_info info)
12091207
// from its own binary dir without passing -g)
12101208
std::string localPlugin =
12111209
std::string(".") + (char)std::filesystem::path::preferred_separator + pluginName;
1212-
fprintf(stdout, "[plugin] Trying local path '%s'\n", localPlugin.c_str());
12131210
int32_t rc = minpf_load_from_path(localPlugin.c_str(), nullptr);
12141211
if(!rc)
12151212
{
12161213
pluginLoaded = true;
1217-
fprintf(stdout, "[plugin] Successfully loaded plugin '%s'\n", pluginName.c_str());
12181214
return true;
12191215
}
12201216

@@ -1226,17 +1222,14 @@ bool grk_plugin_load(grk_plugin_load_info info)
12261222
auto exeDir = exePath.parent_path().string();
12271223
auto exeDirPlugin =
12281224
exeDir + static_cast<char>(std::filesystem::path::preferred_separator) + pluginName;
1229-
fprintf(stdout, "[plugin] Trying executable dir '%s'\n", exeDirPlugin.c_str());
12301225
rc = minpf_load_from_path(exeDirPlugin.c_str(), nullptr);
12311226
if(!rc)
12321227
{
12331228
pluginLoaded = true;
1234-
fprintf(stdout, "[plugin] Successfully loaded plugin '%s'\n", pluginName.c_str());
12351229
return true;
12361230
}
12371231
}
12381232

1239-
fprintf(stderr, "[plugin] Failed to load plugin '%s' from any path\n", pluginName.c_str());
12401233
minpf_cleanup_plugin_manager();
12411234
return false;
12421235
}
@@ -1264,7 +1257,6 @@ GRK_API bool GRK_CALLCONV grk_plugin_init(grk_plugin_init_info initInfo)
12641257
{
12651258
if(!pluginLoaded)
12661259
{
1267-
fprintf(stderr, "[plugin] grk_plugin_init called but no plugin is loaded\n");
12681260
return false;
12691261
}
12701262
auto mgr = minpf_get_plugin_manager();
@@ -1282,17 +1274,10 @@ GRK_API bool GRK_CALLCONV grk_plugin_init(grk_plugin_init_info initInfo)
12821274
if(!result)
12831275
fprintf(stderr, "[plugin] Plugin init failed (device_id=%u, license='%s')\n",
12841276
initInfo.device_id, initInfo.license ? initInfo.license : "");
1285-
else
1286-
fprintf(stdout, "[plugin] Plugin initialized successfully (device_id=%u)\n",
1287-
initInfo.device_id);
12881277
return result;
12891278
}
12901279
fprintf(stderr, "[plugin] Plugin missing '%s' symbol\n", plugin_init_method_name);
12911280
}
1292-
else
1293-
{
1294-
fprintf(stderr, "[plugin] No plugin libraries available in manager\n");
1295-
}
12961281
return false;
12971282
}
12981283

0 commit comments

Comments
 (0)