Skip to content

BUG: grep: Invalid option -- P when running spin lint on macOS #29538

@math-hiyoko

Description

@math-hiyoko

Describe the issue:

When running spin lint on macOS, the command fails with the following error.
It seems that the grep command on macOS (BSD grep) does not support the -P option (Perl-compatible regex), which is available on GNU grep. This causes the linting step to break out of the box.

Lightning-AI/pytorch-lightning#19938 is a similar issue.

Reproduce the code example:

$ spin lint

Error message:

Running Ruff Check...
All checks passed!

Running C API borrow-reference linter...
grep: invalid option -- P
usage: grep [-abcdDEFGHhIiJLlMmnOopqRSsUVvwXxZz] [-A num] [-B num] [-C[num]]
        [-e pattern] [-f file] [--binary-files=value] [--color=when]
        [--context[=num]] [--directories=action] [--label] [--line-buffered]
        [--null] [pattern] [file ...]
grep: invalid option -- P
usage: grep [-abcdDEFGHhIiJLlMmnOopqRSsUVvwXxZz] [-A num] [-B num] [-C[num]]
        [-e pattern] [-f file] [--binary-files=value] [--color=when]
        [--context[=num]] [--directories=action] [--label] [--line-buffered]
        [--null] [pattern] [file ...]
...

Python and NumPy Versions:

commit hash: 622f874

Runtime Environment:

$ grep --version
grep (BSD grep, GNU compatible) 2.6.0-FreeBSD

Context for the issue:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions