From 3cf515d516682f6edb4466df9facef69f2114304 Mon Sep 17 00:00:00 2001 From: Yannick Goumaz <61198661+ygoumaz@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:43:13 +0200 Subject: [PATCH] Improve Webots and libcontroller version comparison (#6315) * only compare major version * Update changelog-r2023.md --- docs/reference/changelog-r2023.md | 1 + src/controller/c/robot.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/changelog-r2023.md b/docs/reference/changelog-r2023.md index 67dc7a6b230..6200e38bfef 100644 --- a/docs/reference/changelog-r2023.md +++ b/docs/reference/changelog-r2023.md @@ -8,6 +8,7 @@ Released on XXX XXth, 2023. - Improved overlays visible in Overlays menu by adding all the robots in the menu list ([#6297](https://github.com/cyberbotics/webots/pull/6297)). - Bug fixes - Fixed errors loading template PROTO if the system user name, the project path, or the temporary directory path contains the `\` character ([#6288](https://github.com/cyberbotics/webots/pull/6288)). + - Fixed Webots and libController version comparison not to take revisions into account ([#6315](https://github.com/cyberbotics/webots/pull/6315)). ## Webots R2023b Released on June 28th, 2023. diff --git a/src/controller/c/robot.c b/src/controller/c/robot.c index 3e59646f8c4..82737af5e20 100644 --- a/src/controller/c/robot.c +++ b/src/controller/c/robot.c @@ -358,8 +358,7 @@ static void robot_configure(WbRequest *r) { robot.device[0]->name = request_read_string(r); WEBOTS_VERSION = request_read_string(r); - if (strlen(WEBOTS_VERSION) && (strlen(WEBOTS_VERSION) != strlen(LIBCONTROLLER_VERSION) || - strncmp(WEBOTS_VERSION, LIBCONTROLLER_VERSION, strlen(WEBOTS_VERSION)))) + if (strlen(WEBOTS_VERSION) && (strncmp(WEBOTS_VERSION, LIBCONTROLLER_VERSION, 6))) fprintf(stderr, "Warning: Webots [%s] and libController [%s] versions are not the same for Robot '%s'! Different versions can lead " "to undefined behavior.\n",