git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff Hostetler <git@jeffhostetler.com>
Cc: Jeff Hostetler via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org, Jeff Hostetler <jeffhost@microsoft.com>
Subject: Re: [PATCH 2/3] trace2: trim whitespace in start message in perf target format
Date: Wed, 07 Aug 2019 13:37:24 -0700	[thread overview]
Message-ID: <xmqqef1whfuj.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <827ed342-1079-8145-ed78-1b955264226e@jeffhostetler.com> (Jeff Hostetler's message of "Wed, 7 Aug 2019 16:25:24 -0400")

Jeff Hostetler <git@jeffhostetler.com> writes:

> On 8/1/2019 5:34 PM, Junio C Hamano wrote:
>> "Jeff Hostetler via GitGitGadget" <gitgitgadget@gmail.com> writes:
>>
>>> From: Jeff Hostetler <jeffhost@microsoft.com>
>>>
>>> Trim leading/trailing whitespace from the command line
>>> printed in the "start" message in the perf target format.
>>>
>>> We use `sq_quote_argv_pretty()` to format the message
>>> and it adds a leading space to the output.  Trim that.
>>
>> strbuf_trim() not just drops a single leading space, but removes
>> consecutive spaces from both ends.  But the first char after the SP
>> comes from the first arg, and it can never be a whitespace (as a
>> payload that begins with a whitespace will be quoted, so it will be
>> a single quote), and the last char in the buffer would also be
>> either a closing single quote (if the last argument ends with a
>> whitespace) or a non whitespace "safe" character, so it is safe to
>> use strbuf_trim() here.
>>
>> I wonder if we want to lose the prepending of SP from
>> sq_quote_argv_pretty(), though:
>
> I was wondering about that too, but I didn't want to presume
> to know what all of the callers wanted.  And didn't want to
> slip in such a change last-minute.

I do not think this topic/discussion is a place to do so, either.
And compensating on the caller's side, like your patch did, is
perfectly fine.

I was more disturbed by potential double quoting in some codepaths
when I did a cursory audit of users of sq_quote_argv_pretty(), and
would think that would be of more importance, though.

  reply	other threads:[~2019-08-07 20:37 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31 20:04 [PATCH 0/3] trace2: clean up formatting in perf target format Jeff Hostetler via GitGitGadget
2019-07-31 20:04 ` [PATCH 1/3] trace2: cleanup column alignment " Jeff Hostetler via GitGitGadget
2019-07-31 20:04 ` [PATCH 2/3] trace2: trim whitespace in start message " Jeff Hostetler via GitGitGadget
2019-08-01 21:34   ` Junio C Hamano
2019-08-07 20:25     ` Jeff Hostetler
2019-08-07 20:37       ` Junio C Hamano [this message]
2019-07-31 20:04 ` [PATCH 3/3] trace2: trim whitespace in region messages " Jeff Hostetler via GitGitGadget
2019-08-01 22:57 ` [PATCH 0/3] trace2: clean up formatting " Josh Steadmon
2019-08-08 14:18 ` [PATCH v2 0/7] " Jeff Hostetler via GitGitGadget
2019-08-08 14:18   ` [PATCH v2 1/7] trace2: cleanup column alignment " Jeff Hostetler via GitGitGadget
2019-08-08 14:19   ` [PATCH v2 2/7] trace2: trim whitespace in region messages " Jeff Hostetler via GitGitGadget
2019-08-08 14:19   ` [PATCH v2 3/7] trace2: remove dead code in maybe_add_string_va() Jeff Hostetler via GitGitGadget
2019-08-08 14:19   ` [PATCH v2 5/7] quote: add sq_quote_argv_pretty_ltrim Jeff Hostetler via GitGitGadget
2019-08-08 18:05     ` Junio C Hamano
2019-08-08 19:04       ` Jeff Hostetler
2019-08-08 20:01         ` Junio C Hamano
2019-08-08 22:49         ` René Scharfe
2019-08-09 17:13           ` Jeff Hostetler
2019-08-09 18:01             ` René Scharfe
2019-08-08 14:19   ` [PATCH v2 4/7] trace2: trim trailing whitespace in normal format error message Jeff Hostetler via GitGitGadget
2019-08-08 14:19   ` [PATCH v2 6/7] trace2: cleanup whitespace in normal format Jeff Hostetler via GitGitGadget
2019-08-08 14:19   ` [PATCH v2 7/7] trace2: cleanup whitespace in perf format Jeff Hostetler via GitGitGadget
2019-08-09 15:00   ` [PATCH v3 0/7] trace2: clean up formatting in perf target format Jeff Hostetler via GitGitGadget
2019-08-09 15:00     ` [PATCH v3 2/7] trace2: trim whitespace in region messages " Jeff Hostetler via GitGitGadget
2019-08-09 15:00     ` [PATCH v3 1/7] trace2: cleanup column alignment " Jeff Hostetler via GitGitGadget
2019-08-09 15:00     ` [PATCH v3 3/7] trace2: remove dead code in maybe_add_string_va() Jeff Hostetler via GitGitGadget
2019-08-09 15:00     ` [PATCH v3 5/7] quote: add sq_append_quote_argv_pretty() Jeff Hostetler via GitGitGadget
2019-08-09 17:54       ` Junio C Hamano
2019-08-09 18:17         ` Jeff Hostetler
2019-08-09 15:00     ` [PATCH v3 4/7] trace2: trim trailing whitespace in normal format error message Jeff Hostetler via GitGitGadget
2019-08-09 15:00     ` [PATCH v3 6/7] trace2: cleanup whitespace in normal format Jeff Hostetler via GitGitGadget
2019-08-09 15:00     ` [PATCH v3 7/7] trace2: cleanup whitespace in perf format Jeff Hostetler via GitGitGadget
2019-08-09 18:14     ` [PATCH v3 0/7] trace2: clean up formatting in perf target format Junio C Hamano

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=xmqqef1whfuj.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@jeffhostetler.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=jeffhost@microsoft.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).