From: "Torsten Bögershausen" <tboegi@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Tzadik Vanderhoof <tzadik.vanderhoof@gmail.com>,
Eric Sunshine <sunshine@sunshineco.com>,
Git List <git@vger.kernel.org>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Luke Diamand <luke@diamand.org>, Pete Wyckoff <pw@padd.com>
Subject: Re: [PATCH v5] add git-p4.fallbackEncoding config variable, to prevent git-p4 from crashing on non UTF-8 changeset descriptions
Date: Wed, 28 Apr 2021 16:58:24 +0200 [thread overview]
Message-ID: <20210428145824.43c4t7hkjfqjyspb@tb-raspi4> (raw)
In-Reply-To: <xmqqr1ivauph.fsf@gitster.g>
On Wed, Apr 28, 2021 at 01:39:38PM +0900, Junio C Hamano wrote:
> Tzadik Vanderhoof <tzadik.vanderhoof@gmail.com> writes:
>
> > t/t9835-git-p4-config-fallback-encoding.sh | 87 ++++++++++++++++++++++
> > 3 files changed, 106 insertions(+), 1 deletion(-)
> > create mode 100755 t/t9835-git-p4-config-fallback-encoding.sh
>
> 9835 is already taken (see 'seen').
In general, this looks good to me.
There are two minor nitpicks to make the patch more the git-way:
> Subject: [PATCH v5] add git-p4.fallbackEncoding config variable, to prevent git-p4 from crashing on non UTF-8 changeset descriptionsw
The head line is somewhat too long.
It should be much shorter, like 50-55 characters, if I recall it rigth.
The first line of the commit message is what we see under PATCH in the email,
followed by a blank line (that's what we have) and a detailed description
(Which we have)
How abut this ?
git-p4: Add git-p4.fallbackEncoding
Add git-p4.fallbackEncoding config variable,
to prevent git-p4 from crashing on non UTF-8 changeset descriptions.
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 byte
This is especially a problem for the "git p4 clone ... @all" command,
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.
Add a new config setting, allowing git-p4 to try a fallback encoding
(for example, "cp1252") and/or use the Unicode replacement character,
to prevent the whole program from crashing on such a minor problem.
[]
And then, somewhere in the test:
cp /dev/null "$clone_fails" &&
This should create an empty file, right ?
Then we can use a simple output-redirection:
>"$clone_fails" &&
next prev parent reply other threads:[~2021-04-28 15:01 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 19:28 git-p4 crashes on non UTF-8 output from p4 Tzadik Vanderhoof
2021-04-09 15:38 ` Torsten Bögershausen
2021-04-11 7:16 ` Tzadik Vanderhoof
2021-04-11 9:37 ` Torsten Bögershausen
2021-04-11 20:21 ` Tzadik Vanderhoof
2021-04-12 4:06 ` Torsten Bögershausen
2021-04-21 8:46 ` [PATCH] add git-p4.fallbackEncoding config variable, to prevent git-p4 from crashing on non UTF-8 changeset descriptions Tzadik Vanderhoof
2021-04-21 8:55 ` Tzadik Vanderhoof
2021-04-22 5:05 ` [PATCH v3] add git-p4.fallbackEncoding config setting, " Tzadik Vanderhoof
2021-04-22 15:50 ` Torsten Bögershausen
2021-04-22 16:17 ` Eric Sunshine
2021-04-22 22:33 ` Eric Sunshine
2021-04-23 6:36 ` [PATCH] add git-p4.fallbackEncoding config variable, " Tzadik Vanderhoof
2021-04-23 6:44 ` Tzadik Vanderhoof
2021-04-23 19:08 ` Tzadik Vanderhoof
2021-04-24 8:14 ` Torsten Bögershausen
2021-04-27 5:39 ` [PATCH v5] " Tzadik Vanderhoof
2021-04-27 5:45 ` Tzadik Vanderhoof
2021-04-28 4:39 ` Junio C Hamano
2021-04-28 14:58 ` Torsten Bögershausen [this message]
2021-04-29 7:39 ` [PATCH v6] Add git-p4.fallbackEncoding Tzadik Vanderhoof
2021-04-29 8:36 ` Luke Diamand
2021-04-29 17:29 ` Tzadik Vanderhoof
[not found] ` <20210429074458.891-1-tzadik.vanderhoof@gmail.com>
[not found] ` <c4c48615-d1f4-fd37-0960-979535907f15@web.de>
2021-04-29 17:14 ` Tzadik Vanderhoof
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210428145824.43c4t7hkjfqjyspb@tb-raspi4 \
--to=tboegi@web.de \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=luke@diamand.org \
--cc=pw@padd.com \
--cc=sunshine@sunshineco.com \
--cc=tzadik.vanderhoof@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).