[New-bugs-announce] [issue17913] stat.filemode returns "-" for sockets and unknown types

Christian Heimes report at bugs.python.org
Mon May 6 11:11:20 CEST 2013


New submission from Christian Heimes:

The function stat.filemode() has a fallback to "-" for file type when it is unable to properly detect the type of a file. This gives wrong results for any file type that is not in the lookup table.

For example it doesn't check for S_ISSOCK:

>>> s = os.stat("/var/run/sdp") t
>>> stat.filemode(s.st_mode)
'-rw-rw-rw-'
$ ls -la /var/run/sdp
srw-rw-rw- 1 root root 0 Mai  2 16:08 /var/run/sdp

Also see #11016 for more file types.

I'm going to work on the matter soonish.

----------
messages: 188496
nosy: christian.heimes
priority: normal
severity: normal
stage: needs patch
status: open
title: stat.filemode returns "-" for sockets and unknown types
type: behavior
versions: Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17913>
_______________________________________


More information about the New-bugs-announce mailing list