Author vaclavbartos
Recipients vaclavbartos
Date 2019-10-03.11:38:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When `syslog.openlog()` is called without parameters (or `syslog.syslog()` is called directly), the `ident` parameter should be set to "sys.argv[0] with leading path components stripped" (citation from docs).

I suppose this means that when sys.argv[0] is "/some/path/to/script", the ident should be set to "script" (this is the behavior in Python 2.7)

However, in Python 3.x, it gets set to "/script", i.e. the last slash is included in the string. I suppose this is not intended, it is just a "one-off" error in parsing the string.

The fix is trivial, see the linked GitHub PR.

To reproduce the bug:

$ python3
>>> import sys
>>> import syslog
>>> sys.argv[0] = "/some/path/to/script"
>>> syslog.syslog("TEST MESSAGE")
$ tail -n 1 /var/log/messages
Oct  3 11:11:46 localhost /script: TEST MESSAGE
Date User Action Args
2019-10-03 11:38:59vaclavbartossetrecipients: + vaclavbartos
2019-10-03 11:38:58vaclavbartossetmessageid: <>
2019-10-03 11:38:58vaclavbartoslinkissue38361 messages
2019-10-03 11:38:58vaclavbartoscreate