Skip to content

Systems with non-English locales fail in some cases #290

Closed

Description

@earwig

Previously reported as #68, this is still broken. The current insufficient fix is here: git/cmd.py#552

Originally reported downstream here: earwig/git-repo-updater#11

Steps to reproduce:

  • Ensure a non-English locale is available on your system. In my case (Ubuntu 14.04 LTS), I had to do sudo locale-gen fr_FR.UTF-8 && sudo dpkg-reconfigure locales
  • export LANGUAGE=fr_FR.UTF-8
  • export LC_ALL=fr_FR.UTF-8
  • python -c "import git; git.Repo('path/to/a/repo').remote().fetch()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/earwig/.local/lib/python2.7/site-packages/GitPython-1.0.1-py2.7.egg/git/remote.py", line 651, in fetch
    res = self._get_fetch_info_from_stderr(proc, progress or RemoteProgress())
  File "/home/earwig/.local/lib/python2.7/site-packages/GitPython-1.0.1-py2.7.egg/git/remote.py", line 588, in _get_fetch_info_from_stderr
    for err_line, fetch_line in zip(fetch_info_lines, fetch_head_info))
  File "/home/earwig/.local/lib/python2.7/site-packages/GitPython-1.0.1-py2.7.egg/git/remote.py", line 588, in <genexpr>
    for err_line, fetch_line in zip(fetch_info_lines, fetch_head_info))
  File "/home/earwig/.local/lib/python2.7/site-packages/GitPython-1.0.1-py2.7.egg/git/remote.py", line 241, in _from_line
    raise ValueError("Failed to parse line: %r" % line)
ValueError: Failed to parse line: u' = [\xe0 jour]          develop    -> origin/develop'

Activity

  1. Byron commented on May 31, 2015

    @Byron
    Member

    I am still trying to reproduce the issue on a VM, but have nonetheless provided a potential fix. You might be able to verify it earlier than I do - I will however keep you posted.

  2. added a commit that references this issue on May 31, 2015
  3. Byron commented on May 31, 2015

    @Byron
    Member

    Please try the latest master - even on a virtual machine I was unable to get git into non-english mode, for some reason. Any other program I used (e.g. ls, date) reported in french, as expected.

  4. added this to the v1.0.2 - Fixes milestone on May 31, 2015
  5. Byron commented on May 31, 2015

    @Byron
    Member

    You can watch the development stream on youtube.

    GitPython #2 [fix issue 290 - enforce C locale]

    thumb

  6. earwig commented on Jun 1, 2015

    @earwig
    Author

    Thanks for uploading the video, it was interesting to watch. Sorry to make you spend a while on something I hoped wouldn't take very long!

    I'm not sure why you weren't able to get git in another language. I followed nearly the same procedure as you in the VM and I was able to do it. These things tend to be shaky, so maybe it's down to a difference in Ubuntu version or installed packages?

    At any rate, the provided fix works for me. I asked the original reporter to test it, but I suspect it will work for him too.

  7. Byron commented on Jun 1, 2015

    @Byron
    Member

    Good to hear ! Please feel free to close this issue once it works for the upstream reporter.

    NOTE: I'd probably want to make a new release on pypi, but unfortunately they lost support for OpenID, which terminated my account as well. There is no way for me to login, and the site to reset an account doesn't work either ... . I will reach out to @empty to re-authenticate the new account I made.

  8. nvie commented on Aug 28, 2015

    @nvie
    Contributor

    I've seen the following variant of this error sometimes when this is emitted from the underlying ssh command:

    ValueError: Failed to parse line: "Warning: Permanently added the RSA host key for IP address '192.30.***.***' to the list of known hosts."

    The initial git command thus fails, but retrying it typically makes it work again since the warning is not emitted a second time.

    Perhaps a solution could be to ignore lines starting with Warning: ?

  9. Byron commented on Aug 29, 2015

    @Byron
    Member

    @nvie Warning lines could be ignored above this line quite nicely. It might even work assuming that the language of ssh is always changed to english if GitPython invokes git with the respective environment variable set.

    If you would like to get your hands dirty and submit a PR, I'd happily merge it.
    Thanks and cheers !

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions