fix(liveliness): escape '/' in backend names embedded in key expressions#970
Open
YuanYuYuan wants to merge 1 commit intoros2:native_bufferfrom
Open
fix(liveliness): escape '/' in backend names embedded in key expressions#970YuanYuYuan wants to merge 1 commit intoros2:native_bufferfrom
YuanYuYuan wants to merge 1 commit intoros2:native_bufferfrom
Conversation
ahcorde
approved these changes
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Escape
/inescape_backend_field()so backend names or metadata containing a forward slash do not corrupt the liveliness key expression in #930.Key Changes
rmw_zenoh_cpp/src/detail/liveliness_utils.cpp— addcase '/': out += "%2F"; break;toescape_backend_field().Rationale
The design note for the optional
<backends>keyexpr component lists:,;, and/as the reserved separators that backend fields must not contain verbatim.unescape_backend_field()already handles%2Fcorrectly via its generic%XXdecoder, so the encode/decode pair becomes symmetric with this change.Without this escape, a backend plugin whose
get_backend_type()returns e.g."cuda/v2"or"vendor/gpu"would embed a literal/in the liveliness token, which the keyexpr parser treats as a field separator — silently corrupting the<backends>component for every peer.Breaking Changes
None.
/is not currently produced by any known backend, so this only closes a latent correctness hole. Existing tokens without/in backend fields are byte-identical before and after this change.Did you use Generative AI?
Yes. Claude (claude-sonnet-4-6) via Claude Code was used to assist with creating an initial prototype version of the changes contained in this PR.