Skip to content

Commit b1cab8c

Browse files
committed
tests/template: Make fake tarball with BusyBox
After thinking about it, I realized the `tar: lseek: Invalid seek` error produced by the BusyBox `tar` on Alpine Linux might be eliminated by having `tar` read from standard input rather than using `-f` to access directly the `/dev/fd` file created by the process substitution. Also updated all the `tar` commands to make their invocations more consistent with one another.
1 parent de7ce6c commit b1cab8c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

go-template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ download_go_script_bash_tarball() {
8484
fi
8585
printf "Downloading framework from '%s'...\n" "$url"
8686

87-
if ! tar -xzf <("${download_cmd[@]}") || [[ ! -f "$unpacked_core" ]]; then
87+
if ! tar -xzf - < <("${download_cmd[@]}") || [[ ! -f "$unpacked_core" ]]; then
8888
printf "Failed to download from '%s'.\n" "$url" >&2
8989
return 1
9090
elif [[ ! -d "$core_dir_parent" ]] && ! mkdir -p "$core_dir_parent" ; then

tests/template.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ create_fake_tarball_if_not_using_real_url() {
123123
elif ! mkdir -p "$full_dir"; then
124124
printf 'Failed to create fake content dir %s\n' "$full_dir" >&2
125125
result='1'
126-
elif ! tar xf <(tar cf - go-core.bash lib libexec) -C "$full_dir"; then
126+
elif ! tar -xf - -C "$full_dir" < <(tar -cf - go-core.bash lib libexec); then
127127
printf 'Failed to mirror %s to fake tarball dir %s\n' \
128128
"$_GO_ROOTDIR" "$full_dir" >&2
129129
result='1'
130-
elif ! tar cfz "$tarball" -C "$TEST_GO_ROOTDIR" "$dirname"; then
130+
elif ! tar -czf "$tarball" -C "$TEST_GO_ROOTDIR" "$dirname"; then
131131
printf 'Failed to create fake tarball %s\n from dir %s\n' \
132132
"$tarball" "$full_dir" >&2
133133
result='1'

0 commit comments

Comments
 (0)