Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find krb5 path is failed #4

Closed
stanislavlevin opened this issue Nov 21, 2017 · 3 comments
Closed

Find krb5 path is failed #4

stanislavlevin opened this issue Nov 21, 2017 · 3 comments
Labels

Comments

@stanislavlevin
Copy link
Contributor

stanislavlevin commented Nov 21, 2017

Hello!

Search for a krb5 plugin's dir is failed due permissions denied (even the path is right).

ERROR: Failure: AttributeError ('NoneType' object has no attribute 'endswith')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/loader.py", line 420, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/usr/src/RPM/BUILD/python-module-gssapi-1.2.2/gssapi/tests/test_high_level.py", line 27, in <module>
    import k5test.unit as ktu 
  File "/usr/lib/python2.7/site-packages/k5test/__init__.py", line 1, in <module>
    from k5test.realm import K5Realm  # noqa 
  File "/usr/lib/python2.7/site-packages/k5test/realm.py", line 92, in <module>
    'kdb'),
  File "/usr/src/RPM/BUILD/python-module-gssapi-1.2.2/.tox/py27/lib/python2.7/posixpath.py", line 70, in join 
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

======================================================================
ERROR: Failure: ImportError (cannot import name _utils)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/loader.py", line 420, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/usr/src/RPM/BUILD/python-module-gssapi-1.2.2/gssapi/tests/test_raw.py", line 25, in <module>
    import k5test.unit as ktu 
  File "/usr/lib/python2.7/site-packages/k5test/__init__.py", line 1, in <module>
    from k5test.realm import K5Realm  # noqa 
  File "/usr/lib/python2.7/site-packages/k5test/realm.py", line 38, in <module>
    from k5test import _utils
ImportError: cannot import name _utils
[builder@localhost python-module-gssapi-1.2.2]$ find /usr/lib/ -type d -path "*/krb5/plugins";echo $?
/usr/lib/krb5/plugins
find: '/usr/lib/chkpwd': Permission denied
1

There is a small patch to fix it.
0001-Fix-search-of-krb5-plugin-directory.patch.txt

Thank you.

@frozencemetery
Copy link
Member

Hi, thanks for the issue and the patch!

In general there are more flags to find being passed than I would expect. Is there something I'm missing that would cause find %s/ -type d ! -executable -o -path "*/krb5/plugins" to not work?

@stanislavlevin
Copy link
Contributor Author

First, find should prune not executable and not readable paths. As you suggest:

find /usr/lib/ -type d ! -executable -o -path "*/krb5/plugins";echo $?
/usr/lib/screen
find: ‘/usr/lib/screen’: Отказано в доступе
/usr/lib/chkpwd
find: ‘/usr/lib/chkpwd’: Отказано в доступе
/usr/lib/utempter
find: ‘/usr/lib/utempter’: Отказано в доступе
/usr/lib/consolehelper/priv
find: ‘/usr/lib/consolehelper/priv’: Отказано в доступе
/usr/lib/alterator/hooks
find: ‘/usr/lib/alterator/hooks’: Отказано в доступе
/usr/lib/krb5/plugins
find: ‘/usr/lib/openssh’: Отказано в доступе
1

Excuse me for Russian(it means permission denied).
Please look at the below command:

find /usr/lib/ -type d \( ! -executable -o ! -readable \) -prune -o -type d -path "*/krb5/plugins" -print; echo $?
/usr/lib/krb5/plugins
0

Thank you.

@DirectXMan12
Copy link
Member

that makes sense, LGTM 👍 Thanks! I'll merge it.

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

No branches or pull requests

3 participants