Kallithea issues archive

Issue #365: Cannot create git repository by cloning from GitHub

Reported by: vyom
State: resolved
Created on: 2020-03-11 01:24
Updated on: 2020-03-13 01:24

Description

Wanted to create a repository of upstreak Flask Project and an error occured. It seems to be front-end error, the repository URL is correct.

Attachments

Comments

Comment by Thomas De Schampheleire, on 2020-03-11 08:26

Thanks for reporting. I also detected this problem recently and it was fixed on the default branch with 37ec17c1344c .

Comment by vyom, on 2020-03-11 14:14

I used the latest code it still has the same error. In Logs the error is:

2020-03-11 22:10:47.115 WARNI [kallithea.model.validators] validation of clone URL 'https://github.com/pallets/flask.git' failed: URI https://github.com/pallets/flask.git URLError: <urlopen error [https://:*****@github.com/pallets/flask.git] org_exc: <urlopen error unknown url type: b'https>>

Comment by vyom, on 2020-03-11 14:19

Still it's not resolved.

Comment by Mads Kiilerich, on 2020-03-11 16:57

Right. That was another problem with similar symptom.

Can you confirm it works with

--- kallithea/lib/vcs/backends/git/repository.py
+++ kallithea/lib/vcs/backends/git/repository.py
@@ -190,7 +190,7 @@ class GitRepository(BaseRepository):

         req = urllib.request.Request(
             "%s?%s" % (
-                test_uri,
+                safe_str(test_uri),
                 urllib.parse.urlencode({"service": 'git-upload-pack'})
             ))

Comment by vyom, on 2020-03-12 01:48

After applying this change get following error:

Traceback (most recent call last):
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/tg/appwrappers/session.py", line 71, in __call__
    response = self.next_handler(controller, environ, context)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/tg/appwrappers/i18n.py", line 71, in __call__
    return self.next_handler(controller, environ, context)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/tg/wsgiapp.py", line 243, in _dispatch
    return controller(environ, context)
  File "/home/kallithea/projects/hg/kallithea/kallithea/lib/base.py", line 536, in __call__
    return super(BaseController, self).__call__(environ, context)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/tg/controllers/dispatcher.py", line 118, in __call__
    response = self._perform_call(context)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/tg/controllers/dispatcher.py", line 107, in _perform_call
    r = self._call(action, params, remainder=remainder, context=context)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/tg/controllers/decoratedcontroller.py", line 129, in _call
    output = controller_caller(context_config, bound_controller_callable, remainder, params)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/tg/controllers/decoration.py", line 21, in _decorated_controller_caller
    return application_controller_caller(tg_config, controller, remainder, params)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/tg/configurator/components/dispatch.py", line 114, in _call_controller
    return controller(*remainder, **params)
  File "<decorator-gen-40>", line 2, in index

  File "/home/kallithea/projects/hg/kallithea/kallithea/lib/auth.py", line 637, in __wrapper
    return func(*fargs, **fkwargs)
  File "<decorator-gen-39>", line 2, in index

  File "/home/kallithea/projects/hg/kallithea/kallithea/lib/auth.py", line 680, in __wrapper
    return func(*fargs, **fkwargs)
  File "/home/kallithea/projects/hg/kallithea/kallithea/controllers/summary.py", line 153, in index
    return render('summary/summary.html')
  File "/home/kallithea/projects/hg/kallithea/kallithea/lib/base.py", line 63, in render
    return render_template({'url': url}, 'mako', template_path)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/tg/render.py", line 208, in render
    kwargs['result'] = render_function(template_name, tg_vars, **kwargs)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/tg/renderers/mako.py", line 134, in __call__
    cache_type=cache_type, cache_expire=cache_expire)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/tg/render.py", line 274, in cached_template
    return render_func()
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/tg/renderers/mako.py", line 131, in render_template
    return Markup(template.render_unicode(**template_vars))
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/mako/template.py", line 482, in render_unicode
    self, self.callable_, args, data, as_unicode=True
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/mako/runtime.py", line 883, in _render
    **_kwargs_for_callable(callable_, data)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "_base_root_html", line 211, in render_body

  File "_base_base_html", line 42, in render_body

  File "summary_summary_html", line 322, in render_main

  File "_changelog_changelog_table_html", line 44, in render_changelog

  File "/home/kallithea/projects/hg/kallithea/kallithea/lib/vcs/utils/lazy.py", line 41, in __get__
    value = self._func(obj)
  File "/home/kallithea/projects/hg/kallithea/kallithea/lib/vcs/backends/git/changeset.py", line 176, in parents
    for parent_id in self._commit.parents]
  File "/home/kallithea/projects/hg/kallithea/kallithea/lib/vcs/backends/git/changeset.py", line 176, in <listcomp>
    for parent_id in self._commit.parents]
  File "/home/kallithea/projects/hg/kallithea/kallithea/lib/vcs/backends/git/repository.py", line 479, in get_changeset
    return GitChangeset(repository=self, revision=self._get_revision(revision))
  File "/home/kallithea/projects/hg/kallithea/kallithea/lib/vcs/backends/git/changeset.py", line 27, in __init__
    commit = self.repository._repo[ascii_bytes(revision)]
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/dulwich/repo.py", line 677, in __getitem__
    return self.object_store[name]
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/dulwich/object_store.py", line 122, in __getitem__
    type_num, uncomp = self.get_raw(sha)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/dulwich/object_store.py", line 477, in get_raw
    return pack.get_raw(sha)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/dulwich/pack.py", line 2036, in get_raw
    obj_type, obj = self.data.get_object_at(offset)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/dulwich/pack.py", line 1298, in get_object_at
    unpacked, _ = unpack_object(self._file.read)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/dulwich/pack.py", line 776, in unpack_object
    include_comp=include_comp)
  File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/dulwich/pack.py", line 241, in read_zlib_chunks
    decomp = decomp_obj.decompress(add)
zlib.error: Error -3 while decompressing data: incorrect header check

Comment by Mads Kiilerich, on 2020-03-12 15:58

That looks like something else: A network problem or the remote server closing the connection prematurely. Can you reproduce it?

Comment by Thomas De Schampheleire, on 2020-03-12 21:06

I confirm the problem reported in comment 365.html#comment-56489547 and the ‘safe_str’ fix proposed by @Mads Kiilerich . After that change I can clone the flask repo fine.

Comment by vyom, on 2020-03-13 01:24

Ok with other repository it did not give me this error. So I will mark as resolved with the patch by @Thomas De Schampheleire

Comment by vyom, on 2020-03-13 01:24

Based on the change in line it worked.