Skip to content

Inconsistent python on mac depending on bash option #132

Closed
@moble

Description

@moble

Describe the bug
There's a really unfortunate and mostly silent bug that happens only on macos — not on ubuntu or windows. I'm not sure whether this issue could be solved more easily by setup-python or by virtual-environments, but this is where I think people will look to find this issue. If nothing else, I feel like it should be documented here.

Somewhere, I have a fairly complicated run section that (so that Windows doesn't go nuts) needs bash features — but also the login option to bash. Out of inertia, this became my way of running things:

    runs-on: macos-latest
    steps:
      - uses: actions/setup-python@v2
        with:
          python-version: 3.8

      - name: Some fancy thing
        shell: bash -l {0}
        run: |
          # Some bashy fanciness
          python --version

But the python that gets picked up on macos only is the wrong one — i.e., not 3.8. The reason is obvious if you're looking for it: using bash -l prepends /usr/local/bin:/usr/bin to PATH. The problem is that users probably aren't looking for it; their scripts are silently using the wrong version of python. Again, this is not the behavior on ubuntu or windows, both of which have their PATH variables ordered correctly to find the desired version of python. It's that difference in behavior that I'm calling a bug, and I think it's clear that ubuntu and windows have the preferable behavior.

Which version of the action are you using?

  • v1
  • v2
  • Some other tag (such as v2.0.1 or master)

Environment

  • self-hosted
  • Linux
  • Windows
  • Mac

If applicable, please specify if you're using a container

Python Versions
All versions on Mac

To Reproduce
Run a python command with bash -l as the shell on any mac instance with any python version. A simple workflow is here

Run/Repo Url

https://github.com/moble/test_github_actions_python/actions/runs/222351275

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions