From: Johannes Sixt <j6t@kdbg.org>
To: CH <ch-and-git.vger.kernel.org@ch.pkts.ca>
Cc: git@vger.kernel.org
Subject: Re: Feature request: better error messages when UTF-8 bites
Date: Thu, 28 Jul 2022 07:42:28 +0200 [thread overview]
Message-ID: <4b09bf98-dae2-491e-9858-801a9bcdd2fa@kdbg.org> (raw)
In-Reply-To: <f5a49da29fd0e5577083f1006d394158@ch.pkts.ca>
Am 27.07.22 um 22:21 schrieb CH:
> Somehow when copying and pasting a commit from a website to the command
> line, a UTF-8 Byte Order Mark (BOM)
> [https://en.wikipedia.org/wiki/Byte_order_mark] was appended to one of
> the commit ids. BOMs are invisible, as are many other UTF-8 code
> points. The upshot was that Git didn't like it, and complained bitterly:
>
>> $ strace -etrace=execve -s 200 git diff
>> 038179704f0066aa815d5429221cf381ff4ef289
>> 47346a462d8ba40b9a8b073e351c362522c46aa6
>>
>> execve("/usr/bin/git", ["git", "diff",
>> "038179704f0066aa815d5429221cf381ff4ef289\357\273\277",
>> "47346a462d8ba40b9a8b073e351c362522c46aa6"], 0x7fffec3c4bb0 /* 80 vars
>> */) = 0
>>
>> fatal: ambiguous argument '038179704f0066aa815d5429221cf381ff4ef289':
>> unknown revision or path not in the working tree.
>> Use '--' to separate paths from revisions, like this:
>> 'git <command> [<revision>...] -- [<file>...]'
>> +++ exited with 128 +++
>
> Feature request:
> ================
>
> When printing the "fatal: ambiguous argument '......': ....", perhaps
> escape (url or otherwise) the ambiguous argument when printing it in the
> error message, or maybe add a sentence about non-ASCII characters being
> found.
That's not going to fly, IMHO, because when I type
git diff todo/René
I would not want to see
fatal: ambiguous argument 'todo/Ren\303\251': unknown ...
I'm convinced that there are thousands of users who use non-ASCII branch
and file names that they also frequently mis-type. They'd all be greeted
with unintelligible nerdy gibberish.
I may be able to change my mind if ambiguous input (in the sense of "is
not what it seems to be") leads to a security hazard that is unique to Git.
-- Hannes
next prev parent reply other threads:[~2022-07-28 5:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-27 20:21 Feature request: better error messages when UTF-8 bites CH
2022-07-28 5:42 ` Johannes Sixt [this message]
2022-07-28 9:40 ` Thomas Guyot
2022-07-28 18:01 ` Torsten Bögershausen
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=4b09bf98-dae2-491e-9858-801a9bcdd2fa@kdbg.org \
--to=j6t@kdbg.org \
--cc=ch-and-git.vger.kernel.org@ch.pkts.ca \
--cc=git@vger.kernel.org \
/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).