1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Junk drawer of repros for bugs
|
4 | #
|
5 | # Usage:
|
6 | # test/bugs.sh <function name>
|
7 |
|
8 | set -o nounset
|
9 | set -o pipefail
|
10 | set -o errexit
|
11 |
|
12 | # bugs:
|
13 | # echo | tr
|
14 | # echo | cat
|
15 | # history | less
|
16 |
|
17 | esrch-code-1() {
|
18 | local n=$1
|
19 | for i in $(seq $n); do
|
20 | echo 'echo hi | tr a-z A-Z'
|
21 | #echo 'echo hi | cat'
|
22 | done
|
23 | }
|
24 |
|
25 | esrch-code-2() {
|
26 | local n=$1
|
27 | for i in $(seq $n); do
|
28 | echo 'history | less'
|
29 | done
|
30 | }
|
31 |
|
32 | esrch-test() {
|
33 | # I think
|
34 |
|
35 | local osh=bin/osh
|
36 |
|
37 | local osh=_bin/cxx-opt/osh
|
38 | ninja $osh
|
39 |
|
40 | esrch-code-1 1000 | $osh -i
|
41 | }
|
42 |
|
43 | #
|
44 | # Bug #1853 - trap and fork optimizations -also hit by Samuel
|
45 | #
|
46 |
|
47 | trap-1() {
|
48 | local sh=${1:-bin/osh}
|
49 | set +o errexit
|
50 |
|
51 | # This fails to run the trap
|
52 | $sh -x -c 'trap "echo int" INT; sleep 5'
|
53 | }
|
54 |
|
55 | # Run with bin/ysh -x to show fork opts
|
56 | trap-2() {
|
57 | local sh=${1:-bin/osh}
|
58 | set +o errexit
|
59 |
|
60 | # This runs it
|
61 | $sh -x -c 'trap "echo int" INT; sleep 5; echo last'
|
62 | }
|
63 |
|
64 | "$@"
|