Lines 15-20
assert() {
Link Here
|
15 |
done |
15 |
done |
16 |
} |
16 |
} |
17 |
|
17 |
|
|
|
18 |
assert_tar_extract() { |
19 |
# When extracting a tar file like this: |
20 |
# |
21 |
# bzip2 -dc foo.tar.bz2 | tar xof - |
22 |
# |
23 |
# For some tar files (see bug #309001), tar will |
24 |
# close its stdin pipe when the decompressor still has |
25 |
# remaining data to be written to its stdout pipe. This |
26 |
# causes the decompressor to be killed by SIGPIPE. In |
27 |
# this case, we want to ignore pipe writers killed by |
28 |
# SIGPIPE, and trust the exit status of tar. We borrow |
29 |
# WIFSIGNALED and WTERMSIG bitwise operations from |
30 |
# glibc's bits/waitstatus.h. |
31 |
|
32 |
local x pipestatus=${PIPESTATUS[*]} |
33 |
for x in $pipestatus ; do |
34 |
if [[ $x -ne 0 ]] ; then |
35 |
# WIFSIGNALED(status) |
36 |
(( ( ( ( x & 0x7f ) + 1 ) >> 1 ) > 0 )) || die "$@" |
37 |
|
38 |
# WTERMSIG(status) == SIGPIPE |
39 |
(( ( x & 0x7f ) == 13 )) || die "$@" |
40 |
fi |
41 |
done |
42 |
|
43 |
# Require normal success for the last process (tar). |
44 |
[[ $x -eq 0 ]] || die "$@" |
45 |
} |
46 |
|
18 |
shopt -s extdebug |
47 |
shopt -s extdebug |
19 |
|
48 |
|
20 |
# dump_trace([number of funcs on stack to skip], |
49 |
# dump_trace([number of funcs on stack to skip], |
21 |
- |
|
|