Opened 5 years ago

Closed 5 years ago

#5315 closed defect (fixed)

use `env` in shebangs

Reported by: Boris Bobrov Owned by:
Priority: minor Milestone: 0.9.0
Component: programming Keywords: bash, bsd
Cc: Parent Tickets:

Description

bash shebangs be changed to go to #!/usr/bin/env bash instead of /usr/bin/bash. That would make things work out of the box on systems where bash is not in /usr/bin, which is the case in all the BSDs and Solaris

Subtickets

Change History (9)

comment:1 Changed 5 years ago by Boris Bobrov

Milestone: 0.9.0
Owner: set to Boris Bobrov
Status: newin_progress

comment:3 Changed 5 years ago by Sebastian Hugentobler

would also fix #5312

comment:4 Changed 5 years ago by ShawnRisk

Owner: Boris Bobrov deleted
Status: in_progressreview

comment:5 Changed 5 years ago by Christopher Allan Webber

Resolution: fixed
Status: reviewclosed

Good call. Merged and pushed, thank you!

comment:6 Changed 5 years ago by Christopher Allan Webber

Resolution: fixed
Status: closedaccepted

Ah.... so I merged this, and just today, I reverted it!

We have a problem: not using env makes things hard for bsd; using env makes things a non-starter for Guix.

comment:7 Changed 5 years ago by Christopher Allan Webber

We might be able to have autotools make the distinction for us. I'll look into it.

comment:8 Changed 5 years ago by Christopher Allan Webber

Wait a minute, /bin/sh still exists on *bsd systems right? It's just not bash!

We could rewrite our scripts to be more generic-bourne-style (or worst comes to worst, use m4sh) and then still use #!/bin/sh in general as our shebang.... right?

comment:9 Changed 5 years ago by Christopher Allan Webber

Resolution: fixed
Status: acceptedclosed

So previously we were doing #!/usr/bin/bash. We're now doing #!/bin/sh, which is already more generic. Theoretically all posix-y systems should ship with a bourne-compatible /bin/sh, is my understanding.

So, instead people should raise specific bugs if our scripts use bash-specific features. We can then either generic'ify them, or in more difficult cases, use m4sh.

I think with that, it's fine to close this bug.

Note: See TracTickets for help on using tickets.