Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/test_fw_path_quoting.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# Regression test: the firmware path occupancy check must quote its command
# substitution so multi-word contents do not break the [[ ]] test.
set -euo pipefail

driver_file="ubuntu22.04/nvidia-driver"

if grep -q '\[\[ ! -z $(grep' "$driver_file"; then
echo "FAIL: unquoted command substitution in [[ ]] test remains"
exit 1
fi

2 changes: 1 addition & 1 deletion ubuntu22.04/nvidia-driver
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ _load_driver() {

if [[ "$set_fw_path" == "true" ]]; then
echo "Configuring the following firmware search path in '$fw_path_config_file': $nv_fw_search_path"
if [[ ! -z $(grep '[^[:space:]]' $fw_path_config_file) ]]; then
if grep -q '[^[:space:]]' "$fw_path_config_file"; then
echo "WARNING: A search path is already configured in $fw_path_config_file"
echo " Retaining the current configuration"
else
Expand Down