Skip to content
This repository has been archived by the owner on Oct 5, 2019. It is now read-only.

Logging issues #123

Closed
secretsquirrel opened this issue Dec 19, 2015 · 3 comments
Closed

Logging issues #123

secretsquirrel opened this issue Dec 19, 2015 · 3 comments
Labels

Comments

@secretsquirrel
Copy link
Contributor

On master I get a ton of logging errors. These errors keep important data from making into the .json output. Imagine this, but hundreds of times.

[ERROR]   <type 'exceptions.IOError'> [('./osxcollector.py', 1009, '_log_file_info_for_directory', 'file_info = _get_file_info(file_path, True)'), ('./osxcollector.py', 312, '_get_file_info', 'where_from = _get_where_froms(file_path)'), ('./osxcollector.py', 243, '_get_where_froms', 'return _get_extended_attr(file_path, ATTR_KMD_ITEM_WHERE_FROMS)'), ('./osxcollector.py', 262, '_get_extended_attr', 'xattr_val = getxattr(file_path, attr)'), ('/usr/local/lib/python2.7/site-packages/xattr/__init__.py', 178, 'getxattr', 'return xattr(f).get(attr, options=symlink and XATTR_NOFOLLOW or 0)'), ('/usr/local/lib/python2.7/site-packages/xattr/__init__.py', 68, 'get', 'return self._call(_getxattr, _fgetxattr, name, 0, 0, options | self.options)'), ('/usr/local/lib/python2.7/site-packages/xattr/__init__.py', 59, '_call', 'return name_func(self.value, *args)'), ('/usr/local/lib/python2.7/site-packages/xattr/lib.py', 642, '_getxattr', 'raise error(path)'), ('/usr/local/lib/python2.7/site-packages/xattr/lib.py', 628, 'error', 'raise IOError(errno, strerror, path)')] - {'osxcollector_incident_id': 'osxcollect-2015_12_19-15_57_57', 'osxcollector_username': 'yourmom', 'osxcollector_section': 'mail'}`

Repro:

sudo ./osxcollector.py
@jjsendor jjsendor added the bug label Dec 21, 2015
@jjsendor
Copy link
Contributor

It seems that the issue is caused by xattr.getxattr throwing IOError instead of KeyError when the attribute is not found.
I will add a second except section to the try/except block in order to ignore IOError.

@jjsendor
Copy link
Contributor

Closed in #124.

@secretsquirrel
Copy link
Contributor Author

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants