X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2Ftest-lib.sh;h=862c6bc97a4d98cb86e69f863044c8ae803225d1;hb=8376e814412f8165b781aa21dac654c2fc948306;hp=3f8d58277dc1b5b550da51826d4cf2365276cf27;hpb=828a004921ab0736634203cd07cc41393da00047;p=notmuch diff --git a/test/test-lib.sh b/test/test-lib.sh index 3f8d5827..862c6bc9 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -136,6 +136,8 @@ add_gnupg_home () add_gpgsm_home () { + test_require_external_prereq openssl + local fpr [ -e "$GNUPGHOME/gpgsm.conf" ] && return _gnupg_exit () { gpgconf --kill all 2>/dev/null || true; } @@ -700,12 +702,20 @@ notmuch_built_with_sanitize () sed 's/^built_with[.]\(.*\)=.*$/built_with.\1=something/' } -notmuch_passwd_sanitize () +notmuch_passwd_sanitize() { - local user=$(id -un) - local fqdn=$(hostname -f) - local full_name=$(getent passwd $user | cut -d: -f 5 | cut -d, -f1) - sed -e "s/$user/USERNAME/" -e "s/$fqdn/FQDN/" -e "s/$full_name/USER_FULL_NAME/" + ${NOTMUCH_PYTHON} -c' +import os, sys, pwd, socket + +pw = pwd.getpwuid(os.getuid()) +user = pw.pw_name +name = pw.pw_gecos.partition(",")[0] +fqdn = socket.getfqdn() + +for l in sys.stdin: + l = l.replace(user, "USERNAME").replace(fqdn, "FQDN").replace(".(none)","").replace(name, "USER_FULL_NAME") + sys.stdout.write(l) +' } notmuch_config_sanitize ()