Skip to content

fix(plugin-catalog): preserve Unicode paths in failure diagnostics - #226

Merged
facontidavide merged 6 commits into
PlotJuggler:mainfrom
reliable-ly0411:fix/plugin-catalog-unicode-errors
Nov 14, 2026
Merged

facontidavide merged 6 commits into
PlotJuggler:mainfrom
reliable-ly0411:fix/plugin-catalog-unicode-errors

Conversation

@reliable-ly0411

@reliable-ly0411 reliable-ly0411 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

fix(plugin-catalog): preserve Unicode paths in failure diagnostics

Summary

  • Reuse detail::pathForLegacyAccessor for the suffix check and six error-formatting sites in the plugin catalog. On Windows this uses UTF-8 rather than the active code page; Unix behavior stays unchanged.
  • Add a regression covering a missing directory, invalid shared library, null handle, unsupported Unicode suffix, invalid-library scan diagnostics, and a file passed as a directory. Use Chinese plus a supplementary Unicode character so the fixture is not representable in ACP 1252 or 936.
  • Record the consumer-visible bug fix under Unreleased. No API, ABI, version, host floor or packaging change.

Why

MSVC std::filesystem::path::string() can throw std::system_error (1113 / ERROR_NO_UNICODE_TRANSLATION) while formatting the intended loader error. The API consequently throws instead of returning its Expected error or scan diagnostic. The SDK already has a UTF-8 path conversion helper used by its loader; this patch reuses it rather than adding a second encoder or swallowing exceptions.

Evidence

A focused Windows MSVC 19.44 / ACP 1252 A/B experiment compiled actual SDK 0.39.0 catalog source: all six original cases threw code 1113; all six patched cases passed.
https://github.com/reliable-ly0411/PlotJuggler-zh-CN/actions/runs/42784741091

Current main 9fc42b1 has the identical original catalog source SHA256 as 0.39.0. The patch applies cleanly. The final GTest regression extracted with its actual fixture passes locally on Linux; clang-format 22.1.0 and diff whitespace checks pass.

Follow-up Linux validation

Tested commit: 52cdf329adf6af3513e190fe0f8b86f19f17b051 (the current PR head), with no tracked-file changes.

  • pre-commit run --all-files: all applicable hooks passed, including clang-format 22.1.0. git diff --check passed.
  • ./build.sh --debug: dependencies and configuration completed with the existing Conan/CMake toolchain. An initial two-job build had a compiler process killed by the environment. Resuming with cmake --build build/debug_asan -j1 completed the full build successfully, without code changes. The cache has CMAKE_BUILD_TYPE=Debug, PJ_ENABLE_SANITIZERS=ON, and PJ_ASSERT_THROWS=ON.
  • Default ./test.sh: 5/105 CTest entries passed; 100 failed with LeakSanitizer fatal errors in this sandbox/ptrace environment. The new integrated Unicode regression itself passed before the process-exit leak check. This is not a passing default sanitizer run.
  • ASAN_OPTIONS=detect_leaks=0 ./test.sh: 105/105 CTest entries passed, including the complete 36-test plugin catalog executable. AddressSanitizer instrumentation remains enabled; leak detection was explicitly disabled and is not validated.

Remaining validation

LeakSanitizer needs a compatible host. The new integrated GTest and the full SDK/application suites still need Windows validation. The earlier Windows A/B covered the catalog implementation, not those complete suites. The original application's RuntimeCatalogLanguageTest is not claimed fixed until rebuilt and tested against an official fixed SDK release.

No production SDK pins or release artifacts were changed. This remains a draft; the repository's platform CI skips drafts, so no full CI pass is claimed.

Fixes #225.

@facontidavide
facontidavide force-pushed the fix/plugin-catalog-unicode-errors branch from 52cdf32 to 1444051 Compare November 13, 2026 23:26
reliable-ly0411 and others added 3 commits November 14, 2026 12:33
Resolve the Unreleased changelog conflict by retaining both the plugin
catalog fix and upstream pre-1.0 changes. Preserve maintainer-rebased
source and regression test unchanged.
…e cannot be stored

The test created its "資料-🚀" directory with the throwing overload of
create_directories, so on a filesystem that rejects supplementary-plane
characters or a non-Unicode encoding it failed in setup although the catalog
behaved correctly. It now uses the error_code overload and skips for an
illegal byte sequence or invalid argument; any other I/O error still fails.

Found by a Codex review of this pull request.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@facontidavide
facontidavide marked this pull request as ready for review November 14, 2026 13:34
facontidavide and others added 2 commits November 14, 2026 14:36
…dable directory

Review follow-ups on the Unicode diagnostics fix, plus one scan defect found
during that review.

The suffix check converted each file's extension to a narrow string. It is
now compared as a path, so no file name can make the scan throw there.

scanPluginDsos threw "recursive_directory_iterator cannot pop" on the first
subdirectory it could not read, on every platform: after a failed increment
the iterator is already at the end. An unreadable directory is now found
before the scan descends into it, reported as a diagnostic, and skipped.

The Unicode test asserts the "not a platform plugin DSO" text and calls the
handle overload with a non-plugin path, which nothing exercised.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…nicode roots

file_lock.cpp and fs_durability.cpp built their error text with
path.string(), which on Windows narrows through the active code page and
throws for a name it cannot represent. "Lock is held elsewhere" is an
ordinary outcome during cache cleanup and eviction, so a cache root with
such a name threw there instead of reporting contention.

A private pathUtf8() helper replaces those conversions and the two inline
copies of the same idiom in request_cache.cpp. POSIX output is unchanged.

The changelog entry now covers the catalog and the cache fixes together and
says that these messages are UTF-8 on Windows.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@facontidavide
facontidavide merged commit f45dfac into PlotJuggler:main Nov 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: Unicode plugin paths throw error 1113 while formatting catalog failures

3 participants