Opened 9 years ago

Closed 9 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

Change History (9)

comment:1 by Boris Bobrov, 9 years ago

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

comment:3 by Sebastian Hugentobler, 9 years ago

would also fix #5312

comment:4 by ShawnRisk, 9 years ago

Owner: Boris Bobrov removed
Status: in_progressreview

comment:5 by Christopher Allan Webber, 9 years ago

Resolution: fixed
Status: reviewclosed

Good call. Merged and pushed, thank you!

comment:6 by Christopher Allan Webber, 9 years ago

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 by Christopher Allan Webber, 9 years ago

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

comment:8 by Christopher Allan Webber, 9 years ago

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 by Christopher Allan Webber, 9 years ago

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.