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 <rep...@bugs.python.org>
<http://bugs.python.org/issue17913>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to