Skip to content

include/ceph_releases.h: fix to_string(-1) - #72829

Open
MaxKellermann wants to merge 1 commit into
ceph:mainfrom
MaxKellermann:ceph_releases__to_string__cast
Open

MaxKellermann wants to merge 1 commit into
ceph:mainfrom
MaxKellermann:ceph_releases__to_string__cast

Conversation

@MaxKellermann

Copy link
Copy Markdown
Member

A comment in this header says "we used to use -1 for invalid release". This number is (usuallu) represented in the uint8_t as 0xff, and casting the enum to int passes this 0xff instead of -1, causing to_string() to return "unknown" instead of "unspecified".

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

A comment in this header says "we used to use -1 for invalid release".
This number is (usuallu) represented in the `uint8_t` as `0xff`, and
casting the enum to `int` passes this `0xff` instead of `-1`, causing
to_string() to return "unknown" instead of "unspecified".

Signed-off-by: Max Kellermann <[email protected]>
@MaxKellermann

Copy link
Copy Markdown
Member Author

jenkins test make check

2 similar comments
@MaxKellermann

Copy link
Copy Markdown
Member Author

jenkins test make check

@MaxKellermann

Copy link
Copy Markdown
Member Author

jenkins test make check

@tchaikov tchaikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tchaikov

Copy link
Copy Markdown
Contributor

fwiw, we still initialize OSDMap::Incremental::{new_require_osd_release,new_require_min_compat_client} with 0xff. but we don't format them using to_string(), see OSDMap::Incremental::dump(), so no need to backport.

@yuriw

yuriw commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-yuri-testing-20261109.210713-main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants