TypeError: unsupported format string passed to NoneType.__format__ / statx
https://github.com/att/docker-forensics/blob/d50c444d59855e46ec5778942d0cad00cf722c75/mac-robber.py#L131
Traceback:
(... more data ...)
0|/etc/ld.so.conf|786616|-rw-rw-r--|0|0|34|1734440793.017330|1608116695.000000|1697471167.713379|1697471167.713379
0|/etc/rsyslog.conf|786654|-rw-rw-r--|0|0|1382|1734436377.488000|1640302499.000000|1697471167.721380|1697471167.721380
0|/etc/inputrc|786609|-rw-rw-r--|0|0|1748|1734679563.963715|1641486414.000000|1697471167.709378|1697471167.709378
0|/etc/magic.mime|786629|-rw-rw-r--|0|0|111|1697522640.364750|1648141629.000000|1697471167.713379|1697471167.713379
0|/etc/ethertypes|786596|-rw-rw-r--|0|0|1816|1577407331.000000|1577407331.000000|1697471167.705378|1697471167.705378
Traceback (most recent call last):
File "/root/docker/mac-robber/orig/mac-robber.py", line 221, in <module>
outstr = process_item(dirpath, filename)
File "/root/docker/mac-robber/orig/mac-robber.py", line 131, in process_item
btime = "{:17.6f}".format(statx.statx(fname).btime)
TypeError: unsupported format string passed to NoneType.__format__
I installed library: https://pypi.org/project/pystatx/ (Version: 0.1)
and there is following error in this underlying library:
Problem seems to be related with links:
But stat is working on this link:
I'm writing here as there is only single version of this library, which may be no longer maintained.
My dirty solution:
I also linked this issue on library repo: https://github.com/ckarageorgkaneen/pystatx/issues/5
For the moment, I've incorporated your workaround. Thanx for bringing this to my attention.
Looking at the the source None is the default for btime when the field is not present in the return value picked up by python. I gather this means the under lying call to statx doesn't include it in the return. errno is not being check by pystax so the call could be erroring out. By default pystatx tells statx to resolve symlinks. Which means its trying to stat what the symlink points to. I created fork with proper error handling https://github.com/reporter123/pystatx it also requires python 3.6+ as it uses an f string instead of calling format.