mapbox / mapbox/mason

Better handling of unknown platforms

Open
#448 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
258
Forks
68
PR merge metrics
No merged PRs in 30d

Description

Currently if mason is run on a platform that is not one of the supported platforms (linux or osx) then the `MASON_PLATFORM` variable will not be set at https://github.com/mapbox/mason/blob/4da5ec441b9bad3aa546c414b519fee611a77e4d/mason.sh#L9-L15. This leads to and error like:

```
./mason install geometry.hpp 0.9.1
/mason/mason.sh: line 41: MASON_PLATFORM: unbound variable
```

If the `set -u` is removed from both `mason` and `mason.sh` then other errors ensue:

```
./third_party/mason/mason install geometry.hpp 0.9.1
/Users/dane/projects/node-or-tools/third_party/mason/mason.sh: line 41: [: =: unary operator expected
/Users/dane/projects/node-or-tools/third_party/mason/mason.sh: line 72: [: =: unary operator expected
/Users/dane/projects/node-or-tools/third_party/mason/mason.sh: line 102: [: =: unary operator expected
/Users/dane/projects/node-or-tools/third_party/mason/mason.sh: line 132: [: =: unary operator expected
```

I think we should likely catch the unknown `uname` case right away and throw: "Unsupported platform". However one might argue that we could support header-only installations on unknown platforms. @kkaefer is this something you think we should do (and therefore we'd need to fix the bash logic to now blow apart in comparisons)? Or do you agree that we should throw outright?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with platform detection in mason.sh at lines 9-15, then inspect the comparisons and failures reported at lines 41, 72, 102, and 132. Run the mason install geometry.hpp 0.9.1 example on an unsupported platform. Done means the behavior is decided and the command either reports "Unsupported platform" or handles the proposed header-only installation path without shell errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.