Skip to content

General fixupPhase patchShebangs strategy is in conflict with OS X (and BSD flavor) for wrapped interpreter #238

Closed

Description

@wavewave

A stdenv derivation replaces shebang line in shell scripts during fixupPhase. Current strategy is that when this meets #!/usr/bin/env (interpreter command), it replaces the whole line with actual command for the interpreter. Therefore, for example, the first line of a python script starting with

#!/usr/bin/env python

is changed to

#!/nix/store/....-python-2.7.6-wrapper/bin/python

This works in linux systems, but does not work on BSD flavored systems like OS X since they do not allow another shell script to play a role as an interpreter.
A relevant link is here:
http://www.in-ulm.de/~mascheck/various/shebang/#interpreter-script

I suggest to keep /usr/bin/env as /nix/store/...-coreutils-../bin/env when being replaced by patchShebangs during fixupPhase

Activity

  1. wavewave commented on Apr 6, 2014

    @wavewave
    ContributorAuthor

    I posted this issue on rather wrong place. I reposted this on the nixpkgs issue list.

  2. imz commented on Jan 23, 2015

    @imz

    Is this really the wrong place to post such an issue (I also have one)?

    I thought that nixpkgs is for package descriptions (rules to build them), whereas this looks like an issue in the tool that manages the building and installing of packages, namely nix, doesn't it?

    Have there been any follow-up messages to your issue report?

  3. shlevy commented on Jan 23, 2015

    @shlevy
    Member

    @imz patchShebangs is part of the standard environment for building packages in nixpkgs, nix itself knows nothing about it.

  4. imz commented on Jan 23, 2015

    @imz

    @shlevy Ok, thanks for the clarification! I'm just getting to know nix, trying things out.

    (And my issue turned out not to be an issue of nix. Strangely, a script installed user-locally under nix failed to run in eshell in Emacs, whereas the same program could run this way when installed as a system package from my distro, and the path from shebang appeared in an error message. Actually, it runs well in a normal terminal, and I remembered that I had a similar issue with building stuff in a kind of sandbox from eshell, too. -- https://bugzilla.altlinux.org/show_bug.cgi?id=30673)

  5. added a commit that references this issue on Jan 1, 2024
  6. added a commit that references this issue on Feb 26, 2025
  7. added a commit that references this issue on Nov 4, 2025
  8. added a commit that references this issue on May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions