runtime.bash: fix check for parameter files
Paolo Bonzini
maintainerPATCH 1/1 runtime.bash: fix check for parameter files
We need to check if the file exists, not just if it is a non-empty string. While an empty $path would have the unfortunate effect that "cat" would read from stdin, that is not an issue as you can simply not do that.
Signed-off-by Paolo Bonzini <[email protected]>
--- scripts/runtime.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/runtime.bash +1 -1
@@ -118,7 +118,7 @@ function run() for check_param in "${check[@]}"; do path=${check_param%%=*} value=${check_param#*=} - if [ "$path" ] && [ "$(cat $path)" != "$value" ]; then + if [ -f "$path" ] && [ "$(cat $path)" != "$value" ]; then print_result "SKIP" $testname "" "$path not equal to $value" return 2 fi
Signature · 1 line
2.26.2
Quoted 14 lines · Paolo Bonzini
We need to check if the file exists, not just if it is a non-empty string. While an empty $path would have the unfortunate effect that "cat" would read from stdin, that is not an issue as you can simply not do that.
Signed-off-by Paolo Bonzini <[email protected]>--- scripts/runtime.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/runtime.bash +0
-0
scripts/runtime.bash function run() · line 124
Quoted 8 lines
scripts/runtime.bash +1
-1@@ -118,7 +118,7 @@ function run() for check_param in "${check[@]}"; do path=${check_param%%=*} value=${check_param#*=} - if [ "$path" ] && [ "$(cat $path)" != "$value" ]; then + if [ -f "$path" ] && [ "$(cat $path)" != "$value" ]; then print_result "SKIP" $testname "" "$path not equal to $value" return 2 fi
Reviewed-by Thomas Huth <[email protected]>
Quoted 25 lines · Paolo Bonzini
We need to check if the file exists, not just if it is a non-empty string. While an empty $path would have the unfortunate effect that "cat" would read from stdin, that is not an issue as you can simply not do that.
Signed-off-by Paolo Bonzini <[email protected]>--- scripts/runtime.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/runtime.bash +1
-1@@ -118,7 +118,7 @@ function run() for check_param in "${check[@]}"; do path=${check_param%%=*} value=${check_param#*=} - if [ "$path" ] && [ "$(cat $path)" != "$value" ]; then + if [ -f "$path" ] && [ "$(cat $path)" != "$value" ]; then print_result "SKIP" $testname "" "$path not equal to $value" return 2 fiSignature · 1 line
2.26.2
Reviewed-by Andrew Jones <[email protected]>