Skip to content

Perl shebangs should be pinned to a specific version on macOS #11275

@Bo98

Description

@Bo98

Provide a detailed description of the proposed feature

macOS 11.3 changed the default Perl from 5.28 to 5.30. This broke a number of formulae that are built against system Perl 5.28.

Since /usr/bin/perl5.30 exists on all Big Sur versions, I suggest we stop using /usr/bin/perl for shebangs and use the versioned Perl binary instead.

This will also fix an issue where Homebrew formulae break when the user changes the default Perl version themselves (macOS has a defaults property that can do this). For example, Catalina defaults to 5.18 but does support switching the default to 5.28.

The question mostly is how to handle this. If we want to force doing this, then this means effectively making rewrite_shebang detected_perl_shebang, file happen automatically in the Cleaner or similar. This would thus mean it is no longer necessary to rewrite shebangs in the formulae themselves. This however comes with the strong assumption that all the files are designed to be run locally and aren't some remote script to run on a server.

This is linked very closely to #11227 so it makes sense to find a solution here (if we can't do general automatic shebang rewrites then we probably can't solve #11227). The only difference being that what we do here needs to apply to all installs (including builds from source) while #11227 only concerns the bottle.

What is the motivation for the feature?

Doing this means formulae are less prone to break if the default Perl changes, either by Apple or by the user.

How will the feature be relevant to at least 90% of Homebrew users?

Broken formulae are unusable and useless to users.

What alternatives to the feature have been considered?

  • Using brewed Perl instead.
  • Bumping minimum macOS to 11.3 and continue to rely on whatever /usr/bin/perl is. Note however that this won't actually fully fix the issue. The user can still change the default Perl themselves (which I suspect some might end up doing in this case).

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedPR was locked due to age

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions