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

OSError: No such file or directory (Both Files in command exists) #101

Open
F9Alejandro opened this issue Sep 10, 2018 · 3 comments
Open
Labels

Comments

@F9Alejandro
Copy link

F9Alejandro commented Sep 10, 2018

FangMacBookPro:~ fang_shadow$ pius-keyring-mgr build -r test.gpg -b PGP_SIGN_PARTY.mbox/mbox
Found 1 keys in mbox: 1 fingerprints and 0 full keys
Traceback (most recent call last):
  File "/usr/local/bin/pius-keyring-mgr", line 638, in <module>
    main()
  File "/usr/local/bin/pius-keyring-mgr", line 630, in main
    kb.get_all_keys(keys)
  File "/usr/local/bin/pius-keyring-mgr", line 341, in get_all_keys
    if self.have_key(key['keyid']):
  File "/usr/local/bin/pius-keyring-mgr", line 295, in have_key
    stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Using Relative seems to be unable to find a certain file or another,

FangMacBookPro:~ fang_shadow$ pius-keyring-mgr build -r /users/fang_shadow/test.gpg -b /users/fang_shadow/PGP_SIGN_PARTY.mbox/mbox
Found 1 keys in mbox: 1 fingerprints and 0 full keys
Traceback (most recent call last):
  File "/usr/local/bin/pius-keyring-mgr", line 638, in <module>
    main()
  File "/usr/local/bin/pius-keyring-mgr", line 630, in main
    kb.get_all_keys(keys)
  File "/usr/local/bin/pius-keyring-mgr", line 341, in get_all_keys
    if self.have_key(key['keyid']):
  File "/usr/local/bin/pius-keyring-mgr", line 295, in have_key
    stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

same goes for when using absolute, is there something for python I am missing? some sort of compatibility?

@F9Alejandro
Copy link
Author

F9Alejandro commented Sep 10, 2018

Found the issue, it had to do with the default location of gpg (wish when pius setup.py is ran it gets the gpg location from PATH or can be read from a .pius-keyring-mgr config type config)

EDIT: Found a way to have the path for gpg and gpg2 to be found (gpg2 will be the first choice and gpg is second, and then /usr/bin/gpg if none are found), will work on getting a pull request in place that reflects the changes

EDIT 2: #103 Should fix this for others, it is in the 3_work for the future release.

@jaymzh
Copy link
Owner

jaymzh commented Sep 21, 2018

You can pass in -g to specify the path. I'm happy to have per-OS hard-coded lists, but given we're a security application dealing with private keys, we will not execute gpg out random PATHs.

@F9Alejandro
Copy link
Author

There is hard coded paths for linux and unix, a binary constant for /usr/bin, /usr/local/bin, /usr/sbin, /usr/local/sbin, /bin, and /sbin. which should cover both OSes and where they like to install to, meaning it is no longer a random path but will check in normal binary paths.

Normal which function can be used for windows, then just check the string returned to see if it contains "gpg4win..\gnupg\bin" in it, if it does then it is a valid install and should be used as this is what gpg4win uses in system path. (I uses gpg4win on my windows computer, and gpg toolset for macOS. I also have a little linux server box for testing purposes and doesn't have remote access unless given access via ssh v2)

@jaymzh jaymzh added the wishlist label Feb 9, 2019
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

2 participants