Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CatFileContentStream.execute() should probably safe_decode() stdout and stderr #470

Closed
@warsaw

Description

@warsaw

FTR, using Python 3.5 here.

In a Debian project, we want to essentiallygit show <ref>:debian/changelog but the changelog has some bogus non-utf-8 characters in it. Here's an excerpt (not sure if this will come through in the GH issue):

sbuild (0.24) unstable; urgency=low  * remove -qq from apt-get call in the updatechroot script  * fix upgradechroot output and add -u to -y  * added oldstable to distribution options  * fix for dependency calculation for --arch-all builds from    Martin K<F6>gler (Closes: #180859)  * libpng-dev => libpng12-0-dev in sbuild.conf  * add dpkg-dev to package dependencies - thanks Michael Banck    (Closes: #182234)  * chroot building fix and waldi's patch still to come -- Rick Younie <younie@debian.org>  Sat, 19 Apr 2003 14:41:03 -0700

However, the command tracebacks (notice the weird<F6> in the changelog entry).

Traceback (most recent call last):  File "/home/barry/projects/ubuntu/uddgit/usd-importer/usd-import", line 144, in get_changelog_versions_from_treeish    ref, self._local_repo.git.show('%s:debian/changelog' % ref)))  File "/usr/lib/python3/dist-packages/git/cmd.py", line 459, in <lambda>    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)  File "/usr/lib/python3/dist-packages/git/cmd.py", line 920, in _call_process    return self.execute(make_call(), **_kwargs)  File "/usr/lib/python3/dist-packages/git/cmd.py", line 708, in execute    stdout_value = stdout_value.decode(defenc)UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 1341: invalid start byte

wheredefenc is utf-8. Since git/compat.py already has asafe_decode() method, that should probably be used instead onstdout_value andstderr_value to ensure you don't get an exception on bogus data.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp