diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eec14705a66..563389d8f97 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -94,6 +94,13 @@ repos: "python/cuda_cccl/cuda/compute/"] pass_filenames: false + - repo: local + hooks: + - id: check-shebang + name: check-shebang + entry: ci/util/pre-commit/check_shebang.py + language: python + types: [shell] default_language_version: python: python3 diff --git a/benchmarks/scripts/submit_benchmark_job.sh b/benchmarks/scripts/submit_benchmark_job.sh index 11f944e275c..b1b9201fe82 100755 --- a/benchmarks/scripts/submit_benchmark_job.sh +++ b/benchmarks/scripts/submit_benchmark_job.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This script schedules a SLURM job via crun on computelab to run all CCCL benchmarks and produce a benchmark database # TODO: set those accordingly @@ -10,7 +10,7 @@ benchmark_preset="benchmark" batch_script=$scratch/batch.sh cat << BATCH_SCRIPT > "$batch_script" -#!/bin/bash +#!/usr/bin/env bash pip install --break-system-packages fpzip pandas scipy diff --git a/ci/bench/bench.sh b/ci/bench/bench.sh index b5a0d187592..5d08f25d031 100755 --- a/ci/bench/bench.sh +++ b/ci/bench/bench.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/bench/compare_git_refs.sh b/ci/bench/compare_git_refs.sh index 540f1cbdd2b..a20aacd90d4 100755 --- a/ci/bench/compare_git_refs.sh +++ b/ci/bench/compare_git_refs.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/bench/compare_paths.sh b/ci/bench/compare_paths.sh index 77a3b6d9a40..2eb45a4abe3 100755 --- a/ci/bench/compare_paths.sh +++ b/ci/bench/compare_paths.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/bench/parse_bench_matrix.sh b/ci/bench/parse_bench_matrix.sh index e661d03f358..76ce2540e51 100755 --- a/ci/bench/parse_bench_matrix.sh +++ b/ci/bench/parse_bench_matrix.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/build_cccl_c_parallel.sh b/ci/build_cccl_c_parallel.sh index 4207d2e6a54..4ebdacec7db 100755 --- a/ci/build_cccl_c_parallel.sh +++ b/ci/build_cccl_c_parallel.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/build_cccl_c_parallel_hostjit.sh b/ci/build_cccl_c_parallel_hostjit.sh index 4981c902446..8b283b1c025 100755 --- a/ci/build_cccl_c_parallel_hostjit.sh +++ b/ci/build_cccl_c_parallel_hostjit.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/build_cccl_c_stf.sh b/ci/build_cccl_c_stf.sh index 178c51f5fb4..5775ca7aa91 100755 --- a/ci/build_cccl_c_stf.sh +++ b/ci/build_cccl_c_stf.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/build_common.sh b/ci/build_common.sh index 2635eb60480..09e43e8e79a 100755 --- a/ci/build_common.sh +++ b/ci/build_common.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -eo pipefail diff --git a/ci/build_cub.sh b/ci/build_cub.sh index 64f21dbd2e9..d647e35b097 100755 --- a/ci/build_cub.sh +++ b/ci/build_cub.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/build_cuda_cccl_python.sh b/ci/build_cuda_cccl_python.sh index a88320aa2ee..9fd4dee820b 100755 --- a/ci/build_cuda_cccl_python.sh +++ b/ci/build_cuda_cccl_python.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail ci_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" diff --git a/ci/build_cuda_cccl_wheel.sh b/ci/build_cuda_cccl_wheel.sh index e700964ac77..b85385a7fc6 100755 --- a/ci/build_cuda_cccl_wheel.sh +++ b/ci/build_cuda_cccl_wheel.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail # Target script for `docker run` command in build_cuda_cccl_python.sh @@ -6,7 +6,7 @@ set -euo pipefail # Install GCC 13 toolset (needed for the build) /workspace/ci/util/retry.sh 5 30 dnf -y install gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ -echo -e "#!/bin/bash\nsource /opt/rh/gcc-toolset-13/enable" >/etc/profile.d/enable_devtools.sh +echo -e "#!/usr/bin/env bash\nsource /opt/rh/gcc-toolset-13/enable" >/etc/profile.d/enable_devtools.sh # shellcheck disable=SC1091 source /etc/profile.d/enable_devtools.sh diff --git a/ci/build_cudax.sh b/ci/build_cudax.sh index 2b067d0a542..8d8794edc48 100755 --- a/ci/build_cudax.sh +++ b/ci/build_cudax.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/build_libcudacxx.sh b/ci/build_libcudacxx.sh index 94880b45da1..119cceb3f5f 100755 --- a/ci/build_libcudacxx.sh +++ b/ci/build_libcudacxx.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/build_stdpar.sh b/ci/build_stdpar.sh index d85c0e12317..7a58326be97 100755 --- a/ci/build_stdpar.sh +++ b/ci/build_stdpar.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/build_thrust.sh b/ci/build_thrust.sh index fb9b1a90eb7..b3250614b84 100755 --- a/ci/build_thrust.sh +++ b/ci/build_thrust.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/generate_version.sh b/ci/generate_version.sh index b3de7886cd8..cffe378593c 100755 --- a/ci/generate_version.sh +++ b/ci/generate_version.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Generate a version number string using metadata from git or JSON. # Use the PyPi package versioning convention for pre-release or diff --git a/ci/install_cccl.sh b/ci/install_cccl.sh index 3c587911cc5..41eddadd3ab 100755 --- a/ci/install_cccl.sh +++ b/ci/install_cccl.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -eo pipefail diff --git a/ci/install_packaging.sh b/ci/install_packaging.sh index 3ab85237a79..574354b79c8 100755 --- a/ci/install_packaging.sh +++ b/ci/install_packaging.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/matx/build_matx.sh b/ci/matx/build_matx.sh index a2202bba927..98492e992d1 100755 --- a/ci/matx/build_matx.sh +++ b/ci/matx/build_matx.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/nvrtc_libcudacxx.sh b/ci/nvrtc_libcudacxx.sh index 855d345ec84..3959241dba9 100755 --- a/ci/nvrtc_libcudacxx.sh +++ b/ci/nvrtc_libcudacxx.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # shellcheck source=ci/build_common.sh source "$(dirname "${BASH_SOURCE[0]}")/build_common.sh" diff --git a/ci/pytorch/build_pytorch.sh b/ci/pytorch/build_pytorch.sh index 975d1f0c2ed..8304c420c41 100755 --- a/ci/pytorch/build_pytorch.sh +++ b/ci/pytorch/build_pytorch.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/test_cccl_c_parallel.sh b/ci/test_cccl_c_parallel.sh index 9c8bf2e5f1e..01fe14af222 100755 --- a/ci/test_cccl_c_parallel.sh +++ b/ci/test_cccl_c_parallel.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash source "$(dirname "${BASH_SOURCE[0]}")/build_common.sh" diff --git a/ci/test_cccl_c_parallel_hostjit.sh b/ci/test_cccl_c_parallel_hostjit.sh index 8af80851420..459e5f9a60b 100755 --- a/ci/test_cccl_c_parallel_hostjit.sh +++ b/ci/test_cccl_c_parallel_hostjit.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # shellcheck source=ci/build_common.sh source "$(dirname "${BASH_SOURCE[0]}")/build_common.sh" diff --git a/ci/test_cccl_c_stf.sh b/ci/test_cccl_c_stf.sh index c5664f480e6..410e7ae4b4b 100755 --- a/ci/test_cccl_c_stf.sh +++ b/ci/test_cccl_c_stf.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash source "$(dirname "${BASH_SOURCE[0]}")/build_common.sh" diff --git a/ci/test_cub.sh b/ci/test_cub.sh index 52fb78f1260..d111be86fb8 100755 --- a/ci/test_cub.sh +++ b/ci/test_cub.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/test_cuda_cccl_examples_python.sh b/ci/test_cuda_cccl_examples_python.sh index bb7867b42fc..68181aca622 100755 --- a/ci/test_cuda_cccl_examples_python.sh +++ b/ci/test_cuda_cccl_examples_python.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/test_cuda_cccl_headers_python.sh b/ci/test_cuda_cccl_headers_python.sh index 8a9d09642b4..0615f3a0414 100755 --- a/ci/test_cuda_cccl_headers_python.sh +++ b/ci/test_cuda_cccl_headers_python.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail ci_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" diff --git a/ci/test_cuda_compute_python.sh b/ci/test_cuda_compute_python.sh index 9abed5e69e6..635e73a9db0 100755 --- a/ci/test_cuda_compute_python.sh +++ b/ci/test_cuda_compute_python.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/test_cuda_coop_python.sh b/ci/test_cuda_coop_python.sh index bf75a2f8d02..00e8c75c8ef 100755 --- a/ci/test_cuda_coop_python.sh +++ b/ci/test_cuda_coop_python.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/test_cudax.sh b/ci/test_cudax.sh index ff7096b3b25..7d9dac0317c 100755 --- a/ci/test_cudax.sh +++ b/ci/test_cudax.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash source "$(dirname "${BASH_SOURCE[0]}")/build_common.sh" diff --git a/ci/test_libcudacxx.sh b/ci/test_libcudacxx.sh index 78fbd68ef15..a59076e203d 100755 --- a/ci/test_libcudacxx.sh +++ b/ci/test_libcudacxx.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash cd "$(dirname "${BASH_SOURCE[0]}")" # shellcheck source=ci/build_common.sh diff --git a/ci/test_nvbench_helper.sh b/ci/test_nvbench_helper.sh index e590a5d766a..42193be2ab7 100755 --- a/ci/test_nvbench_helper.sh +++ b/ci/test_nvbench_helper.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # shellcheck source=ci/build_common.sh source "$(dirname "${BASH_SOURCE[0]}")/build_common.sh" diff --git a/ci/test_packaging.sh b/ci/test_packaging.sh index 92fe81e0253..97fea776923 100755 --- a/ci/test_packaging.sh +++ b/ci/test_packaging.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/test_thrust.sh b/ci/test_thrust.sh index 862e2ddd710..835e9f953c9 100755 --- a/ci/test_thrust.sh +++ b/ci/test_thrust.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/update_rapids_version.sh b/ci/update_rapids_version.sh index 961375433f0..b5804b71115 100755 --- a/ci/update_rapids_version.sh +++ b/ci/update_rapids_version.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2024-2025, NVIDIA CORPORATION. ########################## # RAPIDS Version Updater # diff --git a/ci/update_version.sh b/ci/update_version.sh index f58dd38c119..cd996b24cdf 100755 --- a/ci/update_version.sh +++ b/ci/update_version.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Usage: ./update_version.sh [--dry-run] # Example: ./update_version.sh --dry-run 2 2 1 diff --git a/ci/upload_cub_test_artifacts.sh b/ci/upload_cub_test_artifacts.sh index 663763f7aaa..ffa595119b1 100755 --- a/ci/upload_cub_test_artifacts.sh +++ b/ci/upload_cub_test_artifacts.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/upload_job_result_artifacts.sh b/ci/upload_job_result_artifacts.sh index 797a05461bc..a73bba1e7c6 100755 --- a/ci/upload_job_result_artifacts.sh +++ b/ci/upload_job_result_artifacts.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/upload_thrust_test_artifacts.sh b/ci/upload_thrust_test_artifacts.sh index c54c6f3df29..f559dc244ec 100755 --- a/ci/upload_thrust_test_artifacts.sh +++ b/ci/upload_thrust_test_artifacts.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/common.sh b/ci/util/artifacts/common.sh index 9daa472f717..d7c720133c5 100755 --- a/ci/util/artifacts/common.sh +++ b/ci/util/artifacts/common.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/download.sh b/ci/util/artifacts/download.sh index 658ac4d063f..96f2ca010be 100755 --- a/ci/util/artifacts/download.sh +++ b/ci/util/artifacts/download.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/download/fetch.sh b/ci/util/artifacts/download/fetch.sh index 0f1aaff672e..7694fe71a2a 100755 --- a/ci/util/artifacts/download/fetch.sh +++ b/ci/util/artifacts/download/fetch.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/download/unpack.sh b/ci/util/artifacts/download/unpack.sh index e8313e3566e..84c6f103b2a 100755 --- a/ci/util/artifacts/download/unpack.sh +++ b/ci/util/artifacts/download/unpack.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/download_packed.sh b/ci/util/artifacts/download_packed.sh index 043a53c0a07..5cf4a6f7626 100755 --- a/ci/util/artifacts/download_packed.sh +++ b/ci/util/artifacts/download_packed.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/stage.sh b/ci/util/artifacts/stage.sh index 6e4e75eb138..30eed04ded7 100755 --- a/ci/util/artifacts/stage.sh +++ b/ci/util/artifacts/stage.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/unstage.sh b/ci/util/artifacts/unstage.sh index 66d9b9e4f32..ebf23507d7e 100755 --- a/ci/util/artifacts/unstage.sh +++ b/ci/util/artifacts/unstage.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/upload.sh b/ci/util/artifacts/upload.sh index a9a11f145bb..2a2c7f6404c 100755 --- a/ci/util/artifacts/upload.sh +++ b/ci/util/artifacts/upload.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/upload/build.sh b/ci/util/artifacts/upload/build.sh index 12f3c4b6343..308e1d57b7c 100755 --- a/ci/util/artifacts/upload/build.sh +++ b/ci/util/artifacts/upload/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/upload/pack.sh b/ci/util/artifacts/upload/pack.sh index 3e74012aab2..3410a107c22 100755 --- a/ci/util/artifacts/upload/pack.sh +++ b/ci/util/artifacts/upload/pack.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/upload/print_matrix.sh b/ci/util/artifacts/upload/print_matrix.sh index a7caf7c5f08..7aacaad19c2 100755 --- a/ci/util/artifacts/upload/print_matrix.sh +++ b/ci/util/artifacts/upload/print_matrix.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/upload/register.sh b/ci/util/artifacts/upload/register.sh index fc8c157f424..babf371322a 100755 --- a/ci/util/artifacts/upload/register.sh +++ b/ci/util/artifacts/upload/register.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/upload/set_compression_level.sh b/ci/util/artifacts/upload/set_compression_level.sh index 621da2e6f41..0fbb5a0126e 100755 --- a/ci/util/artifacts/upload/set_compression_level.sh +++ b/ci/util/artifacts/upload/set_compression_level.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/upload/set_retention_days.sh b/ci/util/artifacts/upload/set_retention_days.sh index 6bebef62997..3db5a6c099e 100755 --- a/ci/util/artifacts/upload/set_retention_days.sh +++ b/ci/util/artifacts/upload/set_retention_days.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/upload_packed.sh b/ci/util/artifacts/upload_packed.sh index 3a0aad9fe97..4fba3a17457 100755 --- a/ci/util/artifacts/upload_packed.sh +++ b/ci/util/artifacts/upload_packed.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/upload_stage.sh b/ci/util/artifacts/upload_stage.sh index 72a161a32ea..ec778efc382 100755 --- a/ci/util/artifacts/upload_stage.sh +++ b/ci/util/artifacts/upload_stage.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/artifacts/upload_stage_packed.sh b/ci/util/artifacts/upload_stage_packed.sh index 82dade3e558..d365e2bd7a9 100755 --- a/ci/util/artifacts/upload_stage_packed.sh +++ b/ci/util/artifacts/upload_stage_packed.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/create_mock_job_env.sh b/ci/util/create_mock_job_env.sh index 658a0979775..067966a79b5 100755 --- a/ci/util/create_mock_job_env.sh +++ b/ci/util/create_mock_job_env.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/extract_switches.sh b/ci/util/extract_switches.sh index 2a9fd9b50ea..b8217534a25 100755 --- a/ci/util/extract_switches.sh +++ b/ci/util/extract_switches.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Similar to getopt, but only extracts recognized switches and leaves all other arguments in place. # diff --git a/ci/util/pre-commit/check_shebang.py b/ci/util/pre-commit/check_shebang.py new file mode 100755 index 00000000000..f3e8498294e --- /dev/null +++ b/ci/util/pre-commit/check_shebang.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +import re +import sys + + +def main() -> int: + # We pre-compile this regular expression as a micro-optimization for speed. The + # assumption is that the shebang is correct, so everything in the happy path should be + # as fast as possible. + FIRST_LINE_RE = re.compile(r"#!\s*/usr/bin/env.*") + ret = 0 + for f in sys.argv[1:]: + with open(f) as fd: + first_line = fd.readline() + + if not first_line.startswith("#!"): + # Not a shebang + continue + + if FIRST_LINE_RE.match(first_line): + # Already correct + continue + + ret = 1 + + if not ( + m := re.match(r"#!\s*(?:/bin/(\w+)|/usr/bin/(\w+))\s*(.*)", first_line) + ): + # Not assert, pre-commit may compile with -O + raise AssertionError(f"Failed to match shebang for {first_line}") + + with open(f) as fd: + # Read the remaining lines, we need them in order to overwrite + lines = fd.readlines() + + lines[0] = f"#!/usr/bin/env {m[1] or m[2]} {m[3]}\n" + + with open(f, "w") as fd: + fd.writelines(lines) + + return ret + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/ci/util/retry.sh b/ci/util/retry.sh index 90ea4ef8632..171fd9e3057 100755 --- a/ci/util/retry.sh +++ b/ci/util/retry.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [[ "$#" -lt 3 ]]; then echo "Usage: $0 num_tries sleep_time command [args...]" diff --git a/ci/util/version_compare.sh b/ci/util/version_compare.sh index 5b7d3a183d6..b60bf6b2a9f 100755 --- a/ci/util/version_compare.sh +++ b/ci/util/version_compare.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/workflow/common.sh b/ci/util/workflow/common.sh index 48fa0167239..a5fa4de9178 100755 --- a/ci/util/workflow/common.sh +++ b/ci/util/workflow/common.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/workflow/get_consumers.sh b/ci/util/workflow/get_consumers.sh index 5c837f35d41..a4db72ff883 100755 --- a/ci/util/workflow/get_consumers.sh +++ b/ci/util/workflow/get_consumers.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/workflow/get_job_def.sh b/ci/util/workflow/get_job_def.sh index 2977ef56365..37df5311bf1 100755 --- a/ci/util/workflow/get_job_def.sh +++ b/ci/util/workflow/get_job_def.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/workflow/get_job_project.sh b/ci/util/workflow/get_job_project.sh index a7d070fa581..ebbfe1ecd06 100755 --- a/ci/util/workflow/get_job_project.sh +++ b/ci/util/workflow/get_job_project.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/workflow/get_producer_id.sh b/ci/util/workflow/get_producer_id.sh index 90028bea302..5b6df658661 100755 --- a/ci/util/workflow/get_producer_id.sh +++ b/ci/util/workflow/get_producer_id.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/workflow/get_producers.sh b/ci/util/workflow/get_producers.sh index 60ac12aadc5..ec0374213cd 100755 --- a/ci/util/workflow/get_producers.sh +++ b/ci/util/workflow/get_producers.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/workflow/get_stable_job_hash.sh b/ci/util/workflow/get_stable_job_hash.sh index 66eeda6c49f..7753f905925 100755 --- a/ci/util/workflow/get_stable_job_hash.sh +++ b/ci/util/workflow/get_stable_job_hash.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/workflow/get_wheel_artifact_name.sh b/ci/util/workflow/get_wheel_artifact_name.sh index 798ff8e22b2..c1d02f54623 100755 --- a/ci/util/workflow/get_wheel_artifact_name.sh +++ b/ci/util/workflow/get_wheel_artifact_name.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/workflow/has_consumers.sh b/ci/util/workflow/has_consumers.sh index b91741d19d7..7202ac8222e 100755 --- a/ci/util/workflow/has_consumers.sh +++ b/ci/util/workflow/has_consumers.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/workflow/has_producers.sh b/ci/util/workflow/has_producers.sh index f2829091659..72ee31433da 100755 --- a/ci/util/workflow/has_producers.sh +++ b/ci/util/workflow/has_producers.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/util/workflow/initialize.sh b/ci/util/workflow/initialize.sh index b6e1a99b4f8..f4f13bbbe98 100755 --- a/ci/util/workflow/initialize.sh +++ b/ci/util/workflow/initialize.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/ci/verify_codegen_libcudacxx.sh b/ci/verify_codegen_libcudacxx.sh index 3b0f96e10de..da7b999b899 100755 --- a/ci/verify_codegen_libcudacxx.sh +++ b/ci/verify_codegen_libcudacxx.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -eo pipefail # Ensure the script is being executed in its containing directory diff --git a/cub/test/cubin-check/dump_and_check.bash b/cub/test/cubin-check/dump_and_check.bash index f9b6f9410da..8872db3ee08 100755 --- a/cub/test/cubin-check/dump_and_check.bash +++ b/cub/test/cubin-check/dump_and_check.bash @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail cuobjdump=$1; cubin=$2; testfile=$3 $cuobjdump -symbols "$cubin" | FileCheck --allow-empty "$testfile" diff --git a/libcudacxx/test/atomic_codegen/dump_and_check.bash b/libcudacxx/test/atomic_codegen/dump_and_check.bash index d1c5f16b949..aca4aafaab3 100755 --- a/libcudacxx/test/atomic_codegen/dump_and_check.bash +++ b/libcudacxx/test/atomic_codegen/dump_and_check.bash @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail ## Usage: dump_and_check test.a test.cu PREFIX