Skip to content

Commit 5c63920

Browse files
committed
t4204: do not let $name variable clobbered
test_patch_id_file_order shell function uses $name variable to hold one filename, and calls another shell function calc_patch_id as a downstream of one pipeline. The called function, however, also uses the same $name variable. With a shell implementation that runs the callee in the current shell environment, the caller's $name would be clobbered by the callee's use of the same variable. This hasn't been an issue with dash and bash. ksh93 reveals the breakage in the test script. Fix it by using a distinct variable name in the callee. Reported-by: Armin Kunaschik <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3a0f269 commit 5c63920

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

t/t4204-patch-id.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ test_expect_success 'patch-id output is well-formed' '
3030

3131
#calculate patch id. Make sure output is not empty.
3232
calc_patch_id () {
33-
name="$1"
33+
patch_name="$1"
3434
shift
3535
git patch-id "$@" |
36-
sed "s/ .*//" >patch-id_"$name" &&
37-
test_line_count -gt 0 patch-id_"$name"
36+
sed "s/ .*//" >patch-id_"$patch_name" &&
37+
test_line_count -gt 0 patch-id_"$patch_name"
3838
}
3939

4040
get_top_diff () {

0 commit comments

Comments
 (0)