Added gitignore entries needed to ignore derived objects generated from full build...
[bash.git] / tests / iquote.tests
bloba2cdf4f71f2d3f4f29faf55c3b9cbd037ae9563f
1 # bug in bash up to and including bash-3.0 (including patches)
3 # problem is conflict between CTLNUL used internally to denote quoted null
4 # characters and its value (0x7f) appearing in the expansion of a variable
6 unset x
7 recho "xxx${x}yyy"
9 y=$'\177'
10 recho "xxx${y}yyy"
12 unset y
14 unset undef
16 set ""
17 recho ${undef-"x$*y"}
19 set $'\177'
20 recho ${undef-"x$*y"}
22 shift $#
24 f()
26         recho "-${*-x}-"
29 f ''
30 f $'\177'
32 unset -f f
34 x=12345
36 recho "${x:6:1}"
39 recho "${x:0:1}"
41 y=$'\177'
42 recho "${y:0:1}"
44 y=xxx$'\177'yyy
45 recho "${y:3:3}"
47 unset x y
49 eval tmp=`printf "$'\\\\\x%x'\n" 127`
50 printf "%#1x\n" "'$tmp"
52 x=$'\177'
53 printf "%#1x\n" "'$x"
55 a=127
56 eval c=\$\'\\$(printf '%o' $a)\'
57 printf "%#1x\n" "'$c"
59 recho "$c"
60 recho "$c"@
61 recho @"$c"@
62 recho @"$c"
64 recho "$c"
65 recho "$c@"
66 recho "@$c@"
67 recho "@$c"
69 unset tmp x a c
71 qtest()
73         recho ${#q} "${q}" ${q}
76 q=$'\x7f'
77 qtest
79 q=${q}a
80 qtest
82 q=$'\x7fa'
83 qtest
85 q="${q}a"
86 qtest
88 unset -f qtest
89 unset q
91 set -- ''
92 recho "${*:1}"
93 recho  ${*:1}
94 recho  -${*:1}-
95 recho  -"${*:1}"-
97 set $'\177'
98 recho "${*:1}"
99 recho "-${*:1}-"
101 recho  ${*:1}
102 recho -${*:1}-
104 shift $#
106 DEL=`awk 'END{printf("%c", 0+127)}' </dev/null`
107 T1=a\ $DEL
108 T2="a $DEL"
109 set -- x $(echo $T1|wc -c) $(echo $T2|wc -c); shift
110 L1=$1; L2=$2
111 case "$L1/$L2" in
112 4/4) echo ok;;
113 *) echo CTLNUL bug: L1=$L1, L2=$L2;;
114 esac
116 x=$'\177'
117 recho "aaa${x}bbb"
118 recho ccc"${x}"ddd
119 recho eee"$x"fff
120 recho ggg"$(echo $x)"hhh
123 recho "aaa${x}bbb"
124 recho ccc"${x}"ddd
125 recho eee"$x"fff
126 recho ggg"$(echo $x)"hhh
128 set -- $'\177'
129 recho "aaa${1}bbb"
130 recho ccc"${1}"ddd
131 recho eee"$1"fff
132 recho ggg"$(echo $1)"hhh
134 set -- ""
135 recho "aaa${1}bbb"
136 recho ccc"${1}"ddd
137 recho eee"$1"fff
138 recho ggg"$(echo $1)"hhh
140 recho aaa$'\177'bbb
141 recho ccc"\x7f"ddd
142 recho "eee\x7ffff"
143 recho ggg"$(echo $'\177')"hhh