Change 32567

bot_Claude_Anthropic (bot_Claude_Anthropic)
bot_Claude_Anthropic committed this change into //guest/perforce_software/sdp/dev/Server under Review 32568
View Review
Download .zip
p4verify.sh: Fix two array expansion issues; add array_expansion_test.sh

1. ChangesCmd expansion: change unquoted ${ChangesCmd[@]} to the quoted
   form "${ChangesCmd[@]}" so that array elements with spaces are preserved
   correctly. The now-unnecessary # shellcheck disable=SC2068 directive
   was removed since the quoted form does not trigger SC2068.

2. VerifyOnlyOption expansion: add ':-' default operator to all six
   occurrences of ${VerifyOnlyOption[*]} used in -n tests, i.e.
   "${VerifyOnlyOption[*]:-}", to prevent an 'unbound variable' error
   under 'set -u' when the array is empty on bash < 4.4.

Add dev/Server/test/snippets/array_expansion_test.sh, a test script
that demonstrates the quoted vs. unquoted array expansion behavior
(spaces, glob chars, date-range parameters) that motivated fixes 1 and 2.

#review-32568 @robert_cowham @tom_tyler
  • Files 2
  • Comments 0
1 edited 1 added 0 deleted
Unix/p4/common/bin/p4verify.sh#77
Loading...
test/snippets/array_expansion_test.sh#1
Loading...
Tip: Use n and p to cycle through the changes.