Skip to content

Commit

Permalink
/bin/bash does not exist on certain systems (#615)
Browse files Browse the repository at this point in the history
* Convert shebang /bin/bash -> /usr/bin/env bash

/bin/bash does not exist on some systems, notably [NixOS][1] and
some of the [BSDs][2]. Using `/usr/bin/env bash` is the more compatible
option.

[1]: https://nixos.org/
[2]: https://stackoverflow.com/a/21613044/841562

* Use patched version of java_stub_template
  • Loading branch information
aherrmann authored and ittaiz committed Sep 20, 2018
1 parent a0436ef commit 2676400
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion scala/private/rule_impls.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def _write_java_wrapper(ctx, args = "", wrapper_preamble = ""):
wrapper = ctx.actions.declare_file(ctx.label.name + "_wrapper.sh")
ctx.actions.write(
output = wrapper,
content = """#!/bin/bash
content = """#!/usr/bin/env bash
{preamble}
{exec_str}{javabin} "$@" {args}
Expand Down
4 changes: 2 additions & 2 deletions scala/scala.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def scala_repositories(
)

# Template for binary launcher
BAZEL_JAVA_LAUNCHER_VERSION = "0.14.1"
BAZEL_JAVA_LAUNCHER_VERSION = "0.17.1"
java_stub_template_url = (
"raw.githubusercontent.com/bazelbuild/bazel/" +
BAZEL_JAVA_LAUNCHER_VERSION +
Expand All @@ -375,7 +375,7 @@ def scala_repositories(
"https://%s" % java_stub_template_url
],
sha256 =
"2cbba7c512e400df0e7d4376e667724a38d1155db5baaa81b72ad785c6d761d1",
"39097bdc47407232e0fe7eed4f2c175c067b7eda95873cb76ffa76f1b4c18895",
)

native.bind(
Expand Down
2 changes: 1 addition & 1 deletion test/test_binary.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

echo "Executing: " $@
$@
2 changes: 1 addition & 1 deletion test_all.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -euo pipefail

Expand Down
2 changes: 1 addition & 1 deletion test_intellij_aspect.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Test the IntelliJ aspect. Override intellij's rules_scala with this one for an
# integration test. See https://github.com/bazelbuild/rules_scala/issues/308.
Expand Down
2 changes: 1 addition & 1 deletion test_lint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -eou pipefail

Expand Down
2 changes: 1 addition & 1 deletion test_reproducibility.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion test_rules_scala.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion test_runner.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Test runner functions for rules_scala integration tests.

Expand Down
2 changes: 1 addition & 1 deletion test_version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion test_version/version_specific_tests_dir/test_binary.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

echo "Executing: " $@
$@

0 comments on commit 2676400

Please sign in to comment.