Skip to contentSkip to conversation

Fix bash path in shebangs

PATCH In review [email protected] 3 participants 7 messages Jul 27, 2017 – Jul 31, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix bash path in shebangs

From: Alan Somers <[email protected]>

"/bin/bash" is a Linuxism. "/usr/bin/env bash" is portable.

---
 examples/performance-thread/l3fwd-thread/test.sh | 2 +-
 usertools/dpdk-setup.sh                          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
examples/performance-thread/l3fwd-thread/test.sh +1 -1
index b7718b622..eb1fe2dc2 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 case "$1" in
 
usertools/dpdk-setup.sh +1 -1
index c4fec5a63..ebf36f830 100755
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
 
 #   BSD LICENSE
 #
Signature · 1 line
2.13.3
#1 lore raw
Quoted 15 lines · On Thu, Jul 27, 2017 at 02:41:46PM -0600, [email protected] wrote:

From: Alan Somers <[email protected]>

"/bin/bash" is a Linuxism. "/usr/bin/env bash" is portable.

---
 examples/performance-thread/l3fwd-thread/test.sh | 2 +-
 usertools/dpdk-setup.sh                          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
examples/performance-thread/l3fwd-thread/test.sh +0 -0
index b7718b622..eb1fe2dc2 100755

examples/performance-thread/l3fwd-thread/test.sh line 4

Quoted 5 lines
examples/performance-thread/l3fwd-thread/test.sh +1 -1
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 case "$1" in
 

This script doesn't look to be using any bash specific features to me, so a better fix might be to change it to use /bin/sh rather than requiring bash itself. [Needs testing, to check there isn't something bash-specific hidden away, obviously]

usertools/dpdk-setup.sh line 4

Quoted 11 lines
usertools/dpdk-setup.sh +1 -1
index c4fec5a63..ebf36f830 100755
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
 
 #   BSD LICENSE
 #

Not sure having this linux-specific is a problem for dpdk-setup.sh, since I don't think large parts of that script work with BSD anyway, e.g. it assumes a linux hugetlbfs filesystem for hugepage setup. Not that there is any harm in making the change you suggest either.

/Bruce

#2 lore raw
Quoted 19 lines · Bruce Richardson
Quoted 18 lines · On Thu, Jul 27, 2017 at 02:41:46PM -0600, [email protected] wrote:

From: Alan Somers <[email protected]>

"/bin/bash" is a Linuxism. "/usr/bin/env bash" is portable.

---
 examples/performance-thread/l3fwd-thread/test.sh | 2 +-
 usertools/dpdk-setup.sh                          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
examples/performance-thread/l3fwd-thread/test.sh +1 -1
index b7718b622..eb1fe2dc2 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
Quoted 6 lines

examples/performance-thread/l3fwd-thread/test.sh line 4

Quoted 2 lines
examples/performance-thread/l3fwd-thread/test.sh +0 -0
 case "$1" in
 

This script doesn't look to be using any bash specific features to me, so a better fix might be to change it to use /bin/sh rather than requiring bash itself. [Needs testing, to check there isn't something bash-specific hidden away, obviously]

True. Unfortunately, I can't test it right now because I can't get DPDK to build on either Linux or FreeBSD, and I'm out of time to debug the build failures for now. Would you like me to resubmit the patch, altered to use /bin/sh, without testing?

Quoted 9 lines
Quoted 9 lines
usertools/dpdk-setup.sh +1 -1
index c4fec5a63..ebf36f830 100755
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
 
Quoted 7 lines

usertools/dpdk-setup.sh

Quoted 3 lines
usertools/dpdk-setup.sh +0 -1
 #   BSD LICENSE
 #
--

Not sure having this linux-specific is a problem for dpdk-setup.sh, since I don't think large parts of that script work with BSD anyway, e.g. it assumes a linux hugetlbfs filesystem for hugepage setup. Not that there is any harm in making the change you suggest either.

Yep, that's what I figured.

-Alan

#3 lore raw
Quoted 28 lines · alan somers
Quoted 19 lines · Bruce Richardson
Quoted 18 lines · On Thu, Jul 27, 2017 at 02:41:46PM -0600, [email protected] wrote:

From: Alan Somers <[email protected]>

