2 #@ Usage: ./cc-test.sh [--check-only] s-mailx-binary
3 #@ TODO _All_ the tests should happen in a temporary subdir.
6 # We need *stealthmua* regardless of $SOURCE_DATE_EPOCH, the program name as
7 # such is a compile-time variable
8 ARGS
='-:/ -# -Sdotlock-ignore-error -Sencoding=quoted-printable -Sstealthmua'
9 ARGS
="${ARGS}"' -Snosave -Sexpandaddr=restrict'
10 ADDARG_UNI
=-Sttycharset=UTF-8
15 #UTF8_LOCALE= autodetected unless set
18 #MEMTESTER='valgrind --leak-check=full --log-file=.vl-%p '
20 if ( command -v command ) >/dev
/null
2>&1; then :; else
27 MAKE
="${MAKE:-`command -v make`}"
28 awk=${awk:-`command -v awk`}
29 cat=${cat:-`command -v cat`}
30 cksum=${cksum:-`command -v cksum`}
31 rm=${rm:-`command -v rm`}
32 sed=${sed:-`command -v sed`}
33 grep=${grep:-`command -v grep`}
35 # Problem: force $SHELL to be a real shell. It seems some testing environments
36 # use nologin(?), but we need a real shell for command execution
37 if { echo ${SHELL} | ${grep} nologin; } >/dev
/null
2>&1; then
38 echo >&2 '$SHELL seems to be nologin, overwriting to /bin/sh!'
43 # We sometimes "fake" sendmail(1) a.k.a. *mta* with a shell wrapper, and it
44 # happens that /bin/sh is often terribly slow
45 if command -v dash
>/dev
/null
2>&1; then
46 MYSHELL
="`command -v dash`"
47 elif command -v mksh
>/dev
/null
2>&1; then
48 MYSHELL
="`command -v mksh`"
55 export ARGS ADDARG_UNI CONF BODY MBOX MAIL MAKE
awk cat cksum rm sed grep
59 # Wed Oct 2 01:50:07 UTC 1996
60 SOURCE_DATE_EPOCH
=844221007
62 export LC_ALL LANG TZ SOURCE_DATE_EPOCH
66 echo >&2 "Usage: ./cc-test.sh [--check-only] s-mailx-binary"
71 while [ $# -gt 0 ]; do
72 if [ "${1}" = --check-only ]; then
79 [ -x "${MAILX}" ] || usage
81 MAILX
="${MEMTESTER}${MAILX}"
84 if [ -z "${UTF8_LOCALE}" ]; then
85 # Try ourselfs for nl_langinfo(CODESET) output first (requires a new version)
86 i
=`LC_ALL=C.utf8 "${RAWMAILX}" ${ARGS} -X '
88 \if [ "${ttycharset}" @i=% utf ]
93 \wysh set LC_ALL="${1}.utf8"
95 \eval xcall cset_test "${@}"
99 \call cset_test POSIX en_EN en_US
101 [ $?
-eq 0 ] && UTF8_LOCALE
=$i
103 if [ -z "${UTF8_LOCALE}" ] && command -v locale
>/dev
/null
2>&1; then
104 UTF8_LOCALE
=`locale -a | { m=
106 if { echo ${n} | ${grep} -i 'utf-\{0,1\}8'; } >/dev/null 2>&1; then
108 if { echo ${n} | ${grep} -e POSIX -e en_EN -e en_US; }; then
122 trap "${rm} -rf \"${BODY}\" \"${MBOX}\" \${TRAP_EXIT_ADDONS}" EXIT
123 trap "exit 1" HUP INT TERM
126 # Test all configs TODO doesn't cover all *combinations*, stupid!
130 NOTME["OPT_AUTOCC"] = 1
131 NOTME["OPT_DEBUG"] = 1
132 NOTME["OPT_DEVEL"] = 1
133 NOTME["OPT_NOEXTMD5"] = 1
134 NOTME["OPT_NOMEMDBG"] = 1
135 NOTME["OPT_NYD2"] = 1
138 /^[[:space:]]*OPT_/ {
139 sub(/^[[:space:]]*/, "")
140 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
141 # does not seem to be a compliant escape for =
143 $1 = substr($1, 1, index($1, "=") - 1)
149 # Doing this completely sequentially and not doing make distclean in
150 # between runs should effectively result in lesser compilations.
151 # It is completely dumb nonetheless... TODO
152 for (j = 1; j < i; ++j) {
153 for (k = 1; k < j; ++k)
155 for (k = j; k < i; ++k)
157 printf "OPT_AUTOCC=1\n"
159 for (j = 1; j < i; ++j) {
160 for (k = 1; k < j; ++k)
162 for (k = j; k < i; ++k)
164 printf "OPT_AUTOCC=1\n"
167 for (j = 1; j < i; ++j) {
168 for (k = 1; k < j; ++k)
170 for (k = j; k < i; ++k)
172 printf "OPT_AUTOCC=1\n"
173 printf "OPT_DEBUG=1\n"
175 for (j = 1; j < i; ++j) {
176 for (k = 1; k < j; ++k)
178 for (k = j; k < i; ++k)
180 printf "OPT_AUTOCC=1\n"
181 printf "OPT_DEBUG=1\n"
184 printf "CONFIG=NULL OPT_AUTOCC=0\n"
185 printf "CONFIG=NULL OPT_AUTOCC=1\n"
186 printf "CONFIG=NULLI OPT_AUTOCC=0\n"
187 printf "CONFIG=NULLI OPT_AUTOCC=1\n"
188 printf "CONFIG=MINIMAL OPT_AUTOCC=0\n"
189 printf "CONFIG=MINIMAL OPT_AUTOCC=1\n"
190 printf "CONFIG=MEDIUM OPT_AUTOCC=0\n"
191 printf "CONFIG=MEDIUM OPT_AUTOCC=1\n"
192 printf "CONFIG=NETSEND OPT_AUTOCC=0\n"
193 printf "CONFIG=NETSEND OPT_AUTOCC=1\n"
194 printf "CONFIG=MAXIMAL OPT_AUTOCC=0\n"
195 printf "CONFIG=MAXIMAL OPT_AUTOCC=1\n"
196 printf "CONFIG=DEVEL OPT_AUTOCC=0\n"
197 printf "CONFIG=DEVEL OPT_AUTOCC=1\n"
198 printf "CONFIG=ODEVEL OPT_AUTOCC=0\n"
199 printf "CONFIG=ODEVEL OPT_AUTOCC=1\n"
202 printf "\n\n##########\n$c\n"
203 printf "\n\n##########\n$c\n" >&2
211 ( "${RAWMAILX}" ${ARGS} -X'echo $features' -Xx |
212 ${grep} +${1} ) >/dev
/null
2>&1
216 ${rm} -rf "${BODY}" "${MBOX}" ${TRAP_EXIT_ADDONS}
224 restat
=${?} tid=${1} eestat=${2} f=${3} s=${4}
225 #x=`echo ${tid} | tr "/:=" "__-"`
226 #cp -f "${f}" "${TMPDIR}/${x}"
227 [ "${eestat}" != - ] && [ "${restat}" != "${eestat}" ] &&
228 err
"${tid}" 'unexpected exit status: '"${restat} != ${eestat}"
229 csum
="`${cksum} < ${f}`"
230 if [ "${csum}" = "${s}" ]; then
231 printf '%s: ok\n' "${tid}"
234 printf '%s: error: checksum mismatch (got %s)\n' "${tid}" "${csum}"
240 printf '%s: error: %s\n' ${1} "${2}"
244 [ $?
-ne 0 ] && err
$1 'unexpected non-0 exit status'
248 [ $?
-eq 0 ] && err
$1 'unexpected 0 exit status'
251 if ( [ "$((1 + 1))" = 2 ] ) >/dev
/null
2>&1; then
253 echo "$((${1} + ${2}))"
255 elif command -v expr >/dev
/null
2>&1; then
257 echo `expr ${1} + ${2}`
261 echo `${awk} 'BEGIN{print '${1}' + '${2}'}'`
265 if ( [ "$((2 % 3))" = 2 ] ) >/dev
/null
2>&1; then
267 echo "$((${1} % ${2}))"
269 elif command -v expr >/dev
/null
2>&1; then
271 echo `expr ${1} % ${2}`
275 echo `${awk} 'BEGIN{print '${1}' % '${2}'}'`
280 # Basic (easily testable) behaviour tests
282 t_behave_X_opt_input_command_stack
285 t_behave_input_inject_semicolon_seq
286 t_behave_commandalias
289 t_behave_macro_param_shift
299 # FIXME t_behave_mlist
302 t_behave_record_a_resend
305 t_behave_compose_hooks
306 t_behave_message_injections
307 t_behave_mime_types_load_control
314 t_behave_X_opt_input_command_stack
() {
317 ${cat} <<- '__EOT' > "${BODY}"
325 echo "define mac1 {";\
326 echo " echo mac1-1 via1 \$0";\
328 echo " echo mac1-2";\
330 echo " echo mac1-3";\
333 echo "define mac2 {";\
334 echo " echo mac2-1 via1 \$0";\
336 echo " echo mac2-2";\
342 echo echo 1-1-1 via1 \$0;\
354 # The -X option supports multiline arguments, and those can internally use
355 # reverse solidus newline escaping. And all -X options are joined...
357 < "${BODY}" ${MAILX} ${ARGS} \
372 echo "define mac1 {";\
373 echo " echo mac1-1 via2 \$0";\
375 echo " echo mac1-2";\
377 echo " echo mac1-3";\
380 echo "define mac2 {";\
381 echo " echo mac2-1 via2 \$0";\
383 echo " echo mac2-2";\
389 echo echo 1-1-1 via2 \$0;\
403 check behave:x_opt_input_command_stack 0 "${MBOX}" '1786542668 416'
408 t_behave_X_errexit() {
411 ${cat} <<- '__EOT' > "${BODY}"
417 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
418 -X'echo one' -X' echos nono ' -X'echo two' \
420 check behave:x_errexit-1 0 "${MBOX}" '916157812 53'
422 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Snomemdebug \
424 check behave:x_errexit-2 0 "${MBOX}" '916157812 53'
426 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u
-Snomemdebug \
428 check behave
:x_errexit-3
0 "${MBOX}" '916157812 53'
432 </dev
/null
${MAILX} ${ARGS} -Serrexit -Snomemdebug \
433 -X'echo one' -X' echos nono ' -X'echo two' \
435 check behave
:x_errexit-4
1 "${MBOX}" '2118430867 49'
437 </dev
/null
${MAILX} ${ARGS} -X'source '"${BODY}" -Serrexit -Snomemdebug \
439 check behave:x_errexit-5 1 "${MBOX}" '2118430867 49'
441 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u
-Serrexit -Snomemdebug \
443 check behave
:x_errexit-6
1 "${MBOX}" '12955965 172'
445 </dev
/null MAILRC
="${BODY}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
447 check behave:x_errexit-7 1 "${MBOX}" '12955965 172'
449 ## Repeat 4-7 with ignerr set
451 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
453 </dev
/null
${MAILX} ${ARGS} -Serrexit -Snomemdebug \
454 -X'echo one' -X'ignerr echos nono ' -X'echo two' \
456 check behave
:x_errexit-8
0 "${BODY}" '916157812 53'
458 </dev
/null
${MAILX} ${ARGS} -X'source '"${MBOX}" -Serrexit -Snomemdebug \
460 check behave:x_errexit-9 0 "${BODY}" '916157812 53'
462 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u
-Serrexit -Snomemdebug \
464 check behave
:x_errexit-10
0 "${BODY}" '916157812 53'
466 </dev
/null MAILRC
="${MBOX}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
468 check behave:x_errexit-11 0 "${BODY}" '916157812 53'
476 ${cat} <<- '__EOT' > "${BODY}"
495 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
496 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
497 echo $
'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
499 echo a$
'\101\0101\x41\u0041\u41\U00000041\U41'c
500 echo a$
'\u0041\u41\u0C1\U00000041\U41'c
523 echo a$
'b\U0000000'dt
524 echo a$
'b\U00000000'du
534 if [ -z "${UTF8_LOCALE}" ]; then
535 echo 'Skip behave:wysh_unicode, no UTF8_LOCALE'
537 < "${BODY}" DIET
=CURD TIED
= \
538 LC_ALL
=${UTF8_LOCALE} ${MAILX} ${ARGS} 2>/dev/null > "${MBOX}"
539 check behave:wysh_unicode 0 "${MBOX}" '475805847 317'
542 < "${BODY}" DIET=CURD TIED= ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
543 check behave:wysh_c 0 "${MBOX}" '1473887148 321'
548 t_behave_input_inject_semicolon_seq() {
551 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
556 echon this_is_mymac
;call mydeepmac
;echon
';';
558 echon one
';';call mymac
;echon two
";";call mymac
;echo three$
';';
560 echon this_is_mymac
;call mydeepmac
;echon
,TOO
'!;';
562 echon one
';';call mymac
;echon two
";";call mymac
;echo three$
';';
565 check behave
:input_inject_semicolon_seq
0 "${MBOX}" '512117110 140'
570 t_behave_commandalias
() {
573 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
574 commandalias echo echo hoho
578 commandalias XxX XxXx
579 commandalias XxXx XxXxX
580 commandalias XxXxX XxXxXx
581 commandalias XxXxXx echo huhu
582 commandalias XxXxXxX echo huhu
584 commandalias XxXxXx XxXxXxX
587 commandalias XxXxXx echo huhu
591 check behave:commandalias 0 "${MBOX}" '3694143612 31'
599 # Nestable conditions test
600 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
622 if $dietcurd == 'yoho'
627 if $dietcurd @
== 'Yoho'
632 if $dietcurd == 'Yoho'
637 if $dietcurd != 'yoho'
642 if $dietcurd @
!= 'Yoho'
647 if $dietcurd != 'Yoho'
708 if $dietcurd == 'yohu'
710 elif $dietcurd == 'yoha'
712 elif $dietcurd == 'yohe'
714 elif $dietcurd == 'yoho'
716 if $dietcurd == 'yohu'
718 elif $dietcurd == 'yoha'
720 elif $dietcurd == 'yohe'
722 elif $dietcurd == 'yoho'
724 if $dietcurd == 'yohu'
726 elif $dietcurd == 'yoha'
728 elif $dietcurd == 'yohe'
730 elif $dietcurd == 'yoho'
879 set diet
=abc curd
=abc
885 set diet
=abc curd
=abcd
891 # 1. Shitty grouping capabilities as of today
892 unset diet curd ndefined
893 if [ [ false
] ||
[ false
] ||
[ true
] ] && [ [ false
] ||
[ true
] ] && \
899 if [ [ [ [ 0 ] ||
[ 1 ] ] && [ [ 1 ] ||
[ 0 ] ] ] && [ 1 ] ] && [ yes ]
904 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ]
909 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ]
914 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] && [ no
]
919 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] \
925 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
930 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
935 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
940 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
945 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 0 ]
950 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 1 ]
955 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ]
960 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 1 ]
965 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 0 ]
970 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 1 ]
976 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
982 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
987 # 2. Shitty grouping capabilities as of today
988 unset diet curd ndefined
989 if [ false || false || true
] && [ false || true
] && yes
994 if [ [ [ 0 ||
1 ] && [ 1 ||
0 ] ] && 1 ] && [ yes ]
999 if [ 1 ||
0 ||
0 ||
0 ]
1004 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ]
1009 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ||
1 ] && no
1014 if [ 1 ||
0 ||
0 ||
0 ||
1 ||
[ 1 ] ] && no ||
[ yes ]
1019 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
1024 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
1029 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
1034 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
1039 if 1 ||
0 ||
0 ||
0 && 0
1044 if 1 ||
0 ||
0 ||
0 && 1
1049 if 0 ||
0 ||
0 ||
1 && 0
1054 if 0 ||
0 ||
0 ||
1 && 1
1059 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 0
1064 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 1
1070 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1075 if $diet == 'yo' && $curd == 'ho' && $ndefined
1081 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1086 if $diet == 'yo' && $curd == 'ho' && $ndefined
1091 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
1096 # Some more en-braced variables
1098 if ${diet} == ${curd}
1103 if ${diet} != ${curd}
1119 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
1124 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
1129 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1134 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1139 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1144 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1149 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1154 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] ||
3
1159 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
1165 if ! 0 && ! ! 1 && ! ! ! 0 && 3
1170 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
1175 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
1180 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
1185 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
1190 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
1195 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1200 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] ||
3
1205 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1212 check behave
:if-normal
0 "${MBOX}" '1688759742 719'
1214 if have_feat regex
; then
1215 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1217 if $dietcurd =~ '^yo.*'
1222 if $dietcurd =~ '^Yo.*'
1227 if $dietcurd @=~ '^Yo.*'
1232 if $dietcurd =~ '^yOho.+'
1237 if $dietcurd @!~ '.*Ho$'
1242 if $dietcurd !~ '.+yohO$'
1247 if [ $dietcurd @i!~ '.+yoho$' ]
1252 if ! [ $dietcurd @i=~ '.+yoho$' ]
1257 if ! ! [ $dietcurd @i!~ '.+yoho$' ]
1262 if ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ]
1267 if [ ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ] ]
1272 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1277 if ! ! ! $dietcurd !~ '.+yoho$'
1282 if ! ! ! $dietcurd =~ '.+yoho$'
1287 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1292 set diet=abc curd='^abc$'
1298 set diet=abc curd='^abcd$'
1306 check behave:if-regex 0 "${MBOX}" '1115671789 95'
1308 printf 'behave:if-regex: unsupported, skipped\n'
1314 t_behave_localopts() {
1317 # Nestable conditions test
1318 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1333 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1338 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1339 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1348 echo active trouble
: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1350 echo active null
: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1353 check behave
:localopts
0 "${MBOX}" '1936527193 192'
1358 t_behave_macro_param_shift
() {
1361 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
1364 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1369 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1370 if [ $# > 1 ] || [ $ignerr == '' ]
1375 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1377 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1381 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1386 call t2 1 you get four args
1387 echo t1.1: $?';' ignerr ($ignerr) should not exist
1388 call t2 1 you get 'three args'
1389 echo t1.2: $?';' ignerr ($ignerr) should not exist
1390 call t2 1 you 'get two args'
1391 echo t1.3: $?';' ignerr ($ignerr) should not exist
1392 call t2 1 'you get one arg'
1393 echo t1.4: $?';' ignerr ($ignerr) should not exist
1394 ignerr call t2 '' 'you get one arg'
1395 echo t1.5: $?';' ignerr ($ignerr) should not exist
1400 check behave:macro_param_shift 0 "${MBOX}" '1402489146 1682'
1405 t_behave_addrcodec() {
1408 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1409 vput addrcodec res e
1 <doog@def
>
1410 echo $?
/$^ERRNAME
$res
1411 eval vput addrcodec res d
$res
1412 echo $?
/$^ERRNAME
$res
1413 vput addrcodec res e
2 .
<doog@def
>
1414 echo $?
/$^ERRNAME
$res
1415 eval vput addrcodec res d
$res
1416 echo $?
/$^ERRNAME
$res
1417 vput addrcodec res e
3 Sauer Dr.
<doog@def
>
1418 echo $?
/$^ERRNAME
$res
1419 eval vput addrcodec res d
$res
1420 echo $?
/$^ERRNAME
$res
1421 vput addrcodec res e
3.50 Sauer
(Ma
) Dr.
<doog@def
>
1422 echo $?
/$^ERRNAME
$res
1423 eval vput addrcodec res d
$res
1424 echo $?
/$^ERRNAME
$res
1425 vput addrcodec res e
3.51 Sauer
(Ma
) "Dr." <doog@def
>
1426 echo $?
/$^ERRNAME
$res
1427 eval vput addrcodec res d
$res
1428 echo $?
/$^ERRNAME
$res
1430 vput addrcodec res
+e
4 Sauer
(Ma
) Dr.
<doog@def
>
1431 echo $?
/$^ERRNAME
$res
1432 eval vput addrcodec res d
$res
1433 echo $?
/$^ERRNAME
$res
1434 vput addrcodec res
+e
5 Sauer
(Ma
) Braten Dr.
<doog@def
>
1435 echo $?
/$^ERRNAME
$res
1436 eval vput addrcodec res d
$res
1437 echo $?
/$^ERRNAME
$res
1438 vput addrcodec res
+e
6 Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
>
1439 echo $?
/$^ERRNAME
$res
1440 eval vput addrcodec res d
$res
1441 echo $?
/$^ERRNAME
$res
1442 vput addrcodec res
+e
7 Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
> (bu
)
1443 echo $?
/$^ERRNAME
$res
1444 eval vput addrcodec res d
$res
1445 echo $?
/$^ERRNAME
$res
1446 vput addrcodec res
+e
8 \
1447 Dr. Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
> (bu
) Boom. Boom
1448 echo $?
/$^ERRNAME
$res
1449 eval vput addrcodec res d
$res
1450 echo $?
/$^ERRNAME
$res
1451 vput addrcodec res
+e
9 Dr.Sauer
(Ma
)Braten Dr.
(Heu
) <doog@def
>
1452 echo $?
/$^ERRNAME
$res
1453 eval vput addrcodec res d
$res
1454 echo $?
/$^ERRNAME
$res
1455 vput addrcodec res
+e
10 (Ma
)Braten Dr.
(Heu
) <doog@def
>
1456 echo $?
/$^ERRNAME
$res
1457 eval vput addrcodec res d
$res
1458 echo $?
/$^ERRNAME
$res
1459 vput addrcodec res
+e
11 (Ma
)Braten Dr
"." (Heu
) <doog@def
>
1460 echo $?
/$^ERRNAME
$res
1461 eval vput addrcodec res d
$res
1462 echo $?
/$^ERRNAME
$res
1463 vput addrcodec res
+e
12 Dr. Sauer
(Ma
) Braten Dr.
(u
) <doog@def
>
1464 echo $?
/$^ERRNAME
$res
1465 eval vput addrcodec res d
$res
1466 echo $?
/$^ERRNAME
$res
1467 vput addrcodec res
+e
13(Ma
)Braten Dr.
(Heu
) <doog@def
>
1468 echo $?
/$^ERRNAME
$res
1469 eval vput addrcodec res d
$res
1470 echo $?
/$^ERRNAME
$res
1471 vput addrcodec res
+e
14 Hey
, Du
<doog@def
> Wie
() findet Dr. das?
()
1472 echo $?
/$^ERRNAME
$res
1473 eval vput addrcodec res d
$res
1474 echo $?
/$^ERRNAME
$res
1475 vput addrcodec res
+e
15 \
1476 Hey
, Du
<doog@def
> Wie
() findet
"" Dr.
"" das?
()
1477 echo $?
/$^ERRNAME
$res
1478 eval vput addrcodec res d
$res
1479 echo $?
/$^ERRNAME
$res
1480 vput addrcodec res
+e
16 \
1481 "Hey," "Du" <doog@def
> "Wie()" findet
"" Dr.
"" das?
()
1482 echo $?
/$^ERRNAME
$res
1483 eval vput addrcodec res d
$res
1484 echo $?
/$^ERRNAME
$res
1485 vput addrcodec res
+e
17 \
1486 "Hey" Du
<doog@def
> "Wie() findet " " Dr. """ das?
()
1487 echo $?
/$^ERRNAME
$res
1488 eval vput addrcodec res d
$res
1489 echo $?
/$^ERRNAME
$res
1490 vput addrcodec res
+e
18 \
1491 <doog@def
> "Hey" Du
"Wie() findet " " Dr. """ das?
()
1492 echo $?
/$^ERRNAME
$res
1493 eval vput addrcodec res d
$res
1494 echo $?
/$^ERRNAME
$res
1495 vput addrcodec res
+e
19 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
1496 echo $?
/$^ERRNAME
$res
1497 eval vput addrcodec res d
$res
1498 echo $?
/$^ERRNAME
$res
1500 vput addrcodec res
++e
20 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
1501 echo $?
/$^ERRNAME
$res
1502 vput addrcodec res
++e
21 Hey\
,\"" <doog@def> "Wie
()" findet \" Dr. \" das?
1503 echo $?/$^ERRNAME $res
1504 eval vput addrcodec res d $res
1505 echo $?/$^ERRNAME $res
1507 vput addrcodec res +++e 22 Hey\\,\" <doog@def> "Wie
()" findet \" Dr. \" das?
1508 echo $?/$^ERRNAME $res
1509 eval vput addrcodec res d $res
1510 echo $?/$^ERRNAME $res
1512 vput addrcodec res s \
1513 "23 Hey
\\,\\\" \"Wie
" () "\" findet
\\\" Dr.
\\\" das?
" <doog@def>
1514 echo $?/$^ERRNAME $res
1517 check behave:addrcodec 0 "${MBOX}" '429099645 2414'
1525 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev
/null
1526 vput vexpr res
= 9223372036854775807
1527 echo $?
/$^ERRNAME
$res
1528 vput vexpr res
= 9223372036854775808
1529 echo $?
/$^ERRNAME
$res
1530 vput vexpr res
=@
9223372036854775808
1531 echo $?
/$^ERRNAME
$res
1532 vput vexpr res
= -9223372036854775808
1533 echo $?
/$^ERRNAME
$res
1534 vput vexpr res
= -9223372036854775809
1535 echo $?
/$^ERRNAME
$res
1536 vput vexpr res
=@
-9223372036854775809
1537 echo $?
/$^ERRNAME
$res
1540 echo $?
/$^ERRNAME
$res
1542 echo $?
/$^ERRNAME
$res
1544 echo $?
/$^ERRNAME
$res
1546 vput vexpr res
+ 0 0
1547 echo $?
/$^ERRNAME
$res
1548 vput vexpr res
+ 0 1
1549 echo $?
/$^ERRNAME
$res
1550 vput vexpr res
+ 1 1
1551 echo $?
/$^ERRNAME
$res
1553 vput vexpr res
+ 9223372036854775807 0
1554 echo $?
/$^ERRNAME
$res
1555 vput vexpr res
+ 9223372036854775807 1
1556 echo $?
/$^ERRNAME
$res
1557 vput vexpr res
+@
9223372036854775807 1
1558 echo $?
/$^ERRNAME
$res
1559 vput vexpr res
+ 0 9223372036854775807
1560 echo $?
/$^ERRNAME
$res
1561 vput vexpr res
+ 1 9223372036854775807
1562 echo $?
/$^ERRNAME
$res
1563 vput vexpr res
+@
1 9223372036854775807
1564 echo $?
/$^ERRNAME
$res
1566 vput vexpr res
+ -9223372036854775808 0
1567 echo $?
/$^ERRNAME
$res
1568 vput vexpr res
+ -9223372036854775808 -1
1569 echo $?
/$^ERRNAME
$res
1570 vput vexpr res
+@
-9223372036854775808 -1
1571 echo $?
/$^ERRNAME
$res
1572 vput vexpr res
+ 0 -9223372036854775808
1573 echo $?
/$^ERRNAME
$res
1574 vput vexpr res
+ -1 -9223372036854775808
1575 echo $?
/$^ERRNAME
$res
1576 vput vexpr res
+@
-1 -9223372036854775808
1577 echo $?
/$^ERRNAME
$res
1579 vput vexpr res
- 0 0
1580 echo $?
/$^ERRNAME
$res
1581 vput vexpr res
- 0 1
1582 echo $?
/$^ERRNAME
$res
1583 vput vexpr res
- 1 1
1584 echo $?
/$^ERRNAME
$res
1586 vput vexpr res
- 9223372036854775807 0
1587 echo $?
/$^ERRNAME
$res
1588 vput vexpr res
- 9223372036854775807 -1
1589 echo $?
/$^ERRNAME
$res
1590 vput vexpr res
-@
9223372036854775807 -1
1591 echo $?
/$^ERRNAME
$res
1592 vput vexpr res
- 0 9223372036854775807
1593 echo $?
/$^ERRNAME
$res
1594 vput vexpr res
- -1 9223372036854775807
1595 echo $?
/$^ERRNAME
$res
1596 vput vexpr res
- -2 9223372036854775807
1597 echo $?
/$^ERRNAME
$res
1598 vput vexpr res
-@
-2 9223372036854775807
1599 echo $?
/$^ERRNAME
$res
1601 vput vexpr res
- -9223372036854775808 +0
1602 echo $?
/$^ERRNAME
$res
1603 vput vexpr res
- -9223372036854775808 +1
1604 echo $?
/$^ERRNAME
$res
1605 vput vexpr res
-@
-9223372036854775808 +1
1606 echo $?
/$^ERRNAME
$res
1607 vput vexpr res
- 0 -9223372036854775808
1608 echo $?
/$^ERRNAME
$res
1609 vput vexpr res
- +1 -9223372036854775808
1610 echo $?
/$^ERRNAME
$res
1611 vput vexpr res
-@
+1 -9223372036854775808
1612 echo $?
/$^ERRNAME
$res
1614 vput vexpr res
+ -13 -2
1615 echo $?
/$^ERRNAME
$res
1616 vput vexpr res
- 0 0
1617 echo $?
/$^ERRNAME
$res
1618 vput vexpr res
- 0 1
1619 echo $?
/$^ERRNAME
$res
1620 vput vexpr res
- 1 1
1621 echo $?
/$^ERRNAME
$res
1622 vput vexpr res
- -13 -2
1623 echo $?
/$^ERRNAME
$res
1625 vput vexpr res
* 0 0
1626 echo $?
/$^ERRNAME
$res
1627 vput vexpr res
* 0 1
1628 echo $?
/$^ERRNAME
$res
1629 vput vexpr res
* 1 1
1630 echo $?
/$^ERRNAME
$res
1631 vput vexpr res
* -13 -2
1632 echo $?
/$^ERRNAME
$res
1634 vput vexpr res
/ 0 0
1635 echo $?
/$^ERRNAME
$res
1636 vput vexpr res
/ 0 1
1637 echo $?
/$^ERRNAME
$res
1638 vput vexpr res
/ 1 1
1639 echo $?
/$^ERRNAME
$res
1640 vput vexpr res
/ -13 -2
1641 echo $?
/$^ERRNAME
$res
1643 vput vexpr res
% 0 0
1644 echo $?
/$^ERRNAME
$res
1645 vput vexpr res
% 0 1
1646 echo $?
/$^ERRNAME
$res
1647 vput vexpr res
% 1 1
1648 echo $?
/$^ERRNAME
$res
1649 vput vexpr res
% -13 -2
1650 echo $?
/$^ERRNAME
$res
1653 check behave
:vexpr-numeric
0 "${MBOX}" '1723609217 1048'
1655 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" #2>/dev/null
1656 vput vexpr res find 'bananarama' 'nana'
1657 echo $?/$^ERRNAME :$res:
1658 vput vexpr res find 'bananarama' 'bana'
1659 echo $?/$^ERRNAME :$res:
1660 vput vexpr res find 'bananarama' 'Bana'
1661 echo $?/$^ERRNAME :$res:
1662 vput vexpr res find 'bananarama' 'rama'
1663 echo $?/$^ERRNAME :$res:
1665 vput vexpr res ifind 'bananarama' 'nana'
1666 echo $?/$^ERRNAME :$res:
1667 vput vexpr res ifind 'bananarama' 'bana'
1668 echo $?/$^ERRNAME :$res:
1669 vput vexpr res ifind 'bananarama' 'Bana'
1670 echo $?/$^ERRNAME :$res:
1671 vput vexpr res ifind 'bananarama' 'rama'
1672 echo $?/$^ERRNAME :$res:
1674 vput vexpr res substring 'bananarama' 1
1675 echo $?/$^ERRNAME :$res:
1676 vput vexpr res substring 'bananarama' 3
1677 echo $?/$^ERRNAME :$res:
1678 vput vexpr res substring 'bananarama' 5
1679 echo $?/$^ERRNAME :$res:
1680 vput vexpr res substring 'bananarama' 7
1681 echo $?/$^ERRNAME :$res:
1682 vput vexpr res substring 'bananarama' 9
1683 echo $?/$^ERRNAME :$res:
1684 vput vexpr res substring 'bananarama' 10
1685 echo $?/$^ERRNAME :$res:
1686 vput vexpr res substring 'bananarama' 1 3
1687 echo $?/$^ERRNAME :$res:
1688 vput vexpr res substring 'bananarama' 3 3
1689 echo $?/$^ERRNAME :$res:
1690 vput vexpr res substring 'bananarama' 5 3
1691 echo $?/$^ERRNAME :$res:
1692 vput vexpr res substring 'bananarama' 7 3
1693 echo $?/$^ERRNAME :$res:
1694 vput vexpr res substring 'bananarama' 9 3
1695 echo $?/$^ERRNAME :$res:
1696 vput vexpr res substring 'bananarama' 10 3
1697 echo $?/$^ERRNAME :$res:
1701 check behave:vexpr-string 0 "${MBOX}" '265398700 267'
1703 if have_feat regex; then
1704 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" #2>/dev/null
1705 vput vexpr res regex
'bananarama' 'nana'
1706 echo $?
/$^ERRNAME
:$res:
1707 vput vexpr res regex
'bananarama' 'bana'
1708 echo $?
/$^ERRNAME
:$res:
1709 vput vexpr res regex
'bananarama' 'Bana'
1710 echo $?
/$^ERRNAME
:$res:
1711 vput vexpr res regex
'bananarama' 'rama'
1712 echo $?
/$^ERRNAME
:$res:
1714 vput vexpr res iregex
'bananarama' 'nana'
1715 echo $?
/$^ERRNAME
:$res:
1716 vput vexpr res iregex
'bananarama' 'bana'
1717 echo $?
/$^ERRNAME
:$res:
1718 vput vexpr res iregex
'bananarama' 'Bana'
1719 echo $?
/$^ERRNAME
:$res:
1720 vput vexpr res iregex
'bananarama' 'rama'
1721 echo $?
/$^ERRNAME
:$res:
1723 vput vexpr res regex
'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
1724 echo $?
/$^ERRNAME
:$res:
1725 vput vexpr res regex
'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
1726 echo $?
/$^ERRNAME
:$res:
1727 vput vexpr res regex
'bananarama' 'Bana(.+)' '\$1\$0'
1728 echo $?
/$^ERRNAME
:$res:
1729 vput vexpr res regex
'bananarama' '(.+)rama' '\$1\$0'
1730 echo $?
/$^ERRNAME
:$res:
1732 vput vexpr res iregex
'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
1733 echo $?
/$^ERRNAME
:$res:
1734 vput vexpr res iregex
'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
1735 echo $?
/$^ERRNAME
:$res:
1736 vput vexpr res iregex
'bananarama' 'Bana(.+)' '\$1\$0'
1737 echo $?
/$^ERRNAME
:$res:
1738 vput vexpr res iregex
'bananarama' '(.+)rama' '\$1\$0'
1739 echo $?
/$^ERRNAME
:$res:
1743 check behave
:vexpr-regex
0 "${MBOX}" '3270360157 311'
1745 printf 'behave:vexpr-regex: unsupported, skipped\n'
1751 t_behave_call_ret
() {
1754 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
1759 vput vexpr j '&' $i 7
1765 vput vexpr j '&' $i 7
1771 echo ! The end for $1
1775 # Transport $?/$! up the call chain
1781 wysh set i=$? j=$! k=$^ERRNAME
1785 echo ! The end for $1
1786 return $i $^ERR-BUSY
1790 # Up and down it goes
1797 vput vexpr k - $1 $2
1801 echo "# <$i/$j> .. "
1805 eval echon
"<\$1=\$i/\$^ERRNAME-$j "
1808 echo ! The end
for $1=$i/$2
1812 return $i $^ERR-BUSY
1818 call w1
0; echo ?
=$?
!=$
!; echo -----;
1819 call w2
0; echo ?
=$?
!=$^ERRNAME
; echo -----;
1820 call w3
0 1; echo ?
=$?
!=$^ERRNAME
; echo -----;
1823 check behave
:call_ret
0 "${MBOX}" '1572045517 5922'
1831 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
1836 vput vexpr j '&' $i 7
1842 echo ! The end for $1/$2
1844 return $i $^ERR-BUSY
1855 echo ?=$? !=$^ERRNAME
1858 echo ?=$? !=$^ERRNAME
1860 echo ?=$? !=$^ERRNAME
1863 check behave:xcall-1 0 "${MBOX}" '2401702082 23801'
1867 ${cat} <<- '__EOT' > "${BODY}"
1872 vput vexpr j '&' $i 7
1878 echo ! The end for $1
1881 echo would be err with errexit
1890 echo zwei, ?=$? !=$!
1891 localopts yes; set errexit
1893 echo drei, ?=$? !=$^ERRNAME
1895 echo vier, ?=$? !=$^ERRNAME, this is an error
1898 echo outer 1, ?=$? !=$^ERRNAME
1900 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
1902 echo outer 3, ?=$? !=$^ERRNAME
1903 echo this is definitely an error
1906 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' -Snomemdebug \
1908 check behave
:xcall-2
0 "${MBOX}" '3900716531 4200'
1910 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' -Snomemdebug \
1912 check behave:xcall-3 1 "${MBOX}" '1006776201 2799'
1917 t_behave_vpospar() {
1920 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1921 vpospar
set hey
, "'you ", world
!
1922 echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1923 vput vpospar x quote
; echo x
<$x>
1924 vpospar
clear;echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1925 vput vpospar y quote
;echo y
<$y>
1926 eval vpospar
set ${x};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1927 eval vpospar
set ${y};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1928 eval vpospar
set ${x};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1931 echo infun2
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1932 vput vpospar z quote
;echo infun2
:z
<$z>
1936 echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1937 vput vpospar y quote
;echo infun
:y
<$y>
1938 eval vpospar
set ${x};echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1939 vpospar
clear;echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1941 echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1942 eval vpospar
set ${y};echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1945 call infun This
"in a" fun
1946 echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1947 vpospar
clear;echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1949 check behave
:vpospar-1
0 "${MBOX}" '155175639 866'
1952 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1954 echo ifs<$ifs> ifs-ws<$ifs-ws>
1955 vpospar set hey, "'you ", world!
1956 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
1957 vput vpospar x quote; echo x<$x>
1958 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
1959 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
1962 echo ifs<$ifs> ifs-ws<$ifs-ws>
1963 vpospar set hey, "'you
", world!
1964 echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
1965 vput vpospar x quote; echo x<$x>
1966 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
1967 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
1970 echo ifs<$ifs> ifs-ws<$ifs-ws>
1971 vpospar set hey, "'you ", world!
1972 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
1973 vput vpospar x quote; echo x<$x>
1974 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
1975 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
1977 check behave:vpospar-ifs 0 "${MBOX}" '2015927702 706'
1984 TRAP_EXIT_ADDONS="./.t*"
1986 ${cat} <<- '__EOT
' > .tin
1987 hey1, "'you
", world!
1988 hey2, "'you ", bugs bunny!
1993 ${cat} <<- '__EOT
' |\
1994 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
1996 echo $?/$^ERRNAME / <$a><$b><$c>
1998 echo $?/$^ERRNAME / <$a><$b><$c>
2000 echo $?/$^ERRNAME / <$a><$b><$c>
2002 echo $?/$^ERRNAME / <$a><$b><$c>
2004 echo $?/$^ERRNAME / <$a><$b><$c>
2005 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
2007 check behave:read-1 0 "${MBOX}" '1527910147 173'
2009 ${cat} <<- '__EOT
' > .tin2
2010 hey2.0,:"'you
",:world!:mars.:
2011 hey2.1,:"'you ",:world!
2012 hey2.2,:"'you
",:bugs bunny!
2018 ${cat} <<- '__EOT' |\
2019 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
2022 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2024 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2026 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2028 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2030 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2032 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2034 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2036 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2037 readctl remove
6;echo readctl remove
:$?
/$^ERRNAME
2039 check behave
:read-ifs
0 "${MBOX}" '890153490 298'
2046 TRAP_EXIT_ADDONS
="./.t*"
2050 while [ ${i} -lt 112 ]; do
2051 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2052 "${MBOX}" "${i}" "${i}"
2055 ) |
${MAILX} ${ARGS}
2056 check behave
:mbox-1
0 "${MBOX}" '1140119864 13780'
2062 ' "${MBOX}" .tmbox1 .tmbox1 |
2063 ${MAILX} ${ARGS} > .tlst
2064 check behave
:mbox-2
0 .tlst
'2739893312 9103'
2070 ' "${MBOX}" .tmbox2 .tmbox2 |
2071 ${MAILX} ${ARGS} > .tlst
2072 check behave
:mbox-3
0 .tlst
'1702194178 9110'
2074 # only the odd (even)
2076 printf 'File "file://%s"
2079 while [ ${i} -lt 112 ]; do
2081 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2088 ) |
${MAILX} ${ARGS} > .tlst
2089 check behave
:mbox-4
0 .tmbox3
'631132924 6890'
2090 check behave
:mbox-5
- .tlst
'2960975049 4573'
2093 printf 'file "file://%s"
2096 while [ ${i} -lt 112 ]; do
2098 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2106 ' .tmbox3 .tmbox3 .tmbox2
2107 ) | ${MAILX} ${ARGS} > .tlst
2108 check behave:mbox-6 0 .tmbox3 '1387070539 13655'
2109 ${sed} 2d < .tlst > .tlstx
2110 check behave:mbox-7 - .tlstx '2729940494 13645'
2117 TRAP_EXIT_ADDONS=".
/.t
*"
2119 ${cat} <<-_EOT > ./.tsendmail.sh
2121 (echo 'From Hippocastanum Mon Jun 19 15:07:07 2017' && ${cat} && echo
2124 chmod 0755 ./.tsendmail.sh
2126 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh > ./.tall 2>&1
2128 alias a1 ex2@a1.ple "EX3
<ex3@a1.ple
>"
2130 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
2132 alias a4 a5 ex1@a4.ple
2134 alias a6 a7 ex1@a6.ple
2148 check behave:alias-1 0 "${MBOX}" '2496925843 272'
2149 check behave:alias-2 - .tall '3548953204 152'
2151 # TODO t_behave_alias: n_ALIAS_MAXEXP is compile-time constant,
2152 # TODO need to somehow provide its contents to the test, then test
2157 t_behave_filetype() {
2159 TRAP_EXIT_ADDONS=".
/.t
*"
2161 ${cat} <<-_EOT > ./.tsendmail.sh
2163 (echo 'From Alchemilla Wed Apr 25 15:12:13 2017' && ${cat} && echo
2166 chmod 0755 ./.tsendmail.sh
2168 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ ./snailmail.jpg\n~.\n' |
2169 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2170 check behave:filetype-1 0 "${MBOX}" '1645747150 13536'
2172 if command -v gzip >/dev/null 2>&1; then
2175 printf 'File "%s
"\ncopy 1 ./.t.mbox.gz
2176 copy 2 ./.t.mbox.gz' "${MBOX}" |
2178 -X'filetype gz gzip\ -dc gzip\ -c'
2179 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2181 -X'filetype gz gzip\ -dc gzip\ -c'
2183 check behave:filetype-2 0 ".
/.t.mbox
" '1645747150 13536'
2185 echo 'behave:filetype-2: unsupported, skipped'
2190 printf 'File "%s
"\ncopy 1 ./.t.mbox.gz
2196 -X'filetype gz gzip\ -dc gzip\ -c' \
2197 -X'filetype mbox.gz "${sed} 1,3d|
${cat}" \
2198 "echo eins
;echo zwei
;echo und mit
${sed} bist Du dabei
;${cat}"'
2199 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2201 -X'filetype gz gzip\ -dc gzip\ -c' \
2202 -X'filetype mbox.gz "${sed} 1,3d|
${cat}" kill\ 0'
2205 check behave:filetype-3 - ".
/.t.mbox
" '238021003 27092'
2210 t_behave_record_a_resend() {
2212 TRAP_EXIT_ADDONS=".
/.t.record .
/.t.resent
"
2216 m %s\n~s Subject 1.\nHello.\n~.
2217 set record-files add-file-recipients
2218 m %s\n~s Subject 2.\nHello.\n~.
2220 resend 2 ./.t.resent
2221 Resend 1 ./.t.resent
2223 resend 2 ./.t.resent
2224 Resend 1 ./.t.resent
2225 ' ./.t.record "${MBOX}" "${MBOX}" "${MBOX}" |
2228 check behave:record_a_resend-1 0 "${MBOX}" '3057873538 256'
2229 check behave:record_a_resend-2 - .t.record '391356429 460'
2230 check behave:record_a_resend-3 - .t.resent '2685231691 648'
2235 t_behave_e_H_L_opts() {
2237 TRAP_EXIT_ADDONS=".
/.tsendmail.sh .
/.t.mbox
"
2240 ${MAILX} ${ARGS} -ef ./.t.mbox
2241 echo ${?} > "${MBOX}"
2243 ${cat} <<-_EOT > ./.tsendmail.sh
2245 (echo 'From Alchemilla Wed Apr 07 17:03:33 2017' && ${cat} && echo
2248 chmod 0755 ./.tsendmail.sh
2249 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
2250 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2251 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
2252 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2254 ${MAILX} ${ARGS} -ef ./.t.mbox
2255 echo ${?} >> "${MBOX}"
2256 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox
2257 echo ${?} >> "${MBOX}"
2258 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox
2259 echo ${?} >> "${MBOX}"
2260 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox
2261 echo ${?} >> "${MBOX}"
2262 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox
2263 echo ${?} >> "${MBOX}"
2264 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox
2265 echo ${?} >> "${MBOX}"
2266 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox
2267 echo ${?} >> "${MBOX}"
2269 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}"
2270 echo ${?} >> "${MBOX}"
2271 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}"
2272 echo ${?} >> "${MBOX}"
2273 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}"
2274 echo ${?} >> "${MBOX}"
2275 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}"
2276 echo ${?} >> "${MBOX}"
2277 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}"
2278 echo ${?} >> "${MBOX}"
2279 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}"
2280 echo ${?} >> "${MBOX}"
2281 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>/dev
/null
2282 echo ${?} >> "${MBOX}"
2284 check behave
:e_H_L_opts
- "${MBOX}" '1708955574 678'
2289 t_behave_compose_hooks
() { # TODO monster: "tests" also `alternates', at least
2291 TRAP_EXIT_ADDONS
="./.t*"
2293 (echo line one
&&echo line two
&&echo line three
) > .
/.treadctl
2294 (echo echo four
&&echo echo five
&&echo echo six
) > .
/.tattach
2296 ${cat} <<-_EOT > ./.tsendmail.sh
2298 (echo 'From PrimulaVeris Wed Apr 10 22:59:00 2017' && ${cat} && echo
2301 chmod 0755 .
/.tsendmail.sh
2303 ${cat} <<'__EOT__' > ./.trc
2305 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
2308 vput vexpr es substr "$1" 0 1
2313 define read_mline_res {
2314 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
2315 echo $len/$es/$^ERRNAME: $hl
2316 if [ $es -ne $^ERR-NONE ]
2317 xcall bail read_mline_res
2319 \xcall read_mline_res
2324 echo "~^header list"; read hl; echo $hl;\
2325 call xerr "$hl" "in_addr ($xh) 0-1"
2327 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2328 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
2329 echo "~^header insert $xh <${xh}2@exam.ple>";\
2330 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
2331 echo "~^header insert $xh ${xh}3@exam.ple";\
2332 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
2333 echo "~^header list $xh"; read hl; echo $hl;\
2334 call xerr "$hl" "ins_addr $xh 1-4"
2335 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
2338 if [ "$t_remove" == "" ]
2342 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
2343 echo "~^header remove $xh"; read es; vput vexpr es substr $es 0 3
2345 xcall bail "ins_addr $xh 2-2"
2347 echo "~^header list $xh"; read es; vput vexpr es substr $es 0 3
2349 xcall bail "ins_addr $xh 2-3"
2351 echo "~^header show $xh"; read es; vput vexpr es substr $es 0 3
2353 xcall bail "ins_addr $xh 2-4"
2357 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2358 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
2359 echo "~^header insert $xh <${xh}2@exam.ple>";\
2360 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
2361 echo "~^header insert $xh ${xh}3@exam.ple";\
2362 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
2363 echo "~^header list $xh"; read hl; echo $hl;\
2364 call xerr "$hl" "ins_addr $xh 3-4"
2365 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
2368 echo "~^header remove-at $xh 1"; read es;\
2369 call xerr $es "ins_addr $xh 3-6"
2370 echo "~^header remove-at $xh 1"; read es;\
2371 call xerr $es "ins_addr $xh 3-7"
2372 echo "~^header remove-at $xh 1"; read es;\
2373 call xerr $es "ins_addr $xh 3-8"
2374 echo "~^header remove-at $xh 1"; read es;\
2375 vput vexpr es substr $es 0 3
2377 xcall bail "ins_addr $xh 3-9"
2379 echo "~^header remove-at $xh T"; read es;\
2380 vput vexpr es substr $es 0 3
2382 xcall bail "ins_addr $xh 3-10"
2384 echo "~^header list $xh"; read es;\
2385 vput vexpr es substr $es 0 3
2387 xcall bail "ins_addr $xh 3-11"
2389 echo "~^header show $xh"; read es;\
2390 vput vexpr es substr $es 0 3
2392 xcall bail "ins_addr $xh 3-12"
2396 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2397 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
2398 echo "~^header insert $xh <${xh}2@exam.ple> (comment) \"Quot(e)d\"";\
2399 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
2400 echo "~^header insert $xh ${xh}3@exam.ple";\
2401 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
2402 echo "~^header list $xh"; read hl; echo $hl;\
2403 call xerr "$hl" "header list $xh 3-4"
2404 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
2407 echo "~^header remove-at $xh 3"; read es;\
2408 call xerr $es "ins_addr $xh 4-6"
2409 echo "~^header remove-at $xh 2"; read es;\
2410 call xerr $es "ins_addr $xh 4-7"
2411 echo "~^header remove-at $xh 1"; read es;\
2412 call xerr $es "ins_addr $xh 4-8"
2413 echo "~^header remove-at $xh 1"; read es;\
2414 vput vexpr es substr $es 0 3
2416 xcall bail "ins_addr $xh 4-9"
2418 echo "~^header remove-at $xh T"; read es;\
2419 vput vexpr es substr $es 0 3
2421 xcall bail "ins_addr $xh 4-10"
2423 echo "~^header list $xh"; read es;\
2424 vput vexpr es substr $es 0 3
2426 xcall bail "ins_addr $xh 4-11"
2428 echo "~^header show $xh"; read es;\
2429 vput vexpr es substr $es 0 3
2431 xcall bail "ins_addr $xh 4-12"
2435 wysh set xh=$1 mult=$2
2436 echo "~^header list"; read hl; echo $hl;\
2437 call xerr "$hl" "ins_ref ($xh) 0-1"
2439 echo "~^header insert $xh <$xh@exam.ple>";\
2440 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
2442 echo "~^header insert $xh <${xh}2@exam.ple>";\
2443 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
2444 echo "~^header insert $xh ${xh}3@exam.ple";\
2445 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
2447 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
2448 vput vexpr es substr $es 0 3
2450 xcall bail "ins_ref $xh 1-4"
2454 echo "~^header list $xh"; read hl; echo $hl;\
2455 call xerr "$hl" "ins_ref $xh 1-5"
2456 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
2459 if [ "$t_remove" == "" ]
2463 echo "~^header remove $xh"; read es;\
2464 call xerr $es "ins_ref $xh 2-1"
2465 echo "~^header remove $xh"; read es;\
2466 vput vexpr es substr $es 0 3
2468 xcall bail "ins_ref $xh 2-2"
2470 echo "~^header list $xh"; read es;\
2471 vput vexpr es substr $es 0 3
2473 xcall bail "$es ins_ref $xh 2-3"
2475 echo "~^header show $xh"; read es;\
2476 vput vexpr es substr $es 0 3
2478 xcall bail "ins_ref $xh 2-4"
2482 echo "~^header insert $xh <$xh@exam.ple>";\
2483 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
2485 echo "~^header insert $xh <${xh}2@exam.ple>";\
2486 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
2487 echo "~^header insert $xh ${xh}3@exam.ple";\
2488 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
2490 echo "~^header list $xh";\
2491 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
2492 echo "~^header show $xh";\
2493 read es; call xerr $es "ins_ref $xh 3-5"
2496 echo "~^header remove-at $xh 1"; read es;\
2497 call xerr $es "ins_ref $xh 3-6"
2498 if [ $mult -ne 0 ] && [ $xh != subject ]
2499 echo "~^header remove-at $xh 1"; read es;\
2500 call xerr $es "ins_ref $xh 3-7"
2501 echo "~^header remove-at $xh 1"; read es;\
2502 call xerr $es "ins_ref $xh 3-8"
2504 echo "~^header remove-at $xh 1"; read es;\
2505 vput vexpr es substr $es 0 3
2507 xcall bail "ins_ref $xh 3-9"
2509 echo "~^header remove-at $xh T"; read es;\
2510 vput vexpr es substr $es 0 3
2512 xcall bail "ins_ref $xh 3-10"
2514 echo "~^header show $xh"; read es;\
2515 vput vexpr es substr $es 0 3
2517 xcall bail "ins_ref $xh 3-11"
2521 echo "~^header insert $xh <$xh@exam.ple> ";\
2522 read es; echo $es; call xerr "$es" "ins_ref $xh 4-1"
2524 echo "~^header insert $xh <${xh}2@exam.ple> ";\
2525 read es; echo $es; call xerr "$es" "ins_ref $xh 4-2"
2526 echo "~^header insert $xh ${xh}3@exam.ple";\
2527 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
2529 echo "~^header list $xh"; read hl; echo $hl;\
2530 call xerr "$hl" "ins_ref $xh 4-4"
2531 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
2534 if [ $mult -ne 0 ] && [ $xh != subject ]
2535 echo "~^header remove-at $xh 3"; read es;\
2536 call xerr $es "ins_ref $xh 4-6"
2537 echo "~^header remove-at $xh 2"; read es;\
2538 call xerr $es "ins_ref $xh 4-7"
2540 echo "~^header remove-at $xh 1"; read es;\
2541 call xerr $es "ins_ref $xh 4-8"
2542 echo "~^header remove-at $xh 1"; read es;\
2543 vput vexpr es substr $es 0 3
2545 xcall bail "ins_ref $xh 4-9"
2547 echo "~^header remove-at $xh T"; read es;\
2548 vput vexpr es substr $es 0 3
2550 xcall bail "ins_ref $xh 4-10"
2552 echo "~^header show $xh"; read es;\
2553 vput vexpr es substr $es 0 3
2555 xcall bail "ins_ref $xh 4-11"
2560 # In collect.c order
2562 call ins_ref sender 0 # Not a "ref", but works
2566 call ins_addr reply-To
2567 call ins_addr mail-Followup-to
2568 call ins_ref messAge-id 0
2569 call ins_ref rEfErEncEs 1
2570 call ins_ref in-Reply-to 1
2571 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
2572 call ins_addr freeForm1
2573 call ins_addr freeform2
2575 echo "~^header show MAILX-Command"; read es; call xerr $es "t_header 1000"
2577 echo "~^header show MAILX-raw-TO"; read es; call xerr $es "t_header 1001"
2585 echo "~^attachment";\
2586 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2588 xcall bail "attach 0-1"
2591 echo "~^attach attribute ./.treadctl";\
2592 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2594 xcall bail "attach 0-2"
2596 echo "~^attachment attribute-at 1";\
2597 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2599 xcall bail "attach 0-3"
2602 echo "~^attachment insert ./.treadctl=ascii";\
2603 read hl; echo $hl; call xerr "$hl" "attach 1-1"
2604 echo "~^attachment list";\
2605 read es; echo $es;call xerr "$es" "attach 1-2"
2607 echo "~^attachment attribute ./.treadctl";\
2608 read es; echo $es;call xerr "$es" "attach 1-3"
2610 echo "~^attachment attribute .treadctl";\
2611 read es; echo $es;call xerr "$es" "attach 1-4"
2613 echo "~^attachment attribute-at 1";\
2614 read es; echo $es;call xerr "$es" "attach 1-5"
2617 echo "~^attachment attribute-set ./.treadctl filename rctl";\
2618 read es; echo $es;call xerr "$es" "attach 1-6"
2619 echo "~^attachment attribute-set .treadctl content-description Au";\
2620 read es; echo $es;call xerr "$es" "attach 1-7"
2621 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
2622 read es; echo $es;call xerr "$es" "attach 1-8"
2624 echo "~^attachment attribute ./.treadctl";\
2625 read es; echo $es;call xerr "$es" "attach 1-9"
2627 echo "~^attachment attribute .treadctl";\
2628 read es; echo $es;call xerr "$es" "attach 1-10"
2630 echo "~^attachment attribute rctl";\
2631 read es; echo $es;call xerr "$es" "attach 1-11"
2633 echo "~^attachment attribute-at 1";\
2634 read es; echo $es;call xerr "$es" "attach 1-12"
2638 echo "~^attachment insert ./.tattach=latin1";\
2639 read hl; echo $hl; call xerr "$hl" "attach 2-1"
2640 echo "~^attachment list";\
2641 read es; echo $es;call xerr "$es" "attach 2-2"
2643 echo "~^attachment attribute ./.tattach";\
2644 read es; echo $es;call xerr "$es" "attach 2-3"
2646 echo "~^attachment attribute .tattach";\
2647 read es; echo $es;call xerr "$es" "attach 2-4"
2649 echo "~^attachment attribute-at 2";\
2650 read es; echo $es;call xerr "$es" "attach 2-5"
2653 echo "~^attachment attribute-set ./.tattach filename tat";\
2654 read es; echo $es;call xerr "$es" "attach 2-6"
2656 "~^attachment attribute-set .tattach content-description Au2";\
2657 read es; echo $es;call xerr "$es" "attach 2-7"
2658 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
2659 read es; echo $es;call xerr "$es" "attach 2-8"
2661 "~^attachment attribute-set-at 2 content-type application/x-sh";\
2662 read es; echo $es;call xerr "$es" "attach 2-9"
2664 echo "~^attachment attribute ./.tattach";\
2665 read es; echo $es;call xerr "$es" "attach 2-10"
2667 echo "~^attachment attribute .tattach";\
2668 read es; echo $es;call xerr "$es" "attach 2-11"
2670 echo "~^attachment attribute tat";\
2671 read es; echo $es;call xerr "$es" "attach 2-12"
2673 echo "~^attachment attribute-at 2";\
2674 read es; echo $es;call xerr "$es" "attach 2-13"
2678 if [ "$t_remove" == "" ]
2682 echo "~^attachment remove ./.treadctl"; read es;\
2683 call xerr $es "attach 3-1"
2684 echo "~^attachment remove ./.tattach"; read es;\
2685 call xerr $es "attach 3-2"
2686 echo "~^ attachment remove ./.treadctl"; read es;\
2687 vput vexpr es substr $es 0 3
2689 xcall bail "attach 3-3"
2691 echo "~^ attachment remove ./.tattach"; read es;\
2692 vput vexpr es substr $es 0 3
2694 xcall bail "attach 3-4"
2696 echo "~^attachment list"; read es;\
2697 vput vexpr es substr $es 0 3
2699 xcall bail "attach 3-5"
2703 echo "~^attachment insert ./.tattach=latin1";\
2704 read hl; echo $hl; call xerr "$hl" "attach 4-1"
2705 echo "~^attachment insert ./.tattach=latin1";\
2706 read hl; echo $hl; call xerr "$hl" "attach 4-2"
2707 echo "~^attachment list";\
2708 read es; echo $es;call xerr "$es" "attach 4-3"
2710 echo "~^ attachment remove .tattach"; read es;\
2711 vput vexpr es substr $es 0 3
2713 xcall bail "attach 4-4 $es"
2715 echo "~^attachment remove-at T"; read es;\
2716 vput vexpr es substr $es 0 3
2718 xcall bail "attach 4-5"
2720 echo "~^attachment remove ./.tattach"; read es;\
2721 call xerr $es "attach 4-6"
2722 echo "~^attachment remove ./.tattach"; read es;\
2723 call xerr $es "attach 4-7"
2724 echo "~^ attachment remove ./.tattach"; read es;\
2725 vput vexpr es substr $es 0 3
2727 xcall bail "attach 4-8 $es"
2729 echo "~^attachment list"; read es;\
2730 vput vexpr es substr $es 0 3
2732 xcall bail "attach 4-9"
2736 echo "~^attachment insert ./.tattach=latin1";\
2737 read hl; echo $hl; call xerr "$hl" "attach 5-1"
2738 echo "~^attachment insert ./.tattach=latin1";\
2739 read hl; echo $hl; call xerr "$hl" "attach 5-2"
2740 echo "~^attachment insert ./.tattach=latin1";\
2741 read hl; echo $hl; call xerr "$hl" "attach 5-3"
2742 echo "~^attachment list";\
2743 read es; echo $es;call xerr "$es" "attach 5-4"
2746 echo "~^attachment remove-at 3"; read es;\
2747 call xerr $es "attach 5-5"
2748 echo "~^attachment remove-at 3"; read es;\
2749 vput vexpr es substr $es 0 3
2751 xcall bail "attach 5-6"
2753 echo "~^attachment remove-at 2"; read es;\
2754 call xerr $es "attach 5-7"
2755 echo "~^attachment remove-at 2"; read es;\
2756 vput vexpr es substr $es 0 3
2758 xcall bail "attach 5-8"
2760 echo "~^attachment remove-at 1"; read es;\
2761 call xerr $es "attach 5-9"
2762 echo "~^attachment remove-at 1"; read es;\
2763 vput vexpr es substr $es 0 3
2765 xcall bail "attach 5-10"
2768 echo "~^attachment list"; read es;\
2769 vput vexpr es substr $es 0 3
2771 xcall bail "attach 5-11"
2775 echo "~^attachment insert ./.tattach=latin1";\
2776 read hl; echo $hl; call xerr "$hl" "attach 6-1"
2777 echo "~^attachment insert ./.tattach=latin1";\
2778 read hl; echo $hl; call xerr "$hl" "attach 6-2"
2779 echo "~^attachment insert ./.tattach=latin1";\
2780 read hl; echo $hl; call xerr "$hl" "attach 6-3"
2781 echo "~^attachment list";\
2782 read es; echo $es;call xerr "$es" "attach 6-4"
2785 echo "~^attachment remove-at 1"; read es;\
2786 call xerr $es "attach 6-5"
2787 echo "~^attachment remove-at 1"; read es;\
2788 call xerr $es "attach 6-6"
2789 echo "~^attachment remove-at 1"; read es;\
2790 call xerr $es "attach 6-7"
2791 echo "~^attachment remove-at 1"; read es;\
2792 vput vexpr es substr $es 0 3
2794 xcall bail "attach 6-8"
2797 echo "~^attachment list"; read es;\
2798 vput vexpr es substr $es 0 3
2800 xcall bail "attach 6-9"
2812 echo on-compose-enter, mailx-command<$mailx-command>
2813 alternates alter1@exam.ple alter2@exam.ple
2815 set autocc='alter1@exam.ple alter2@exam.ple'
2816 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
2817 echo mailx-subject<$mailx-subject>
2818 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
2819 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
2820 mailx-raw-bcc<$mailx-raw-bcc>
2821 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
2822 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
2825 echo on-compose-leave, mailx-command<$mailx-command>
2826 eval alternates $alternates alter3@exam.ple alter4@exam.ple
2828 set autobcc='alter3@exam.ple alter4@exam.ple'
2829 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
2830 echo mailx-subject<$mailx-subject>
2831 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
2832 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
2833 mailx-raw-bcc<$mailx-raw-bcc>
2834 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
2835 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
2838 echo on-compose-cleanup, mailx-command<$mailx-command>
2841 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
2842 echo mailx-subject<$mailx-subject>
2843 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
2844 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
2845 mailx-raw-bcc<$mailx-raw-bcc>
2846 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
2847 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
2849 wysh set on-compose-splice=t_ocs \
2850 on-compose-enter=t_oce on-compose-leave=t_ocl \
2851 on-compose-cleanup=t_occ
2857 printf 'm this-goes@nowhere\nbody\n!.\n' |
2858 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
2859 -X'source ./.trc' -Smta=.
/.tsendmail.sh \
2861 ${cat} .
/.tall
>> "${MBOX}"
2862 check behave
:compose_hooks-1
0 "${MBOX}" '3667291468 10101'
2865 printf 'm this-goes@nowhere\nbody\n!.\n' |
2866 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
2867 -St_remove=1 -X'source ./.trc' -Smta=.
/.tsendmail.sh \
2869 ${cat} .
/.tall
>> "${MBOX}"
2870 check behave
:compose_hooks-2
0 "${MBOX}" '1746765053 12535'
2872 # Some state machine stress, shell compose hook, localopts for hook, etc.
2873 # readctl in child. ~r as HERE document
2875 printf 'm ex@am.ple\nbody\n!.\nvar t_oce t_ocs t_ocs_sh t_ocl t_occ autocc' |
2876 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
2877 -Smta=.
/.tsendmail.sh \
2880 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
2883 vput vexpr es substr "$1" 0 1
2888 define read_mline_res {
2889 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
2890 echo $len/$es/$^ERRNAME: $hl
2891 if [ $es -ne $^ERR-NONE ]
2892 xcall bail read_mline_res
2894 \xcall read_mline_res
2898 vput vexpr i + 1 "$2"
2900 vput vexpr j % $i 10
2907 eval \\$j _work $1 $i
2910 vput vexpr i + $i "$1"
2914 read line;wysh set es=$? en=$^ERRNAME ; echo read:$es/$en: $line
2915 if [ "${es}" -ne -1 ]
2918 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
2923 echo "~^header list"; read hl; echo $hl;\
2924 vput vexpr es substr "$hl" 0 1
2926 xcall bail "header list"
2929 call _work 1; echo $?
2930 echo "~^header insert cc splicy diet <splice@exam.ple> spliced";\
2931 read es; echo $es; vput vexpr es substr "$es" 0 1
2933 xcall bail "be diet"
2935 echo "~^header insert cc <splice2@exam.ple>";\
2936 read es; echo $es; vput vexpr es substr "$es" 0 1
2938 xcall bail "be diet2"
2941 call _work 2; echo $?
2942 echo "~^header insert bcc juicy juice <juice@exam.ple> spliced";\
2943 read es; echo $es;vput vexpr es substr "$es" 0 1
2945 xcall bail "be juicy"
2947 echo "~^header insert bcc juice2@exam.ple";\
2948 read es; echo $es;vput vexpr es substr "$es" 0 1
2950 xcall bail "be juicy2"
2952 echo "~^header insert bcc juice3 <juice3@exam.ple>";\
2953 read es; echo $es;vput vexpr es substr "$es" 0 1
2955 xcall bail "be juicy3"
2957 echo "~^header insert bcc juice4@exam.ple";\
2958 read es; echo $es;vput vexpr es substr "$es" 0 1
2960 xcall bail "be juicy4"
2963 echo "~^header remove-at bcc 3";\
2964 read es; echo $es;vput vexpr es substr "$es" 0 1
2966 xcall bail "remove juicy5"
2968 echo "~^header remove-at bcc 2";\
2969 read es; echo $es;vput vexpr es substr "$es" 0 1
2971 xcall bail "remove juicy6"
2973 echo "~^header remove-at bcc 3";\
2974 read es; echo $es;vput vexpr es substr "$es" 0 3
2976 xcall bail "failed to remove-at"
2978 # Add duplicates which ought to be removed!
2979 echo "~^header insert bcc juice4@exam.ple";\
2980 read es; echo $es;vput vexpr es substr "$es" 0 1
2982 xcall bail "be juicy4-1"
2984 echo "~^header insert bcc juice4@exam.ple";\
2985 read es; echo $es;vput vexpr es substr "$es" 0 1
2987 xcall bail "be juicy4-2"
2989 echo "~^header insert bcc juice4@exam.ple";\
2990 read es; echo $es;vput vexpr es substr "$es" 0 1
2992 xcall bail "be juicy4-3"
2997 call _work 3; echo $?
2999 vput ! i echo just knock if you can hear me;\
3001 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
3003 echon shell-cmd says $?/$^ERRNAME: $i
3004 echo "~x will not become interpreted, we are reading until __EOT"
3006 read r_status; echo "~~r status output: $r_status"
3007 echo "~:echo $? $! $^ERRNAME"
3009 echo "~~r status from parent: $r_status"
3012 call _work 4; echo $?
3013 vput cwd cwd;echo cwd:$?
3014 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME;\
3018 call _work 5; echo $?
3019 echo "~^header show MAILX-Command"; read es;\
3020 call xerr $es "t_header 1000"; call read_mline_res
3021 echo "~^header show MAILX-raw-TO"; read es;\
3022 call xerr $es "t_header 1001"; xcall read_mline_res
3024 echoerr IT IS WRONG IF YOU SEE THIS
3027 echo on-compose-enter, mailx-command<$mailx-command>
3028 set t_oce autobcc=oce@exam.ple
3029 alternates alter1@exam.ple alter2@exam.ple
3031 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3032 echo mailx-subject<$mailx-subject>
3033 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3034 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3035 mailx-raw-bcc<$mailx-raw-bcc>
3036 echo mailx-orig-from<$mailx-orig-from> \
3037 mailx-orig-to<$mailx-orig-to> \
3038 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3041 echo on-compose-leave, mailx-command<$mailx-command>
3042 set t_ocl autocc=ocl@exam.ple
3043 alternates alter3@exam.ple alter4@exam.ple
3045 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3046 echo mailx-subject<$mailx-subject>
3047 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3048 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3049 mailx-raw-bcc<$mailx-raw-bcc>
3050 echo mailx-orig-from<$mailx-orig-from> \
3051 mailx-orig-to<$mailx-orig-to> \
3052 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3055 echo on-compose-cleanup, mailx-command<$mailx-command>
3056 set t_occ autocc=occ@exam.ple
3059 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3060 echo mailx-subject<$mailx-subject>
3061 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3062 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3063 mailx-raw-bcc<$mailx-raw-bcc>
3064 echo mailx-orig-from<$mailx-orig-from> \
3065 mailx-orig-to<$mailx-orig-to> \
3066 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3068 wysh set on-compose-splice=t_ocs \
3069 on-compose-splice-shell="read ver;printf \"t_ocs-shell\\n\
3070 ~t shell@exam.ple\\n~:set t_ocs_sh\\n\"" \
3071 on-compose-enter=t_oce on-compose-leave=t_ocl \
3072 on-compose-cleanup=t_occ
3074 ex0_test behave
:compose_hooks-3
3075 ${cat} .
/.tnotes
>> "${MBOX}"
3077 check behave
:compose_hooks-3
- "${MBOX}" '679526364 2431'
3079 # Reply, forward, resend, Resend
3082 printf 'set from=f1@z\nm t1@z\nb1\n!.\nset from=f2@z\nm t2@z\nb2\n!.\n' |
3083 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3084 -Smta=.
/.tsendmail.sh
3087 echo start: $? $! $^ERRNAME
3089 echo File: $? $! $^ERRNAME;echo;echo
3091 this is content of reply 1
3093 echo reply 1: $? $! $^ERRNAME;echo;echo
3095 this is content of Reply 1 2
3097 echo Reply 1 2: $? $! $^ERRNAME;echo;echo
3098 forward 1 fwdex@am.ple
3099 this is content of forward 1
3101 echo forward 1: $? $! $^ERRNAME;echo;echo
3102 resend 1 2 resendex@am.ple
3103 echo resend 1 2: $? $! $^ERRNAME;echo;echo
3104 Resend 1 2 Resendex@am.ple
3105 echo Resend 1 2: $? $! $^ERRNAME;echo;echo
3107 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3108 -Smta=.
/.tsendmail.sh \
3111 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3114 vput vexpr es substr "$1" 0 1
3119 define read_mline_res {
3120 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3121 echo mline_res:$len/$es/$^ERRNAME: $hl
3122 if [ $es -ne $^ERR-NONE ]
3123 xcall bail read_mline_res
3125 \xcall read_mline_res
3129 echo "~^header show $1"; read es;\
3130 call xerr $es "work_hl $1"; echo $1; call read_mline_res
3138 echo t_ocs version $ver
3139 echo "~^header list"; read hl; echo $hl;\
3140 echoerr the header list is $hl;\
3141 call xerr "$hl" "header list"
3142 eval vpospar set $hl
3145 echoerr IT IS WRONG IF YOU SEE THIS
3148 echo on-XY-enter, mailx-command<$mailx-command>
3149 set t_oce autobcc=oce@exam.ple
3150 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3151 echo mailx-subject<$mailx-subject>
3152 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3153 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3154 mailx-raw-bcc<$mailx-raw-bcc>
3155 echo mailx-orig-from<$mailx-orig-from> \
3156 mailx-orig-to<$mailx-orig-to> \
3157 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3160 echo on-XY-leave, mailx-command<$mailx-command>
3161 set t_ocl autocc=ocl@exam.ple
3162 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3163 echo mailx-subject<$mailx-subject>
3164 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3165 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3166 mailx-raw-bcc<$mailx-raw-bcc>
3167 echo mailx-orig-from<$mailx-orig-from> \
3168 mailx-orig-to<$mailx-orig-to> \
3169 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3172 echo on-XY-cleanup, mailx-command<$mailx-command>
3173 set t_occ autocc=occ@exam.ple
3174 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3175 echo mailx-subject<$mailx-subject>
3176 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3177 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3178 mailx-raw-bcc<$mailx-raw-bcc>
3179 echo mailx-orig-from<$mailx-orig-from> \
3180 mailx-orig-to<$mailx-orig-to> \
3181 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3183 wysh set on-compose-splice=t_ocs \
3184 on-compose-enter=t_oce on-compose-leave=t_ocl \
3185 on-compose-cleanup=t_occ \
3186 on-resend-enter=t_oce on-resend-cleanup=t_occ
3188 ex0_test behave
:compose_hooks-4
3189 ${cat} .
/.tnotes
>> "${MBOX}"
3191 check behave
:compose_hooks-4
- "${MBOX}" '2711778338 7516'
3196 t_behave_message_injections
() {
3198 TRAP_EXIT_ADDONS
="./.t*"
3200 ${cat} <<-_EOT > ./.tsendmail.sh
3202 (echo 'From Echinacea Tue Jun 20 15:54:02 2017' && ${cat} && echo
3205 chmod 0755 .
/.tsendmail.sh
3207 echo mysig
> .
/.tmysig
3209 echo some-body |
${MAILX} ${ARGS} -Smta=.
/.tsendmail.sh \
3210 -Smessage-inject-head=head-inject \
3211 -Smessage-inject-tail=tail-inject \
3212 -Ssignature=.
/.tmysig \
3213 ex@am.ple
> .
/.tall
2>&1
3214 check behave
:message_injections-1
0 "${MBOX}" '2434746382 134'
3215 check behave
:message_injections-2
- .tall
'4294967295 0' # empty file
3217 ${cat} <<-_EOT > ./.template
3221 Subject: This subject is
3223 Body, body, body me.
3225 < .
/.template
${MAILX} ${ARGS} -t -Smta=.
/.tsendmail.sh \
3226 -Smessage-inject-head=head-inject \
3227 -Smessage-inject-tail=tail-inject \
3228 -Ssignature=.
/.tmysig \
3230 check behave
:message_injections-3
0 "${MBOX}" '3114203412 198'
3231 check behave
:message_injections-4
- .tall
'4294967295 0' # empty file
3236 t_behave_mime_types_load_control
() {
3238 TRAP_EXIT_ADDONS
="./.t*"
3240 ${cat} <<-_EOT > ./.tmts1
3241 @ application/mathml+xml mathml
3243 ${cat} <<-_EOT > ./.tmts2
3244 @ x-conference/x-cooltalk ice
3246 @ application/aga-aga aga
3249 ${cat} <<-_EOT > ./.tmts1.mathml
3250 <head>nonsense ML</head>
3252 ${cat} <<-_EOT > ./.tmts2.ice
3255 printf 'of which the c\x01rack is coming soon' > .
/.tmtsx.doom
3256 printf 'of which the c\x01rack is coming soon' > .
/.tmtsx.aga
3270 ' "${MBOX}" "${MBOX}" |
3272 -Smimetypes-load-control=f
=.
/.tmts1
,f
=.
/.tmts2 \
3274 ex0_test behave
:mime_types_load_control
3276 ${cat} "${MBOX}" >> .
/.tout
3277 check behave
:mime_types_load_control-1
- .
/.tout
'529577037 2474'
3279 echo type |
${MAILX} ${ARGS} -R \
3280 -Smimetypes-load-control=f
=.
/.tmts1
,f
=.
/.tmts3 \
3281 -f "${MBOX}" >> .
/.tout
2>&1
3282 check behave
:mime_types_load_control-2
0 .
/.tout
'2025926659 3558'
3288 have_feat smime ||
{
3289 echo 'behave:s/mime: unsupported, skipped'
3294 TRAP_EXIT_ADDONS
="./.t.conf ./.tkey.pem ./.tcert.pem ./.tpair.pem"
3295 TRAP_EXIT_ADDONS
="${TRAP_EXIT_ADDONS} ./.VERIFY ./.DECRYPT ./.ENCRYPT"
3296 TRAP_EXIT_ADDONS
="${TRAP_EXIT_ADDONS} ./.tsendmail.sh"
3298 printf 'behave:s/mime: .. generating test key and certificate ..\n'
3299 ${cat} <<-_EOT > ./.t.conf
3302 default_keyfile = keyfile.pem
3303 distinguished_name = req_distinguished_name
3304 attributes = req_attributes
3308 [ req_distinguished_name ]
3315 emailAddress = test@localhost
3320 openssl req
-x509 -nodes -days 3650 -config .
/.t.conf \
3321 -newkey rsa
:1024 -keyout .
/.tkey.pem
-out .
/.tcert.pem
>/dev
/null
2>&1
3322 ${cat} .
/.tkey.pem .
/.tcert.pem
> .
/.tpair.pem
3325 printf 'behave:s/mime:sign/verify: '
3326 echo bla |
${MAILX} ${ARGS} \
3327 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3328 -Ssmime-sign -Sfrom=test@localhost \
3329 -s 'S/MIME test' .
/.VERIFY
3330 if [ $?
-eq 0 ]; then
3341 /^Content-Description: /{ skip = 2; print; next }
3342 /^$/{ if(skip) --skip }
3345 < .
/.VERIFY
> "${MBOX}"
3346 check behave
:s
/mime
:sign
/verify
:checksum
- "${MBOX}" '2900817158 648'
3348 printf 'behave:s/mime:sign/verify:verify '
3349 printf 'verify\nx\n' |
3351 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3352 -Ssmime-sign -Sfrom=test@localhost \
3354 -f .
/.VERIFY
>/dev
/null
2>&1
3355 if [ $?
-eq 0 ]; then
3364 printf 'behave:s/mime:sign/verify:disproof-1 '
3365 if openssl smime
-verify -CAfile .
/.tcert.pem \
3366 -in .
/.VERIFY
>/dev
/null
2>&1; then
3375 # (signing +) encryption / decryption
3376 ${cat} <<-_EOT > ./.tsendmail.sh
3378 (echo 'From Euphrasia Thu Apr 27 17:56:23 2017' && ${cat}) > ./.ENCRYPT
3380 chmod 0755 .
/.tsendmail.sh
3382 printf 'behave:s/mime:encrypt+sign: '
3385 -Ssmime-force-encryption \
3386 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3387 -Smta=.
/.tsendmail.sh \
3388 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3389 -Ssmime-sign -Sfrom=test@localhost \
3390 -s 'S/MIME test' recei@ver.com
3391 if [ $?
-eq 0 ]; then
3395 printf 'error: encrypt+sign failed\n'
3398 ${sed} -e '/^$/,$d' < .
/.ENCRYPT
> "${MBOX}"
3399 check behave
:s
/mime
:encrypt
+sign
:checksum
- "${MBOX}" '1937410597 327'
3401 printf 'behave:s/mime:decrypt+verify: '
3402 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
3404 -Ssmime-force-encryption \
3405 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3406 -Smta=.
/.tsendmail.sh \
3407 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3408 -Ssmime-sign -Sfrom=test@localhost \
3410 -f .
/.ENCRYPT
>/dev
/null
2>&1
3411 if [ $?
-eq 0 ]; then
3420 /^Content-Description: /{ skip = 2; print; next }
3421 /^$/{ if(skip) --skip }
3424 < .
/.DECRYPT
> "${MBOX}"
3425 check behave
:s
/mime
:decrypt
+verify
:checksum
- "${MBOX}" '1720739247 931'
3427 printf 'behave:s/mime:decrypt+verify:disproof-1: '
3428 if (openssl smime
-decrypt -inkey .
/.tkey.pem
-in .
/.ENCRYPT |
3429 openssl smime
-verify -CAfile .
/.tcert.pem
) >/dev
/null
2>&1; then
3436 printf "behave:s/mime:encrypt: "
3437 echo bla |
${MAILX} ${ARGS} \
3438 -Ssmime-force-encryption \
3439 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3440 -Smta=.
/.tsendmail.sh \
3441 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3442 -Sfrom=test@localhost \
3443 -s 'S/MIME test' recei@ver.com
3444 if [ $?
-eq 0 ]; then
3451 # Same as behave:s/mime:encrypt+sign:checksum above
3452 ${sed} -e '/^$/,$d' < .
/.ENCRYPT
> "${MBOX}"
3453 check behave
:s
/mime
:encrypt
:checksum
- "${MBOX}" '1937410597 327'
3456 printf 'decrypt ./.DECRYPT\nx\n' |
${MAILX} ${ARGS} \
3457 -Ssmime-force-encryption \
3458 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3459 -Smta=.
/.tsendmail.sh \
3460 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3461 -Sfrom=test@localhost \
3463 -f .
/.ENCRYPT
>/dev
/null
2>&1
3464 check behave
:s
/mime
:decrypt
0 "./.DECRYPT" '2624716890 422'
3466 printf 'behave:s/mime:decrypt:disproof-1: '
3467 if openssl smime
-decrypt -inkey .
/.tkey.pem \
3468 -in .
/.ENCRYPT
>/dev
/null
2>&1; then
3478 t_behave_maildir
() {
3480 TRAP_EXIT_ADDONS
="./.t*"
3484 while [ ${i} -lt 112 ]; do
3485 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
3486 "${MBOX}" "${i}" "${i}"
3489 ) |
${MAILX} ${ARGS}
3490 check behave
:maildir-1
0 "${MBOX}" '1140119864 13780'
3496 ' "${MBOX}" .tmdir1 .tmdir1 |
3497 ${MAILX} ${ARGS} -Snewfolders=maildir
> .tlst
3498 check behave
:maildir-2
0 .tlst
'1797938753 9103'
3501 copy * "maildir://%s"
3504 ' "${MBOX}" .tmdir2 .tmdir2 |
3505 ${MAILX} ${ARGS} > .tlst
3506 check behave
:maildir-3
0 .tlst
'1155631089 9113'
3508 printf 'File "maildir://%s"
3512 ' .tmdir2 .tmbox1 .tmbox1 |
3513 ${MAILX} ${ARGS} > .tlst
3514 check behave
:maildir-4
0 .tmbox1
'2646131190 13220'
3515 check behave
:maildir-5
- .tlst
'3701297796 9110'
3517 # only the odd (even)
3519 printf 'File "maildir://%s"
3522 while [ ${i} -lt 112 ]; do
3524 [ ${j} -eq 1 ] && printf '%s ' "${i}"
3531 ) |
${MAILX} ${ARGS} > .tlst
3532 check behave
:maildir-6
0 .tmbox2
'142890131 6610'
3533 check behave
:maildir-7
- .tlst
'960096773 4573'
3536 printf 'file "maildir://%s"
3539 while [ ${i} -lt 112 ]; do
3541 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
3549 ' .tmbox2 .tmbox2 .tmdir2
3550 ) | ${MAILX} ${ARGS} > .tlst
3551 check behave:maildir-8 0 .tmbox2 '3806905791 13100'
3552 ${sed} 2d < .tlst > .tlstx
3553 check behave:maildir-9 - .tlstx '4216815295 13645'
3559 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
3560 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
3561 # Note we unfortunately need to place some statements without proper
3562 # indentation because of continuation problems
3566 # MIME encoding (QP) stress message body
3568 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
3569 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
3570 "wasde willst
, gelle
, gelle
, gelle
, gelle
, gelle.
\r\n"\
3571 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
\r\n"\
3572 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1\r\n"\
3573 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12\r\n"\
3574 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123\r\n"\
3575 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234\r\n"\
3576 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345\r\n"\
3577 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456\r\n"\
3578 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234567\r\n"\
3579 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345678\r\n"\
3580 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456789\r\n"\
3581 "Unn ausserdem habe ich trailing SP
/HT
/SP
/HT whitespace
\r\n"\
3582 "Unn ausserdem habe ich trailing HT
/SP
/HT
/SP whitespace
\r\n"\
3583 "auf den zeilen vorher.
\r\n"\
3584 "From am Zeilenbeginn und From der Mitte gibt es auch.
\r\n"\
3586 "Die letzte Zeile war nur ein Punkt.
\r\n"\
3588 "Das waren deren zwei.
\r\n"\
3590 "Die letzte Zeile war ein Leerschritt.
\n"\
3591 "=VIER
= EQUAL SIGNS
=ON A LINE
=\r\n"\
3594 "Die letzte Zeile war nur ein Punkt
, mit Unix Zeilenende.
\n"\
3596 "Das waren deren zwei. ditto.
\n"\
3598 "Unn ausseerdem habe ich trailing SP
/HT
/SP
/HT whitespace
\n"\
3599 "Unn ausseerdem habe ich trailing HT
/SP
/HT
/SP whitespace
\n"\
3600 "auf den zeilen vorher.
\n"\
3602 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
\n"\
3603 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.1"\
3605 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3607 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3609 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3611 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3613 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3615 "QP am Zeilenende über soft-nl hinweg
\n"\
3616 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
3618 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
3620 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
3622 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
3624 "=VIER
= EQUAL SIGNS
=ON A LINE
=\n"\
3626 "Die letzte Zeile war ein Leerschritt.
\n"\
3630 # MIME encoding (QP) stress message subject
3631 SUB="Äbrä Kä?dä
=brö Fü?di
=bus? \
3632 adadaddsssssssddddddddddddddddddddd\
3633 ddddddddddddddddddddddddddddddddddd\
3634 ddddddddddddddddddddddddddddddddddd\
3635 dddddddddddddddddddd Hallelulja? Od\
3636 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
3637 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
3638 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
3639 fffffffffffffffffffffffffffffffffff\
3640 fffffffffffffffffffff ggggggggggggg\
3641 ggggggggggggggggggggggggggggggggggg\
3642 ggggggggggggggggggggggggggggggggggg\
3643 ggggggggggggggggggggggggggggggggggg\
3646 # Three tests for MIME encoding and (a bit) content classification.
3647 # At the same time testing -q FILE, < FILE and -t FILE
3650 < "${BODY}" ${MAILX} ${ARGS} ${ADDARG_UNI} \
3651 -a "${BODY}" -s "${SUB}" "${MBOX}"
3652 check content
:001 0 "${MBOX}" '1145066634 6654'
3655 < /dev
/null
${MAILX} ${ARGS} ${ADDARG_UNI} \
3656 -a "${BODY}" -s "${SUB}" -q "${BODY}" "${MBOX}"
3657 check content
:002 0 "${MBOX}" '1145066634 6654'
3660 ( echo "To: ${MBOX}" && echo "Subject: ${SUB}" && echo &&
3662 ) |
${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a "${BODY}" -t
3663 check content:003 0 "${MBOX}" '1145066634 6654'
3665 # Test for [260e19d] (Juergen Daubert)
3667 echo body | ${MAILX} ${ARGS} "${MBOX}"
3668 check content
:004 0 "${MBOX}" '2917662811 98'
3670 # Sending of multiple mails in a single invocation
3672 ( printf "m ${MBOX}\n~s subject1\nE-Mail Körper 1\n~.\n" &&
3673 printf "m ${MBOX}\n~s subject2\nEmail body 2\n~.\n" &&
3675 ) |
${MAILX} ${ARGS} ${ADDARG_UNI}
3676 check content
:005 0 "${MBOX}" '2098659767 358'
3680 # "Test for" [d6f316a] (Gavin Troy)
3682 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
3683 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="@* ${cat}" > "${BODY}"
3684 check content:006 0 "${MBOX}" '2099098650 122'
3685 check content:006-1 - "${BODY}" '794542938 174'
3687 # "Test
for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
3690 for(i = 0; i < 10000; ++i)
3692 #printf "\xF0\x90\x87\x90"
3693 }' | ${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
3694 check content
:007 0 "${MBOX}" '534262374 61816'
3696 ## Test some more corner cases for header bodies (as good as we can today) ##
3700 echo |
${MAILX} ${ARGS} ${ADDARG_UNI} \
3701 -s 'a̲b̲c̲d̲e̲f̲h̲i̲k̲l̲m̲n̲o̲r̲s̲t̲u̲v̲w̲x̲z̲a̲b̲c̲d̲e̲f̲h̲i̲k̲l̲m̲n̲o̲r̲s̲t̲u̲v̲w̲x̲z̲' \
3703 check content
:008 0 "${MBOX}" '3370931614 375'
3705 # Single word (overlong line split -- bad standard! Requires injection of
3706 # artificial data!! But can be prevented by using RFC 2047 encoding)
3708 i
=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
3709 echo |
${MAILX} ${ARGS} -s "${i}" "${MBOX}"
3710 check content:009 0 "${MBOX}" '489922370 1718'
3712 # Combination of encoded words, space and tabs of varying sort
3714 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
3715 -s "1Abrä Kaspas1
2Abra Katä b_kaspas2 \
3716 3Abrä Kaspas3
4Abrä Kaspas4
5Abrä Kaspas5 \
3717 6Abra Kaspas6
7Abrä Kaspas7
8Abra Kaspas8 \
3718 9Abra Kaspastäb4-3
10Abra Kaspas1 _
11Abra Katäb1 \
3719 12Abra Kadabrä
1 After Tab after Täb this is NUTS
" \
3721 check content:010 0 "${MBOX}" '1676887734 591'
3723 # Overlong multibyte sequence that must be forcefully split
3724 # todo This works even before v15.0, but only by accident
3726 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
3727 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
3728 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
3729 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄
" \
3731 check content:011 0 "${MBOX}" '3029301775 659'
3735 echo | ${MAILX} ${ARGS} \
3736 -s "1-1 B2 B3 B4 B5 B6 B\
3737 1-2 B2 B3 B4 B5 B6 B\
3738 1-3 B2 B3 B4 B5 B6 B\
3739 1-4 B2 B3 B4 B5 B6 B\
3740 1-5 B2 B3 B4 B5 B6 B\
3741 1-6 B2 B3 B4 B5 B6
" \
3743 check content:012 0 "${MBOX}" '4126167195 297'
3745 # Leading and trailing WS
3747 echo | ${MAILX} ${ARGS} \
3748 -s " 2-1 B2 B3 B4 B5 B6 B\
3749 1-2 B2 B3 B4 B5 B6 B\
3750 1-3 B2 B3 B4 B5 B6 B\
3751 1-4 B2 B3 B4 B5 B6
" \
3753 check content:013 0 "${MBOX}" '3600624479 236'
3755 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
3756 # have a (better) test framework materialize a quick shot
3758 TRAP_EXIT_ADDONS=./.ttt
3760 mkdir ./.ttt || exit 1
3764 : > 'diet\ is \curd.txt'
3765 : > 'diet "is
" curd.txt'
3767 : > höde__tröge__müde__dätte__hätte__vülle__gülle__äse__äße__säuerliche__kräuter__österliche__grüße__mäh.txt
3768 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
3769 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
3770 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
3772 echo bla | ${MAILX} ${ARGS} ${ADDARG_UNI} \
3773 -a ".
/.ttt
/ma
'ger.txt" -a "./.ttt/mä'ger.txt
" \
3774 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is
" curd.txt' \
3775 -a ./.ttt/höde-tröge.txt \
3776 -a ./.ttt/höde__tröge__müde__dätte__hätte__vülle__gülle__äse__äße__säuerliche__kräuter__österliche__grüße__mäh.txt \
3777 -a ./.ttt/höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
3778 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
3779 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
3781 check content:014-1 0 "${MBOX}" '684985954 3092'
3783 # `resend' test, reusing $MBOX
3785 printf "Resend
${BODY}\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
3786 check content:014-2 0 "${BODY}" '684985954 3092'
3789 printf "resend
${BODY}\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
3790 check content:014-3 0 "${BODY}" '3130352658 3148'
3796 # if have_feat devel; then
3797 # ARGS="${ARGS} -Smemdebug"
3804 if [ -z "${CHECK_ONLY}" ]; then
3810 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'