1. 15
  1. 5

    Hmm… Pretty cool! NixOS recently fixed an issue with 32MB large shebangs. I wonder if this does actually work on macOS? I thought macOS prohibited the program in a shebang from being a script with a shebang? already in the README. It might be interesting to note that Perl already re-parses its shebang on startup, to handle very large shebangs.

    1. 1

      I saw that story – is there hope that they’ll actually improve the shebang mechanism with whatever the solution to this is?

      There is work being done to achieve the original goal (preventing the kernel from possibly running the wrong interpreter) while not breaking existing users; that is proving harder than one might expect and will almost certainly have to wait for 5.1.

      It’s too bad that the -I magic nix does with perl is perl-specifc (and that it requires 32MB shebangs). Does nix similarly isolate other interpreted languages this way?

    2. 2

      This seems fine and reasonable but I’m curious: for whom it is that the limitation which this works around ever comes up?

      1. 1

        With multi-user machines (as at HPC sites) this comes up a lot, as people are likely to install software in their home directory and in shared project directories with deep paths.

        1. 2


      2. 1


        #!/usr/bin/env -S /long/path/to/real/interpreter with many arguments

        be a solution if their env implementation accepts the -S switch?

        1. 1

          env -S allows many arguments, yes, but the OS will still truncate that line at the max shebang limit. So if /long/path/to/real/interpreter is very long (> 127 chars is the total line length limit on Linux), you will miss all the arguments and possibly part of the interpreter path. See https://www.in-ulm.de/~mascheck/various/shebang/ for lots of details and https://lwn.net/Articles/779997/ for an interesting story on nix and long shebangs.

          1. 1

            Whauw, 127 characters is not a lot.

            Thanks for the interesting links!