[INFRA]: Shell script robustness improvements in CI
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 486
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 295
Description
### Is this a duplicate?
- [x] I have searched the [open issues](https://github.com/NVIDIA/cccl/issues) and this is not a duplicate
### Overview
Minor shell script improvements found via ShellCheck 0.11.0. Each fix is independent and low-risk.
### Details
**Ambiguous quoting in `build_common.sh` ([SC2140](https://www.shellcheck.net/wiki/SC2140)):**
`"weighted"` and `"important"` inside a double-quoted echo string have technically incorrect quoting — the unquoted portions undergo word splitting. Fixed with escaped quotes.
**Array deduplication in `upload_cub_test_artifacts.sh` ([SC2207](https://www.shellcheck.net/wiki/SC2207)):**
`array=($(... | sort -u))` replaced with `mapfile -t array < <(... | sort -u)` to avoid word splitting and glob expansion during array assignment.
**Quoted CMake flag variables in `build_cub.sh` ([SC2206](https://www.shellcheck.net/wiki/SC2206)):**
Added double quotes around variable expansions inside array assignment to prevent word splitting.
**`cd` error handling in `test_libcudacxx.sh` ([SC2164](https://www.shellcheck.net/wiki/SC2164)):**
Added `|| exit 1` after `cd` to make failure explicit.
**`printf` instead of `echo` in `build_and_test_targets.sh` ([SC2028](https://www.shellcheck.net/wiki/SC2028)):**
`echo` does not reliably expand `\n` and `\t`. Replaced with `printf` for portable formatting.
**Quoted command substitution in `build_cuda_cccl_python.sh` ([SC2046](https://www.shellcheck.net/wiki/SC2046)):**
Moved `$(ls ...)` inside the double-quoted string to prevent word splitting.
**Intentionally skipped:**
- SC2124 in `build_common.sh` (`local CMAKE_OPTIONS=$@`): requires changing how cmake options propagate — too invasive for this scope.
- SC2046 in `pytorch/build_pytorch.sh`: intentional word splitting for ninja targets.
Contributor guide
Assessment
This issue has not been assessed yet.