Skip to content

Assertion fails when fetching over SSH if remote box has /etc/issue #94

Closed
@terminalmage

Description

@terminalmage
Contributor

https://github.com/gitpython-developers/GitPython/blob/0.3/git/remote.py#L539

This assertion is failing when I try to run a fetch over SSH on a box that has an /etc/issue, due to the length of the output from the git fetch not being the expected number of lines.

Activity

medwards

medwards commented on Feb 20, 2013

@medwards

Experiencing the same problem against GitHub. How were you able to determine that /etc/issue was the problem? Or is it just in your environment where thats the source?

terminalmage

terminalmage commented on Feb 20, 2013

@terminalmage
ContributorAuthor

I caught the exception and saw the /etc/issue in one side of the assertion. Renaming /etc/issue to /etc/issue.bak got rid of the assertion error.

medwards

medwards commented on Feb 21, 2013

@medwards

Did the AssertionError look anything like this? Or is this unique to my situation?

AssertionError: len(["abe56b70d2f7ae55b9abf95e3f5b4f328c89ea25\t\tbranch 'master' of https://github.com/delivero/lint_eastwood\n", "48c0c782ed7fc6be4155d6d431c3a336ce2c124e\tnot-for-merge\tbranch 'angelo' of https://github.com/delivero/lint_eastwood\n", "c6fb02593973cddcf9a6bd9c1ff8fe55fb4628fc\tnot-for-merge\tbranch 'codazzo_flake' of https://github.com/delivero/lint_eastwood\n", "64d5bfd3fcfe01cd7899f5633f18f1760bdb200e\tnot-for-merge\tbranch 'dhbe-550-jshint' of https://github.com/delivero/lint_eastwood\n", "427b6cf88d2b947e836a0e38a03dff319b87b053\tnot-for-merge\tbranch 'singleton_fails' of https://github.com/delivero/lint_eastwood\n", "4a1136c32877fefca911d186a4a3ab0c27113dfc\tnot-for-merge\tbranch 'vasc' of https://github.com/delivero/lint_eastwood\n"]) !=
len(['POST git-upload-pack (548 bytes)', '   d4328b7..abe56b7  master     -> origin/master', ' = [up to date]      angelo     -> origin/angelo', ' = [up to date]      codazzo_flake -> origin/codazzo_flake', ' = [up to date]      dhbe-550-jshint -> origin/dhbe-550-jshint', ' = [up to date]      singleton_fails -> origin/singleton_fails', ' = [up to date]      vasc       -> origin/vasc'])
medwards

medwards commented on Feb 21, 2013

@medwards

Ah my pulls are being happening over HTTPS, I'll look into opening a new issue if they're not related.

terminalmage

terminalmage commented on Feb 21, 2013

@terminalmage
ContributorAuthor

Yeah this is different, this is over SSH.

hashar

hashar commented on Jan 13, 2014

@hashar
Contributor

Dowstream bug at Wikimedia https://bugzilla.wikimedia.org/show_bug.cgi?id=59991

That assert causes me some error as well. Pasting there in case it is relevant:

AssertionError:
len([
    "3d35f5b84a26171535e869fed4a1c73dbeaeec69\t\t'refs/changes/36/107036/1' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor\n"
])
!=
len([
    'Total 9 (delta 7), reused 9 (delta 7)',
    ' * branch           refs/changes/36/107036/1 -> FETCH_HEAD'
])

Tons of changes are being merged successfully though. I have not managed to reproduce the issue :(

mattcallanan

mattcallanan commented on Mar 26, 2014

@mattcallanan

Had a similar problem where AssertionError would occur unless using LogLevel=QUIET in .ssh/config. Trialling a workaround using a custom GIT_SSH setting:

os.environ['GIT_SSH'] = os.path.join(os.path.dirname(__file__), 'quiet_ssh.sh')

where quiet_ssh.sh lives in same directory as python code and contains:

ssh -o LogLevel=QUIET "$@"
ghost

ghost commented on Jun 27, 2014

@ghost
debugloop

debugloop commented on Jul 18, 2014

@debugloop

I am having this very same problem. Relevant pdb output:

(Pdb) w
  /home-selfnet/danieln/selftest/runner.py(53)<module>()
-> repo.remote().pull()
  /usr/local/lib/python2.7/dist-packages/git/remote.py(605)pull()
-> return self._get_fetch_info_from_stderr(proc, progress or RemoteProgress())
> /usr/local/lib/python2.7/dist-packages/git/remote.py(539)_get_fetch_info_from_stderr()
-> assert len(fetch_info_lines) == len(fetch_head_info), "len(%s) != len(%s)" % (fetch_head_info, fetch_info_lines)
(Pdb) p fetch_head_info
["83feaaab69856ab6645bd71d8ec32bbbaaece600\t\tbranch 'master' of git.selfnet.de:noc/selftest\n"]
(Pdb) pp fetch_info_lines
['                                               __________   _____  ____________',
 '                                              / __/ __/ /  / __/ |/ / __/_  __/',
 '                                             _\\ \\/ _// /__/ _//    / _/  / /',
 '                                            /___/___/____/_/ /_/|_/___/ /_/',
 '  some-git-server.selfnet.de',
 '                                             Selfnet e.V.    70569 Stuttgart',
 '                                             somemail@selfnet.de   www.selfnet.de',
 ' = [up to date]      master     -> origin/master']
(Pdb) 

As you can see, this is simply a banner message being in the way.

Thanks for the workaround @mattcallanan

Byron

Byron commented on Jul 18, 2014

@Byron
Member

In branch 0.3, this should already be fixed. You might want to try that one to see if it fixes the problem in that case as well.

added this to the v0.3.2 milestone on Nov 19, 2014
Byron

Byron commented on Nov 19, 2014

@Byron
Member

The latest version on pypi contains a fix for this issue. Please leave a comment if it doesn't fix it for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @medwards@Byron@hashar@terminalmage@mattcallanan

        Issue actions

          Assertion fails when fetching over SSH if remote box has /etc/issue · Issue #94 · gitpython-developers/GitPython