Fix printf escape errors in shell scripts
Fix `printf "$foo"` which treats the value of `foo` as a printf format rather than a string. I used the following command to find potentially problematic lines: ``` git ls-files '*.sh' | xargs egrep 'printf +("?[^"]*|[^ ]*)\$' ``` The remaining ones are false positives for this regexp. The errors only had minor consequences: the output of `ssl-opt.sh` contained lines like ``` Renegotiation: gnutls server strict, client-initiated .................. ./tests/ssl-opt.sh: 741: printf: %S: invalid directive PASS ``` and in case of failure the GnuTLS command containing a substring like `--priority=NORMAL:%SAFE_RENEGOTIATION` was not included in the log file. With the current tests, there was no risk of a test failure going undetected. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
663d0993ec
commit
ffdcadf084
3 changed files with 21 additions and 21 deletions
|
@ -92,7 +92,7 @@ fi
|
|||
diff macros identifiers | sed -n -e 's/< //p' > actual-macros
|
||||
|
||||
for THING in actual-macros enum-consts; do
|
||||
printf "Names of $THING: "
|
||||
printf 'Names of %s: ' "$THING"
|
||||
test -r $THING
|
||||
BAD=$( grep -v '^MBEDTLS_[0-9A-Z_]*[0-9A-Z]$' $THING || true )
|
||||
if [ "x$BAD" = "x" ]; then
|
||||
|
@ -105,7 +105,7 @@ for THING in actual-macros enum-consts; do
|
|||
done
|
||||
|
||||
for THING in identifiers; do
|
||||
printf "Names of $THING: "
|
||||
printf 'Names of %s: ' "$THING"
|
||||
test -r $THING
|
||||
BAD=$( grep -v '^mbedtls_[0-9a-z_]*[0-9a-z]$' $THING || true )
|
||||
if [ "x$BAD" = "x" ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue