conan: [bug] "conan profile detect" detects compiler versions with 3 digits but ships settings.yml only with 2 digits

Describe the bug

Environment: Windows 11 Conan Versions >= 2.4 up to at least 2.16.1. MinGw Compiler version x.y.z

Conan detects the MinGw compiler version and puts it to the default profile with all 3 digits x.y.z. Subsequent conan commands fail with an error message like: ERROR: Invalid setting 'x.y.z' is not a valid 'settings.compiler.version' value. This is because in the settings.yml all compiler versions are only given with either one or two digits only.

Possible root cause: With this change: https://github.com/conan-io/conan/pull/16362/commits/c7cd0dfb23d11979a08dd5d72d82934ee6aa4954 There was a “+” sign added in the regex-group: installed_version = re.search(r" ([0-9]+(\.[0-9])+)", out).group() When this “+” is changed to a “?” it seems to work as expected again to have only 2 digits in the default profile. Maybe the intention of the developer was to have the “+” inside the group to allow minor versions >9?

How to reproduce it

  1. Install a MinGw Compiler with a 3 digit version x.y.z.
  2. run: conan profile detect
  3. run then e.g. a proper"conan install" command.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (15 by maintainers)

Commits related to this issue

Most upvoted comments

If the compiler version is 1.2.3 put only 1.2 into the default profile. If the compiler version is 444.5555.6666 put only 444.5555 into the default profile.

This is being already done, but only for versions gcc < 5. Otherwise only the major is displayed, and this is the expected behavior

I do not understand why you have implemented any case decisions based on the major version:

Because gcc changed its binary compatibility model in gcc 5, meaning that the minor version from 5.X does not generate binary incompatibilities, while in gcc 4.X, the different 4.8, 4.9 versions could be binary incompatible