From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Jeff King <peff@peff.net>
Cc: Yaakov Smith <Yaakov.Smith@wisetechglobal.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: \b character escapes in CLI usage
Date: Wed, 26 Feb 2025 23:36:12 +0000 [thread overview]
Message-ID: <Z7-lbGnlzGbhrHZN@tapette.crustytoothpaste.net> (raw)
In-Reply-To: <20250226073822.GA21138@coredump.intra.peff.net>
[-- Attachment #1: Type: text/plain, Size: 1651 bytes --]
On 2025-02-26 at 07:38:22, Jeff King wrote:
> On Tue, Feb 25, 2025 at 11:44:33PM +0000, Yaakov Smith wrote:
> > When using "git config --list" however, this is emitted in its raw format, and can be used to mask or hide an actual (probably invalid) value:
> >
> > $ cat .git/config
> > [core]
> > somevalue = "true\b\b\b\bfalse"
> > $ git config --local --list
> > core.somevalue=false
>
> But here, the point of "git config" is to show the output. If we
> sanitized it (especially in a lossy way like we do for error messages),
> then any program reading the output would not see the real data.
Yes, I should point out that, among other programs, Git LFS reads this
output. Changing the output format would break those programs.
> > Should "git config" be smarter here and print something other than a
> > literal backspace to the terminal, like "git fetch" does?
>
> So I would say no here, in general.
I agree this is the right choice in general. I wonder if we might want
some sort of human-readable output option that might escape these that
users could use. The output might still be machine-readable, but it
might be easier to parse than the current format, which has some tricky
edge cases when a config value contains newlines.
We already have precedent for this in core.quotePath and could easily
use similar logic here. That format, while using octal, which I find
ugly and hard to read, does have the pleasant side effect that it works
correctly with POSIX printf(1) (which I'm sure was intentional), unlike
hex escapes.
--
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
next prev parent reply other threads:[~2025-02-26 23:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 23:44 \b character escapes in CLI usage Yaakov Smith
2025-02-26 7:38 ` Jeff King
2025-02-26 8:09 ` Jeff King
2025-02-26 16:02 ` Junio C Hamano
2025-02-26 16:38 ` Kyle Lippincott
2025-02-26 22:06 ` Jeff King
2025-02-26 15:59 ` Junio C Hamano
2025-02-26 23:36 ` brian m. carlson [this message]
2025-02-26 23:55 ` Junio C Hamano
2025-02-27 0:03 ` Junio C Hamano
2025-02-27 14:06 ` General output formatting (was: Re: \b character escapes in CLI usage) Marc Branchaud
2025-02-27 17:06 ` General output formatting Junio C Hamano
2025-02-27 17:14 ` Marc Branchaud
2025-02-27 18:40 ` Junio C Hamano
2025-02-27 16:26 ` \b character escapes in CLI usage Phillip Wood
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z7-lbGnlzGbhrHZN@tapette.crustytoothpaste.net \
--to=sandals@crustytoothpaste.net \
--cc=Yaakov.Smith@wisetechglobal.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox