Skip to content

Powershell plugin breaks path separators on Linux #39

@Flova

Description

@Flova

As Powershell is theoretically also available on Linux it might be loaded by colcon to run commands due to its high internal priority. This is for example the case in GitHub actions, which come with Powershell installed. This auto selection is a bit strange, but not an issue per se.

Powershell and Windows use a semicolon as the path separator in e.g. the CMAKE_PREFIX_PATH but if Powershell is used on Linux this results in a missmatch as colcon and most other software use os.pathsep, which is a : on Linux. This results in e.g. the CMAKE_PREFIX_PATH containing both separator types, which breaks e.g. cmake which only expects : to be present on Linux. This then results in the paths around the ; not being discovered, as they are treated as one malformed/non existent path, resulting in package discovery errors.

The wrong semicolon in the CMAKE_PREFIX_PATH is inserted between the already build local packages and previous contents of the environment variable. This results in the issue being most pronounced if CMAKE_PREFIX_PATH already contains something, which is the case if e.g. pixi is used to supply some cmake packages.

Possible fixes:

  • Uninstall Powershell. Depending on the environment this is not possible, also uninstalling is not enough as the environment variable PSModulePath which this extension uses to check for Powershell might prevail. Note that GitHub actions come with both by default.
  • Disable the Powershell extension for Linux. Add a check similar to the ones that are already present for other shell extensions.
  • Do some hack which manually sanitizes the paths inside the Powershell script when a Linux platform is detected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions