git-p4 crashes on non UTF-8 output from p4
- From
- Tzadik Vanderhoof <tzadik.vanderhoof@gmail.com>
- Date
- Apr 8, 2021, 19:28 UTC
- Message-ID
- <CAKu1iLXtwuCQTS0s7_LEm0OJF-4s0UhPhDW1r5Zb7=GsSPfpdQ@mail.gmail.com>
When git-p4 reads the output from a p4 command, it assumes it will be 100% UTF-8. If even one character in the output of one p4 command is not UTF-8, git-p4 crashes with:
File "C:/Program Files/Git/bin/git-p4.py", line 774, in p4CmdList
value = value.decode() UnicodeDecodeError: 'utf-8' codec can't
decode byte Ox93 in position 42: invalid start byteI'd like to make a pull request to have it try another encoding (eg cp1252) and/or use the Unicode replacement character, to prevent the whole program from crashing on such a minor problem.
This is especially a problem on the "git p4 clone" command with @all, where git-p4 needs to read thousands of changeset descriptions, one of which may have a stray smart quote, causing the whole clone operation to fail.
Sound ok?