classification
Title: Syslogs /usr/sbin/foo as /foo instead of as foo
Type: behavior Stage: needs patch
Components: Extension Modules Versions: Python 3.8, Python 3.6, Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: canvon, jafo
Priority: normal Keywords:

Created on 2016-08-27 09:48 by canvon, last changed 2021-02-22 18:55 by deragon.

Files
File name Uploaded Description Edit
test-syslog.py canvon, 2016-08-27 09:48 Test script to produce a broken syslog entry.
Messages (1)
msg273770 - (view) Author: Fabian Pietsch (canvon) Date: 2016-08-27 09:48
When calling syslog.syslog() without calling syslog.openlog() before, openlog() gets called with no arguments. Documentation says: "The optional ident keyword argument is a string which is prepended to every message, and defaults to sys.argv[0] with leading
path components stripped." -- "35.13. syslog — Unix syslog library routines"

It leaves the final slash in, though. This produces syslog output for /usr/sbin/foo with identifier "/foo" instead of "foo". When reading syslog unprepared, one can easily think that to be a bug in the specific python script at hand (which it's not), or a chroot to be involved (which it's not, usually). So I consider this a bug.

On freenode/#python I was referred to https://github.com/python/cpython/blob/master/Modules/syslogmodule.c#L98 for the code that does this.

This issue is forwarded from a minor bug report reported by me at Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=835577

A test script is attached, which, when called with absolute path, produces this in syslog:

  Aug 27 08:53:27 blackbox /test-syslog.py: Test from python!

The slash is misleading/wrong.
History
Date User Action Args
2021-02-22 18:55:17deragonsetversions: + Python 3.8
2016-08-27 15:06:06SilentGhostsetnosy: + jafo
stage: needs patch

components: + Extension Modules
versions: + Python 3.5, Python 3.6
2016-08-27 09:48:31canvoncreate