GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Error when handling non-ascii filename · Issue #1631 · gitpython-developers/GitPython

Error when handling non-ascii filename #1631

New issue
Copy link
New issue
Copy link
Closed as not planned
Bug
Closed as not planned
Error when handling non-ascii filename#1631
Bug
Copy link
Labels
acknowledgedhelp wanted

Description

@lubomir
lubomir
opened on Aug 22, 2023
Issue body actions

Steps to reproduce:

$ mkdir foo
$ cd foo
$ git init
$ touch 'bokm'$'\345''l.alias'
$ python -c 'import git; git.Repo(".").untracked_files'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.11/site-packages/git/repo/base.py", line 839, in untracked_files
    return self._get_untracked_files()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/git/repo/base.py", line 856, in _get_untracked_files
    filename = filename.encode("ascii").decode("unicode_escape").encode("latin1").decode(defenc)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe5 in position 4: invalid continuation byte

I can reproduce with 3.1.30 and 3.1.32.

A file with such name is present in ftp://ftp.gnu.org/gnu/aspell/dict/nb/aspell-nb-0.50.1-0.tar.bz2
I'm not sure what encoding it's supposed to be. Firefox detects it as windows-1252 (and displays it correctly).

Activity

  1. Byron
    added
    acknowledged
    help wanted
    on Aug 22, 2023
  2. Byron commented on Aug 22, 2023

    @Byron
    Byron
    on Aug 22, 2023
    Member
    More actions

    The handling of filepaths is completely broken in GitPython as it tries to handle it like it's strings even though these imply a known encoding.

    This could definitely use an overhaul, these issues are in many places.

  3. pushfoo commented on Oct 16, 2023

    @pushfoo
    pushfoo
    on Oct 16, 2023
    More actions

    The handling of filepaths is completely broken

    1. How much of this is Python 2 legacy?
    2. Are there more detailed notes on how / why?
    3. Is there an external dependency policy of any sort restricting what can be used beyond license compatibility?
  4. Byron commented on Oct 16, 2023

    @Byron
    Byron
    on Oct 16, 2023
    Member
    More actions

    Probably most of it is the way it is due to a lack of understanding of how to handle paths in general and in git specifically. Most problems occour merely by trying to decode bytes into something that can be used in python even though one is dealing with either OS paths or bundles of bytes produced by the git binary itself.

    I don't think there is a limit of what could be used in terms of external dependency if it has a compatible license and is truly required. I'd hope python can handle OS paths properly out of the box by now.

  5. Byron
    added the
    Bug
    issue type on Jul 20, 2026
  6. Byron
    closed this as not plannedon Jul 20, 2026
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

    acknowledgedhelp wanted

    Type

    Bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.