Skip to content

bash shebang length limitation in bootstrap wrapper for gcc #219

Closed

Description

@pjotrp

When using very long path names for the store, such as

/home/pprins/opt/nix/my-very-long-path-which-we-patch-later/store/gzcj4rdviw533whvhca9lmbxj0n9v550-bootstrap-tools/bin

the gcc wrapper fails to run because of a shebang length limitation (apparently it is 80). Not sure it is possible, but maybe we could relax that constraint for bash.

Activity

  1. shlevy commented on Mar 9, 2014

    @shlevy
    Member

    This is almost certainly a kernel limitation, not a bash one. The kernel is the one that parses shebangs

  2. pjotrp commented on Mar 9, 2014

    @pjotrp
    Author

    I'll make do with shorter paths then ;). Thanks.

  3. vcunat commented on Mar 9, 2014

    @vcunat
    Member

    If it was 80, we might hit this even with standard nix prefix -- our lengths are 44 chars + -name-version just for the root of any package. However, in our linuxHeaders I see 128 as the limit.

    http://stackoverflow.com/questions/10813538/shebang-line-limit-in-bash-and-linux-kernel

  4. pjotrp commented on Mar 11, 2014

    @pjotrp
    Author

    I do not have the error now, but it said something like: 'invalid command /home/pprins/opt/nix/my-very-long-path-which-we-patch-later/store/gzcj4', i.e. truncated at 72. Other Nix paths can be longer, as long as they don't call the location of a long shebang, the way the bootstrap scripts do. To me it looks like the shebang does have a limitation of 80 on the CentOS kernel underneath.

    Otherwise I would have not had the problem. It got fixed by using a shorter path.

  5. vcunat commented on Mar 11, 2014

    @vcunat
    Member

    Having interpreters from nix store in shebangs is unavoidable, otherwise there can be problems like NixOS/nixpkgs#1870. The only chance might be if the limit is only per-line and backslash-joining of lines work, but I don't even know if this is the case, and it seems quite complicated anyway.

  6. added a commit that references this issue on Feb 26, 2025
  7. added a commit that references this issue on Oct 14, 2025
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