Address 'TEMP cannot use a string pattern on a bytes-like object' and make logging use syslog#9
Address 'TEMP cannot use a string pattern on a bytes-like object' and make logging use syslog#9pckizer wants to merge 2 commits intosdgathman:masterfrom
Conversation
…or conditional, and make logging use syslog not print
|
Hmm. The logging should use the log method, which should be the only place you would add a syslog option. Stderr works well with systemd. I'll have to see what happens if you do syslog twice - may get two timestamps. It needs a test case to reproduce the problem before the fix can be committed. Was the problem appearing with SES? |
|
Your example does not fail: Are you using sendmail? Or another MTA? |
|
I was using the smapc test utility client from the Gnu smap package (ftp://download.gnu.org.ua/pub/release/smap/smap-1.1.tar.gz), but I was indeed getting a similar failure from sendmail (8.16.1). I'm curious why yours does not show a similar failure. I was using a fresh git clone from this repo with Python 3.7.9 (on FreeBSD 12.1) with a simple 'python3 ./pysrs.py test-pysrs.cfg' using a test-pysrs.cfg containing: [srs] Let me know if you want me to repeat with a sharable secret, though that shouldn't matter for exercising the code paths that led to me seeing the "TEMP cannot use a string pattern on a bytes-like object". |
Before this patch, reverse_srs would work but I would consistently get an error when calling make_srs:
% ./smapc unix:///tmp/pysrs make_srs 'infooo<@example.org.>'
TEMP cannot use a string pattern on a bytes-like object
% ./smapc unix:///tmp/pysrs reverse_srs 'SRS0=J6Lly=CZ=example.org=infooo<@example.com.>'
OK infooo<@example.org.>
After the patch both directions seem to work just fine:
% ./smapc unix:///tmp/pysrs make_srs 'infooo<@example.org.>'
OK SRS0=J6Lly=CZ=example.org=infooo<@example.com.>
% ./smapc unix:///tmp/pysrs reverse_srs 'SRS0=J6Lly=CZ=example.org=infooo<@example.com.>'
OK infooo<@example.org.>
To help debugging I also made the logging go to syslog rather than STDOUT.