Repository navigation
Remove Unix SystemString iconv dependency - #612
Noam Hershtig (noamher) wants to merge 6 commits into
Conversation
Replace the Unix conversion internals with strict self-contained UTF-8 and UTF-16 handling while preserving existing bounds and destination-state behavior. Add comprehensive conversion and malformed-input coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Extract strict UTF-8 and UTF-16 decoding and encoding helpers, use bounded strnlen with an overflow-proof limit check, and preserve existing conversion behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Clarify UTF-8 and UTF-16 helper contracts, malformed-sequence cases, and canonical encoding ranges without changing behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Wiktor Kopec (@wiktork) for his input as well. I have some concerns about the custom Unicode conversion routines. Though this was written by an LLM, do we know the code provenance? My concern is that it may be derived from, or very close to, an implementation that licensed under a license incompatible with MIT. I also don't want to have to maintain a custom Unicode conversion implementation. Since we use vcpkg to pull in other dependencies such as libxml2, why not pull in an existing package? One suggestion is to use UTF8-CPP (Boost licensed) to do the actual conversion. |
|
@microsoft-github-policy-service agree company="Microsoft" |
Let me check about using UTF8-CPP. |
@microsoft-github-policy-service agree company="Microsoft" |
Replace the custom Unix Unicode conversion helpers with checked UTF8-CPP adapters while preserving existing bounds, error, and destination-state behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
good catch. I've updated the pr to use UTF8-CPP. WDYT? |
|
Please also update THIRD-PARTY-NOTICES.txt |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Patrick Nelson (@plnelson) Added the UTF8-CPP attribution and complete Boost Software License 1.0 text to |
Restore platform-specific vcpkg dependencies on Linux and macOS, keep libxml2 vcpkg usage Linux-only, and focus conversion tests on CLRIE adapter behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/azp run ClrInstrumentationEngine-PR-Yaml |
Motivation
CLRIE currently uses
iconvin the UnixSystemStringimplementation to convert between UTF-8 and UTF-16 during profiler initialization.Although the
iconvAPI is provided by glibc, many character-set converters are loaded dynamically from glibc's gconv modules. Minimal Linux distributions and container images do not always include those modules. In particular, minimal Azure Linux 3 images package them separately inglibc-iconv.When the UTF-16 converter is unavailable,
iconv_open("UTF-16LE", "UTF-8")fails andSystemString::Convertcannot process CLRIE configuration and path strings. This can prevent the instrumentation engine from initializing unless the host image is modified to install or stage the missing gconv modules.CLRIE is commonly injected into existing application containers, where changing the base image or installing an additional OS package may be undesirable or impossible. Making this core conversion self-contained allows CLRIE to initialize on minimal Linux images such as Azure Linux 3 without requiring host gconv modules for
SystemStringconversion.Summary
SystemStringiconv implementation with strict, self-contained UTF-8/UTF-16 conversion.Scope
libxml2[iconv]remains unchanged because it serves libxml2's support for non-UTF-8 XML encodings and is separate fromSystemString.SystemStringdependency on iconv/gconv; it does not claim to remove every iconv symbol contributed by libxml2 from the final engine binary.Validation
StringConversionTests: 9/9 passed in targeted validation.XmlTests: 2/2 passed in targeted validation.systemstring.cpp.oandlibCommon.Lib.acontain no iconv references.