RFR: 7902970: Script build.sh will fail if the default shell is dash
Jonathan Gibbons
jjg at openjdk.java.net
Thu Jul 8 03:41:55 UTC 2021
On Sat, 12 Jun 2021 15:05:49 GMT, Guoxiong Li <gli at openjdk.org> wrote:
> 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
Changes requested by jjg (Lead).
README.md line 33:
> 31:
> 32: % bash make/build.sh --jdk JDK-directory
> 33:
Suggest simplifying it to:
If your shell is not compatible with `bash`, you may need to invoke `bash` explicitly:
% bash make/build.sh --jdk JDK-directory
-------------
PR: https://git.openjdk.java.net/jtreg/pull/12
More information about the jtreg-dev
mailing list