Debian Codegraph @

debian/tests/check-listings-protection

raw symbols SCIP
1 #! /bin/sh
2
3 set -e
4
5 dir=$(pwd)/debian/tests
6 . $dir/textutils.sh
7
8 frame "Here we are testing the patch" \
9 "features/protect-list.patch"
10
11 echo "================= adding user 'dummy' ====================="
12 getent passwd dummy || adduser --disabled-password --gecos "" dummy
13
14 echo "=== Inject an obfuscated line into dummy's crontab ========"
15 printf "* * * * * >/tmp/x;\rno crontab for dummy\b\bbo\n" | crontab -u dummy -
16
17 echo "========== testing the crontab of user 'dummy' ============="
18 result="$(crontab -u dummy -l)"
19 echo "======== here is a hexa dump of \$(crontab -u dummy -l) ===="
20 echo "$result" | hd
21 test "$result" = "* * * * * >/tmp/x;\\rno crontab for dummy\\b\\bbo"
22
23 frame "Good! characters \\r and \\b were protected"
24 echo
25 frame "test whether crontab -l can be colorized thanks to the" \
26 "patch features/Coloring_the_ouput_of_crontab_l.patch"
27 (unbuffer crontab -u dummy -l | grep "[\033]") || (echo "no character \\033 when unbuffering 'crontab -l'"; false)
28 echo "====== crontab -l is able to colorize its output ==========="