RFR: 7902970: Script build.sh will fail if the default shell is dash [v2]

Guoxiong Li gli at openjdk.java.net
Thu Jul 8 04:47:21 UTC 2021


> Hi all,
> 
> My local default shell is `dash`.
> 
> 
> $ ls -al /bin/*sh*
> -rwxr-xr-x 1 root root 1113504 Jun 7 2019 /bin/bash
> -rwxr-xr-x 1 root root 121432 Jan 25 2018 /bin/dash
> lrwxrwxrwx 1 root root 4 Sep 26 2020 /bin/rbash -> bash
> lrwxrwxrwx 1 root root 4 Sep 26 2020 /bin/sh -> dash
> lrwxrwxrwx 1 root root 4 Sep 26 2020 /bin/sh.distrib -> dash
> lrwxrwxrwx 1 root root 7 Sep 18 2020 /bin/static-sh -> busybox
> 
> 
> When I use the command `sh make/build.sh --help`, the build.sh will fail.
> Because the `dash` doesn't support the variables such as `BASH_SOURCE`.
> 
> 
> $ sh make/build.sh --help
> make/build.sh: 252: make/build.sh: Bad substitution
> make/build.sh: 253: make/build.sh: Bad substitution
> make/build.sh: 254: .: Can't open /build-support/build-common.sh
> 
> 
> The successful command is `bash make/build.sh --help`, which uses `bash` explicitly
> instead of the default shell `sh` implicitly.
> 
> This patch clarifies this situation in the README.
> Thanks for taking the time to review.
> 
> Best Regards,
> -- Guoxiong

Guoxiong Li has updated the pull request incrementally with one additional commit since the last revision:

  Revise the README according to the review comment

-------------

Changes:
  - all: https://git.openjdk.java.net/jtreg/pull/12/files
  - new: https://git.openjdk.java.net/jtreg/pull/12/files/08751fb2..bd0b6be0

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jtreg&pr=12&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jtreg&pr=12&range=00-01

  Stats: 4 lines in 1 file changed: 0 ins; 3 del; 1 mod
  Patch: https://git.openjdk.java.net/jtreg/pull/12.diff
  Fetch: git fetch https://git.openjdk.java.net/jtreg pull/12/head:pull/12

PR: https://git.openjdk.java.net/jtreg/pull/12


More information about the jtreg-dev mailing list