"/bin/bash" is a Linuxism. "/usr/bin/env bash" is portable.

---
 examples/performance-thread/l3fwd-thread/test.sh | 2 +-
 usertools/dpdk-setup.sh                          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
examples/performance-thread/l3fwd-thread/test.sh +1 -1
index b7718b622..eb1fe2dc2 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
Quoted 6 lines

examples/performance-thread/l3fwd-thread/test.sh line 4

Quoted 2 lines
examples/performance-thread/l3fwd-thread/test.sh +0 -0
 case "$1" in
 

This script doesn't look to be using any bash specific features to me, so a better fix might be to change it to use /bin/sh rather than requiring bash itself. [Needs testing, to check there isn't something bash-specific hidden away, obviously]

Quoted 6 lines

True. Unfortunately, I can't test it right now because I can't get DPDK to build on either Linux or FreeBSD, and I'm out of time to debug the build failures for now. Would you like me to resubmit the patch, altered to use /bin/sh, without testing?

Quoted 1 line

I'm not sure it's that important a change that we need to rush into doing so.

What difficulties are you having getting DPDK to build? Is it just platform setup issues?

/Bruce

#4 lore raw
Quoted 35 lines · Bruce Richardson
Quoted 28 lines · alan somers
Quoted 19 lines · Bruce Richardson
Quoted 18 lines · On Thu, Jul 27, 2017 at 02:41:46PM -0600, [email protected] wrote:

From: Alan Somers <[email protected]>

"/bin/bash" is a Linuxism. "/usr/bin/env bash" is portable.

---
 examples/performance-thread/l3fwd-thread/test.sh | 2 +-
 usertools/dpdk-setup.sh                          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
examples/performance-thread/l3fwd-thread/test.sh +1 -1
index b7718b622..eb1fe2dc2 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
Quoted 6 lines

examples/performance-thread/l3fwd-thread/test.sh line 4

Quoted 2 lines
examples/performance-thread/l3fwd-thread/test.sh +0 -0
 case "$1" in
 

This script doesn't look to be using any bash specific features to me, so a better fix might be to change it to use /bin/sh rather than requiring bash itself. [Needs testing, to check there isn't something bash-specific hidden away, obviously]

Quoted 6 lines

True. Unfortunately, I can't test it right now because I can't get DPDK to build on either Linux or FreeBSD, and I'm out of time to debug the build failures for now. Would you like me to resubmit the patch, altered to use /bin/sh, without testing?

Quoted 1 line
Quoted 5 lines

I'm not sure it's that important a change that we need to rush into doing so.

What difficulties are you having getting DPDK to build? Is it just platform setup issues?

On Linux, I fail for lack of numa.h. The docs say to install libnuma-devel, but that package doesn't exist on my distro (Ubuntu 16.04). On FreeBSD, I get this compile error /usr/home/alans/freebsd/head/sys/vm/vm_phys.h:120:2: error: use of undeclared

      identifier 'vm_cnt'
        vm_cnt.v_free_count += adj;

On FreeBSD stable/11, I get a litany of errors, beginning with:
n file included from contigmem.c:49:
In file included from ./machine/bus.h:6:
In file included from ./x86/bus.h:1038:
In file included from ./machine/bus_dma.h:32:
./x86/bus_dma.h:43:1: error: static declaration of 'bus_dmamap_create' follows
non-static declaration
bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) ^
/usr/home/alans/freebsd/stable_11/sys/sys/bus_dma.h:262:5: note: previous
declaration is here
int bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp);

And on FreeBSD stable/10, I get a make error:
make[6]: "/usr/home/alans/freebsd/stable_10/sys/conf/kern.mk" line 43:
Malformed conditional (${MK_FORMAT_EXTENSIONS} == "no")

-Alan

#5 lore raw
Quoted 46 lines · alan somers
Quoted 35 lines · Bruce Richardson
Quoted 28 lines · alan somers
Quoted 19 lines · Bruce Richardson
Quoted 18 lines · On Thu, Jul 27, 2017 at 02:41:46PM -0600, [email protected] wrote:

From: Alan Somers <[email protected]>

"/bin/bash" is a Linuxism. "/usr/bin/env bash" is portable.

---
examples/performance-thread/l3fwd-thread/test.sh | 2 +-
usertools/dpdk-setup.sh | 2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
examples/performance-thread/l3fwd-thread/test.sh +1 -1
index b7718b622..eb1fe2dc2 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
Quoted 6 lines
Quoted 2 lines

case "$1" in

This script doesn't look to be using any bash specific features to me, so a better fix might be to change it to use /bin/sh rather than requiring bash itself. [Needs testing, to check there isn't something bash-specific hidden away, obviously]

Quoted 6 lines

True. Unfortunately, I can't test it right now because I can't get DPDK to build on either Linux or FreeBSD, and I'm out of time to debug the build failures for now. Would you like me to resubmit the patch, altered to use /bin/sh, without testing?

Quoted 1 line
Quoted 5 lines

I'm not sure it's that important a change that we need to rush into doing so.

What difficulties are you having getting DPDK to build? Is it just platform setup issues?

Quoted 6 lines

On Linux, I fail for lack of numa.h. The docs say to install libnuma-devel, but that package doesn't exist on my distro (Ubuntu 16.04). On FreeBSD, I get this compile error /usr/home/alans/freebsd/head/sys/vm/vm_phys.h:120:2: error: use of undeclared

     identifier 'vm_cnt'
       vm_cnt.v_free_count += adj;

On my Ubuntu 17.04 the package is called libnuma-dev

Quoted 14 lines

On FreeBSD stable/11, I get a litany of errors, beginning with:
n file included from contigmem.c:49:
In file included from ./machine/bus.h:6:
In file included from ./x86/bus.h:1038:
In file included from ./machine/bus_dma.h:32:
./x86/bus_dma.h:43:1: error: static declaration of 'bus_dmamap_create' follows
non-static declaration
bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) ^
/usr/home/alans/freebsd/stable_11/sys/sys/bus_dma.h:262:5: note: previous
declaration is here
int bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp);

Quoted 5 lines

And on FreeBSD stable/10, I get a make error:
make[6]: "/usr/home/alans/freebsd/stable_10/sys/conf/kern.mk" line 43:
Malformed conditional (${MK_FORMAT_EXTENSIONS} == "no")

-Alan

Regards,
Keith

#6 lore raw
Quoted 46 lines · Keith
Quoted 46 lines · alan somers
Quoted 40 lines · Bruce Richardson
Quoted 28 lines · alan somers
Quoted 19 lines · Bruce Richardson
Quoted 18 lines · On Thu, Jul 27, 2017 at 02:41:46PM -0600, [email protected] wrote:

From: Alan Somers <[email protected]>

"/bin/bash" is a Linuxism. "/usr/bin/env bash" is portable.

---
examples/performance-thread/l3fwd-thread/test.sh | 2 +-
usertools/dpdk-setup.sh | 2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
examples/performance-thread/l3fwd-thread/test.sh +1 -1
index b7718b622..eb1fe2dc2 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
Quoted 6 lines
Quoted 2 lines

case "$1" in

This script doesn't look to be using any bash specific features to me, so a better fix might be to change it to use /bin/sh rather than requiring bash itself. [Needs testing, to check there isn't something bash-specific hidden away, obviously]

Quoted 6 lines

True. Unfortunately, I can't test it right now because I can't get DPDK to build on either Linux or FreeBSD, and I'm out of time to debug the build failures for now. Would you like me to resubmit the patch, altered to use /bin/sh, without testing?

Quoted 1 line

I'm not sure it's that important a change that we need to rush into doing so.

What difficulties are you having getting DPDK to build? Is it just platform setup issues?

Quoted 8 lines
Quoted 6 lines

On Linux, I fail for lack of numa.h. The docs say to install libnuma-devel, but that package doesn't exist on my distro (Ubuntu 16.04). On FreeBSD, I get this compile error /usr/home/alans/freebsd/head/sys/vm/vm_phys.h:120:2: error: use of undeclared

     identifier 'vm_cnt'
       vm_cnt.v_free_count += adj;

On my Ubuntu 17.04 the package is called libnuma-dev

Thanks. That gets dpdk to build. But the performance-thread directory still doesn't. I could dig futher, but I'm really out of time for this task. That's why I suggest just changing the shebang to find bash from the PATH, rather than use a different shell entirely.

-alan