Skip to content

fix(liveliness): escape '/' in backend names embedded in key expressions#970

Merged
nvcyc merged 1 commit into
ros2:native_bufferfrom
ZettaScaleLabs:fix/escape-backend-name-slash
May 12, 2026
Merged

fix(liveliness): escape '/' in backend names embedded in key expressions#970
nvcyc merged 1 commit into
ros2:native_bufferfrom
ZettaScaleLabs:fix/escape-backend-name-slash

Conversation

@YuanYuYuan
Copy link
Copy Markdown
Contributor

@YuanYuYuan YuanYuYuan commented Apr 23, 2026

Summary

Escape / in escape_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 — add case '/': out += "%2F"; break; to escape_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 %2F correctly via its generic %XX decoder, 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.

@YuanYuYuan YuanYuYuan requested a review from nvcyc April 23, 2026 10:52
@nvcyc nvcyc merged commit eebc3ae into ros2:native_buffer May 12, 2026
5 of 6 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.

3 participants