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

trailing slash on clone #296

Closed joshuacox closed 8 years ago

joshuacox commented 8 years ago

Here's what happened, notice the trailing slash after .git:

subuser list available
Cloning repository default from https://github.com/subuser-security/subuser-default-repository.git/
Cloning into '/home/thoth/.subuser/repositories/default'...
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Clone failed.

So I manually did it:

➜  /tmp git clone https://github.com/subuser-security/subuser-default-repository.git 
Cloning into 'subuser-default-repository'...
remote: Counting objects: 2637, done.
remote: Total 2637 (delta 0), reused 0 (delta 0), pack-reused 2637
Receiving objects: 100% (2637/2637), 330.62 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1528/1528), done.    
➜  /tmp mv subuser-default-repository /home/thoth/.subuser/repositories/default
➜  mkarduino git:(stretch-gui) subuser list available
Traceback (most recent call last):
  File "/usr/bin/subuser", line 28, in <module>
    command(sys.argv[2:])
  File "/usr/lib/python3.5/site-packages/subuserlib/builtInCommands/list.py", line 56, in runCommand
    reposToList = user.getRegistry().getRepositories().keys()
  File "/usr/lib/python3.5/site-packages/subuserlib/classes/registry.py", line 52, in getRepositories
    self.__repositories = repositories.Repositories(self.getUser())
  File "/usr/lib/python3.5/site-packages/subuserlib/classes/repositories.py", line 28, in __init__
    self.reloadRepositoryLists()
  File "/usr/lib/python3.5/site-packages/subuserlib/classes/repositories.py", line 76, in reloadRepositoryLists
    self.systemRepositories = loadRepositoryDict(subuserlib.loadMultiFallbackJsonConfigFile.getConfig(self.systemRepositoryListPaths))
  File "/usr/lib/python3.5/site-packages/subuserlib/classes/repositories.py", line 74, in loadRepositoryDict
    repositories[repoName] = Repository(self.getUser(),name=repoName,gitOriginURI=gitOriginURI,gitCommitHash=gitCommitHash,temporary=temporary,sourceDir=sourceDir)
  File "/usr/lib/python3.5/site-packages/subuserlib/classes/repository.py", line 37, in __init__
    self.loadImageSources()
  File "/usr/lib/python3.5/site-packages/subuserlib/classes/repository.py", line 222, in loadImageSources
    imageNames = self.getFileStructure().lsFolders(self.getRelativeImageSourcesDir())
  File "/usr/lib/python3.5/site-packages/subuserlib/classes/gitRepository.py", line 234, in lsFolders
    return self.ls(subfolder,extraArgs=["-d"])
  File "/usr/lib/python3.5/site-packages/subuserlib/classes/gitRepository.py", line 204, in ls
    items = self.lsTree(subfolder,extraArgs)
  File "/usr/lib/python3.5/site-packages/subuserlib/classes/gitRepository.py", line 181, in lsTree
    (returncode,output) = self.getRepository().runCollectOutput(["ls-tree"]+args)
  File "/usr/lib/python3.5/site-packages/subuserlib/classes/gitRepository.py", line 89, in runCollectOutput
    raise GitException(stderr)
subuserlib.classes.gitRepository.GitException: fatal: Not a valid object name master

it was missing master, so I checked it out:

➜  default git:(latest) git branch -a
* latest
  remotes/origin/HEAD -> origin/latest
  remotes/origin/latest
  remotes/origin/master
➜  default git:(latest) git checkout master
Branch master set up to track remote branch master from origin.
Switched to a new branch 'master'

now subuser list available works as intended, I'm on archlinux here:

$ uname -a              
Linux stealth 4.7.2-1-ARCH #1 SMP PREEMPT Sat Aug 20 23:02:56 CEST 2016 x86_64 GNU/Linux
$ python2 -V
Python 2.7.12
timthelion commented 8 years ago

Hm, I'm not sure what happened here. Whether something in github/git changed, or I just don't know. I'm 90% sure multiple people have successfully used the default repository... However, it does look like the correct URL is without the trailing slash. Hopefully it is fixed now: https://github.com/subuser-security/subuser/commit/4294d48106c0d6325988a2c53c8066326afc3646

Thanks for the bug report.