Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
terminalmage opened this issue Feb 5, 2013 · 11 comments
Closed

Comments

@terminalmage
Copy link
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.

@medwards
Copy link

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
Copy link
Contributor Author

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
Copy link

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
Copy link

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

@terminalmage
Copy link
Contributor Author

Yeah this is different, this is over SSH.

@hashar
Copy link
Contributor

hashar commented Jan 13, 2014

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
Copy link

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
Copy link

ghost commented Jun 27, 2014

@mattcallanan +1

@debugloop
Copy link

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',
 '                                             [email protected]   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
Copy link
Member

Byron commented Jul 18, 2014

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.

@Byron Byron added the feedback label Jul 18, 2014
@Byron Byron added this to the v0.3.2 milestone Nov 19, 2014
@Byron
Copy link
Member

Byron commented Nov 19, 2014

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

@Byron Byron closed this as completed Nov 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants