From: Jeff King <peff@peff.net>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Ellié Computing Open Source Program"
<opensource@elliecomputing.com>,
"Pierre Habouzit" <madcoder@debian.org>,
git@vger.kernel.org
Subject: Re: Problem listing GIT repository with accents
Date: Mon, 1 Feb 2010 08:44:54 -0500 [thread overview]
Message-ID: <20100201134454.GA796@coredump.intra.peff.net> (raw)
In-Reply-To: <20100201133903.GA923@coredump.intra.peff.net>
On Mon, Feb 01, 2010 at 08:39:03AM -0500, Jeff King wrote:
> If you want to keep the "!p[len]" condition, then yes. If we want to
> properly quote internal NULs (which again, I am not sure is of practical
> use), then you would also have to make that condition "(maxlen >= 0 &&
> !p[len])". Which is really not that bad, but I was trying to make it
> easier to read. I am OK with any of the three combinations of fixes.
>
> And the fact that I am using the word "combination" probably means it
> should be a separate patch anyway.
>
> So here is the minimal patch to go on 'maint', for Junio's convenience.
And here is what the "quote embedded NULs" patch would look like on top.
It's actually pretty straightforward, but the more I think of it, the
more I think it is probably not worthwhile. Not only are we quoting
paths, which should not have embedded NULs, but it requires that the
caller always pass the length explicitly, and clearly we are not doing
that all or even most of the time. So while this would fix the low-level
"this function quotes an arbitrary string" case, for it to be of any use
all of the code paths leading to it would need to be audited to handle
NUL-embedded strings.
---
diff --git a/quote.c b/quote.c
index 723bb4f..fc93435 100644
--- a/quote.c
+++ b/quote.c
@@ -213,7 +213,7 @@ static size_t quote_c_style_counted(const char *name, ssize_t maxlen,
int ch;
len = next_quote_pos(p, maxlen);
- if (len == maxlen || !p[len])
+ if (len == maxlen || (maxlen < 0 && !p[len]))
break;
if (!no_dq && p == name)
next prev parent reply other threads:[~2010-02-01 13:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-01 10:48 Problem listing GIT repository with accents Ellié Computing Open Source Program
2010-02-01 11:32 ` Jeff King
2010-02-01 12:19 ` Jeff King
2010-02-01 12:48 ` Johannes Sixt
2010-02-01 13:39 ` Jeff King
2010-02-01 13:44 ` Jeff King [this message]
2010-02-01 17:21 ` Junio C Hamano
2010-02-01 17:40 ` Jeff King
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=20100201134454.GA796@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
--cc=madcoder@debian.org \
--cc=opensource@elliecomputing.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.
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 NNTP newsgroup(s).