subuser-security / subuser

Run programs on linux with selectively restricted permissions.
http://subuser.org
GNU Lesser General Public License v3.0
890 stars 65 forks source link

Exception when git binary not present #336

Open DEVoytas opened 6 years ago

DEVoytas commented 6 years ago

Reproduction steps:

$ rm -rf ~/.subuser # or `mv` if there's something you need to keep
$ sudo mv /usr/bin/git /usr/bin/git_orig
$ subuser list available                                                                                                                                                                                           
Traceback (most recent call last):
  File "/usr/local/bin/subuser", line 52, in <module>
    command(sys.argv[2:])
  File "/usr/local/lib/python3.5/dist-packages/subuserlib/builtInCommands/list.py", line 64, in runCommand
    reposToList = user.registry.repositories.keys()
  File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/user.py", line 70, in registry
    self.__registry.ensureGitRepoInitialized()
  File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/registry.py", line 60, in ensureGitRepoInitialized
    self.gitRepository.assertGitSetup()
  File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/gitRepository.py", line 46, in assertGitSetup
    if getConfig("user.name") is None or getConfig("user.email") is None:
  File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/gitRepository.py", line 41, in getConfig
    (returncode,stdout,stderr) = self.user.endUser.callCollectOutput(gitExecutable + ["config","--get",key])
  File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/endUser.py", line 133, in callCollectOutput
    process = subprocess.Popen(args,stdout=subprocess.PIPE,stderr=subprocess.PIPE,cwd=cwd)
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1474, in _execute_child
    executable = os.fsencode(executable)
  File "/usr/lib/python3.5/os.py", line 862, in fsencode
    raise TypeError("expect bytes or str, not %s" % type(filename).__name__)
TypeError: expect bytes or str, not NoneType

Extra info:

$ python3 --version
Python 3.5.2
$ subuser version
Subuser version: 0.6.2