Skip to content

Commit 128b975

Browse files
committed
fix(tar): fix access of the global variable basic_tar
The function `_gtar` calls `__tar_try_mode`, and `__tar_try_mode` checks the state of the previous-scope `basic_tar`. However, `__tar_try_mode` called from `_gtar` references the state of the global scope because `_gtar` does not declare `basic_tar`. We need to declare `basic_tar` local to `_gtar` the same as done in `__posix_tar`.
1 parent 1bdc18e commit 128b975

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

completions/tar

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,12 @@ __tar_detect_ext()
486486

487487
_gtar()
488488
{
489-
local long_opts short_opts \
489+
local long_opts short_opts basic_tar \
490490
long_arg_none="" long_arg_opt="" long_arg_req="" \
491491
short_arg_none="" short_arg_opt="" short_arg_req="" \
492492
tar_mode tar_mode_arg old_opt_progress=0 \
493493
old_opt_used=0 old_opt_parsed=()
494+
unset -v basic_tar # workaround for localvar_inherit
494495

495496
# Main mode, e.g. -x or -c (extract/creation)
496497
local tar_mode=none

0 commit comments

Comments
 (0)