Following causes same/similar error as #277 and #320
Reproduction steps:
$ git config --global init.templatedir "/tmp/non-existing" # force git clone error
$ 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 62, in ensureGitRepoInitialized
self.gitRepository.run(["init"])
File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/gitRepository.py", line 70, in run
raise GitException(stderr)
subuserlib.classes.gitRepository.GitException: warning: templates not found /tmp/non-existing
# if we runt it again then we get this (because of half-inited repo):
$ 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/registry.py", line 53, in repositories
self.__repositories = repositories.Repositories(self.user)
File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/repositories.py", line 28, in __init__
self.reloadRepositoryLists()
File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/repositories.py", line 50, in reloadRepositoryLists
repositoryStates = self._loadRepositoryStates()
File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/repositories.py", line 91, in _loadRepositoryStates
if "repository-states.json" in gitFileStructure.lsFiles("./"):
File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/fileStructure.py", line 41, in lsFiles
return self._lsFiles(subfolder)
File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/gitRepository.py", line 213, in _lsFiles
return self.ls(subfolder,"blob")
File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/fileStructure.py", line 29, in ls
return self._ls(subfolder,objectType=objectType)
File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/gitRepository.py", line 193, in _ls
items = self.lsTree()
File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/gitRepository.py", line 169, in lsTree
(returncode,output) = self.gitRepository.runCollectOutput(["ls-tree"]+args)
File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/gitRepository.py", line 91, in runCollectOutput
raise GitException(stderr)
subuserlib.classes.gitRepository.GitException: fatal: Not a valid object name master
# event when we fix original issue:
$ git config --global --unset init.templatedir
# we still get "Not a valid object name master" error:
$ subuser list available
Traceback (most recent call last):
[...]
File "/usr/local/lib/python3.5/dist-packages/subuserlib/classes/gitRepository.py", line 91, in runCollectOutput
raise GitException(stderr)
subuserlib.classes.gitRepository.GitException: fatal: Not a valid object name master
# only after manual removal of broken repo:
$ rm -rf ~/.subuser
# we finally succeed:
$ subuser list available
Initial commit.
Cloning repository default from https://github.com/subuser-security/subuser-default-repository.git
Cloning into '/home/mawj/.subuser/repositories/default'...
remote: Counting objects: 2673, done.
remote: Total 2673 (delta 0), reused 0 (delta 0), pack-reused 2673
Receiving objects: 100% (2673/2673), 335.32 KiB | 324.00 KiB/s, done.
Resolving deltas: 100% (1536/1536), done.
arduino@default
[...]
xtightvncviewer-base@default
So the workaround is to manually delete broken repository (rm -rf ~/.subuser), but this is very non-obvious at the beginning.
Instead of keeping error-prone, half-initialized repository, I suggest fixing it by removing the repo unless succeeded to fully initialize it.
Following causes same/similar error as #277 and #320
Reproduction steps:
So the workaround is to manually delete broken repository (
rm -rf ~/.subuser
), but this is very non-obvious at the beginning. Instead of keeping error-prone, half-initialized repository, I suggest fixing it by removing the repo unless succeeded to fully initialize it.Extra info: