CPack: cmCPackGenerator::GetComponentInstallDirNameSuffix might return illegal directory name
Function cmCPackGenerator::GetComponentInstallDirNameSuffix
and the same function in derived classes might return the given argument without any change, which is the name of an install-component. This name is then used to create a directory on the filesystem.
This, however, can be problematic if the component's name contains characters that cannot be used in file/directory names or if the name is a reserved name on the filesystem.
For example: On Windows, filenames may not contain colons (:
), which are some of the special characters that are (in general) supported in component names (since !7290 (merged)), or may be equal to one of the reserved block-devices (e.g. NUL
or COM
).
Instead of returning the given component as-is from cmCPackGenerator::GetComponentInstallDirNameSuffix
, problematic characters should be replaced by some other character (e.g. an underscore) and reserved names should get prepended with some extra characters.
Maybe there is already a C++ function in CMake's codebase which can do something like that which just needs to get called from within cmCPackGenerator::GetComponentInstallDirNameSuffix
?