git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Boxuan Li <liboxuan@connect.hku.hk>
Cc: git@vger.kernel.org, j6t@kdbg.org, gitster@pobox.com
Subject: Re: [RFC PATCH] userdiff: ship built-in driver config file
Date: Tue, 18 Jun 2019 23:58:58 -0400	[thread overview]
Message-ID: <20190619035857.GB515@sigill.intra.peff.net> (raw)
In-Reply-To: <20190617165450.81916-1-liboxuan@connect.hku.hk>

On Tue, Jun 18, 2019 at 12:54:50AM +0800, Boxuan Li wrote:

> A few notes and questions:
> 1. In [diff "tex"] section, \x80 and \xff cannot be parsed by git config parser.
> I have no idea why this is happening. I changed them to \\x80 and \\xff as a workaround, which
> resulted in t4034 failure (See https://travis-ci.org/li-boxuan/git/jobs/546729906#L4679).
> 2. I am not sure how and where I can free the memory allocated to "builtin_drivers".
> 3. When I run `git format-patch HEAD~1`, core dump happens occasionally. Seems
> no test case caught this problem. Till now, I have no luck finding out the reason.

I couldn't replicate it with a simple test, but perhaps running under
valgrind or "make SANITIZE=address" would help?

> diff --git a/templates/this--userdiff b/templates/this--userdiff
> new file mode 100644
> index 0000000000..85114a7229
> --- /dev/null
> +++ b/templates/this--userdiff
> @@ -0,0 +1,164 @@
> +[diff "ada"]
> +	xfuncname = "!^(.*[ \t])?(is[ \t]+new|renames|is[ \t]+separate)([ \t].*)?$\n"
> +	xfuncname = "!^[ \t]*with[ \t].*$\n"
> +	xfuncname = "^[ \t]*((procedure|function)[ \t]+.*)$\n"
> +	xfuncname = "^[ \t]*((package|protected|task)[ \t]+.*)$"

While having separate lines that get joined here does make the result
easier to read, I think it creates some confusion. diff.*.xfuncname in a
regular config file _doesn't_ behave this way (it's the usual
last-one-wins, so we expect a single string). You've handled this
specially in your code to read this file, but it's confusing because
this test otherwise looks exactly like a config file. And thus somebody
might be tempted to copy it to their config file and modify it, but it
would not do what they expected.

I don't recall how well our config parser copes with embedded newlines
in values.  I.e., if it would be possible to write:

  [diff "foo"]
  xfuncname = "the pattern starts here...
  and continues through newlines!"

I think it doesn't work, but perhaps it would be a nice feature to add
it. It would make the format slightly more complex, though (and make
diagnosing a missing double-quote much harder). I dunno.

-Peff

  parent reply	other threads:[~2019-06-19  3:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 16:54 [RFC PATCH] userdiff: ship built-in driver config file Boxuan Li
2019-06-18 20:32 ` Johannes Sixt
2019-06-18 20:50   ` Johannes Sixt
2019-06-19  3:49   ` Jeff King
2019-06-19  6:30     ` Johannes Sixt
2019-06-19 15:02       ` Junio C Hamano
2019-06-19 18:39       ` Jeff King
2019-06-20  7:41         ` Johannes Sixt
2019-06-19 14:50     ` Junio C Hamano
2019-06-19  3:58 ` Jeff King [this message]
2019-06-19 15:32   ` LI, BO XUAN
2019-06-19 18:42     ` 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=20190619035857.GB515@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=liboxuan@connect.hku.hk \
    /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).