git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Lars Schneider <larsxschneider@gmail.com>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: Git Mailing List <git@vger.kernel.org>,
	peff@peff.net, gitster@pobox.com, sbeller@google.com,
	Johannes.Schindelin@gmx.de, jnareb@gmail.com, mlbright@gmail.com,
	jacob.keller@gmail.com
Subject: Re: [PATCH v7 10/10] convert: add filter.<driver>.process option
Date: Mon, 12 Sep 2016 11:49:15 +0200	[thread overview]
Message-ID: <10020380-76ED-4371-A0BA-59D07AF33CE0@gmail.com> (raw)
In-Reply-To: <20160910062919.GB11001@tb-raspi>


> On 10 Sep 2016, at 08:29, Torsten Bögershausen <tboegi@web.de> wrote:
> 
> On Thu, Sep 08, 2016 at 08:21:32PM +0200, larsxschneider@gmail.com wrote:
> []
>> +packet:          git> git-filter-client
>> +packet:          git> version=2
>> +packet:          git> version=42
>> +packet:          git> 0000
>> +packet:          git< git-filter-server
>> +packet:          git< version=2
>> +packet:          git> clean=true
>> +packet:          git> smudge=true
>> +packet:          git> not-yet-invented=true
>> +packet:          git> 0000
>> +packet:          git< clean=true
>> +packet:          git< smudge=true
>> +packet:          git< 0000
> 
> It's probalby only me who has difficulties to distinguish
> '>' from '<'.

I see what you mean. However, this format is used with "GIT_TRACE_PACKET"
as well and therefore I would prefer to keep it.


> packet:          git> git-filter-client
> packet:          git> version=2
> packet:          git> version=42
> packet:          git> 0000
> packet:       filter> git-filter-server
> packet:       filter> version=2
> 
> (Otherwise the dialoge description is nice)

Thanks!


>> +------------------------
>> +Supported filter capabilities in version 2 are "clean" and
>> +"smudge".
>> +
>> +Afterwards Git sends a list of "key=value" pairs terminated with
>> +a flush packet. The list will contain at least the filter command
>> +(based on the supported capabilities) and the pathname of the file
>> +to filter relative to the repository root. Right after these packets
>> +Git sends the content split in zero or more pkt-line packets and a
>> +flush packet to terminate content.
>> +------------------------
>> +packet:          git> command=smudge\n
>> +packet:          git> pathname=path/testfile.dat\n
> 
> How do we send pathnames the have '\n' ?
> Not really recommended, but allowed.
> And here I am a little bit lost, is each of the lines packed into
> a pkt-line ?
> command=smudge is packet as pkt-line and pathname= is packed into
> another one ? (The we don't need the '\n' at all)

Every line is a dedicated packet. That's why '\n' in a path name would
not be a problem as the receiver is expected to read the entire packet
when parsing the value (and the receiver knows the packet length, too).

The '\n' at the end is required by the pkt-line format:
"A non-binary line SHOULD BE terminated by an LF..."
(see protocol-common.txt)


> Or go both lines into one pkt-line (thats what I think), then
> we don't need the '\n' afther the pathname.

No (see above).


> And in this case the pathname is always the last element, and a '\n'
> may occur in the pathname, since we know the length of the packet
> we know how long the pathname must be.
> 
> 
> [...]
>> 
>> +In case the filter cannot or does not want to process the content,
> 
> Does not want ? 
> I can see something like "I read through the file, there is nothing
> to do. So Git, I don't send anything back, you know where the file is.

That's right. Isn't that covered with "does not want"?


>> +it is expected to respond with an "error" status. Depending on the
>> +`filter.<driver>.required` flag Git will interpret that as error
>> +but it will not stop or restart the filter process.
>> +------------------------
>> +packet:          git< status=error\n
>> +packet:          git< 0000
>> +------------------------
>> +
>> +If the filter experiences an error during processing, then it can
>> +send the status "error" after the content was (partially or
>> +completely) sent. Depending on the `filter.<driver>.required` flag
>> +Git will interpret that as error but it will not stop or restart the
>> +filter process.
>> +------------------------
>> +packet:          git< status=success\n
>> +packet:          git< 0000
>> +packet:          git< HALF_WRITTEN_ERRONEOUS_CONTENT
>> +packet:          git< 0000
>> +packet:          git< status=error\n
>> +packet:          git< 0000
>> +------------------------
>> +
>> +If the filter dies during the communication or does not adhere to
>> +the protocol then Git will stop the filter process and restart it
> 
> My personal comment:
> When a filter is mis-behaving, Git should say so loud and clear, and
> die(). 
> The filter process can be left running, so that it can be debugged.

In the current implementation Git would die already if the filter is 
"required". In this particular case we *could* die, too. However, 
I would prefer to keep it as is because I think the users of a 
"non-required" filter do not expect Git to die if there is *any* 
problem with the filter.


> Here I stopped the review for a moment, 
> I still think that Git shouldn't kill anything, because we loose
> the ability to debug these processes.

Based on my experience debugging the filter in this state is hard
anyways. I think a user would rather try to reproduce the problem
and run Git with the "GIT_TRACE_PACKET" flag enabled for debugging.


Thanks,
Lars

  reply	other threads:[~2016-09-12 11:58 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08 18:21 [PATCH v7 00/10] Git filter protocol larsxschneider
2016-09-08 18:21 ` [PATCH v7 01/10] pkt-line: rename packet_write() to packet_write_fmt() larsxschneider
2016-09-08 18:21 ` [PATCH v7 02/10] pkt-line: extract set_packet_header() larsxschneider
2016-09-08 18:21 ` [PATCH v7 03/10] pkt-line: add packet_write_fmt_gently() larsxschneider
2016-09-08 21:18   ` Stefan Beller
2016-09-11 11:36     ` Lars Schneider
2016-09-11 16:01       ` Stefan Beller
2016-09-12  9:22         ` Lars Schneider
2016-09-08 18:21 ` [PATCH v7 04/10] pkt-line: add packet_flush_gently() larsxschneider
2016-09-12 23:30   ` Junio C Hamano
2016-09-13 22:12     ` Lars Schneider
2016-09-13 22:44       ` Junio C Hamano
2016-09-15 16:42         ` Lars Schneider
2016-09-15 19:44           ` Jeff King
2016-09-15 20:19             ` Lars Schneider
2016-09-15 20:33               ` Junio C Hamano
2016-09-08 18:21 ` [PATCH v7 05/10] pkt-line: add packet_write_gently() larsxschneider
2016-09-08 21:24   ` Stefan Beller
2016-09-11 11:44     ` Lars Schneider
2016-09-12 23:31   ` Junio C Hamano
2016-09-08 18:21 ` [PATCH v7 06/10] pkt-line: add functions to read/write flush terminated packet streams larsxschneider
2016-09-08 21:49   ` Stefan Beller
2016-09-11 12:33     ` Lars Schneider
2016-09-11 16:03       ` Stefan Beller
2016-09-11 21:42     ` Junio C Hamano
2016-09-08 18:21 ` [PATCH v7 07/10] convert: quote filter names in error messages larsxschneider
2016-09-08 18:21 ` [PATCH v7 08/10] convert: modernize tests larsxschneider
2016-09-08 22:05   ` Stefan Beller
2016-09-11 12:34     ` Lars Schneider
2016-09-08 18:21 ` [PATCH v7 09/10] convert: make apply_filter() adhere to standard Git error handling larsxschneider
2016-09-08 18:21 ` [PATCH v7 10/10] convert: add filter.<driver>.process option larsxschneider
2016-09-10  6:29   ` Torsten Bögershausen
2016-09-12  9:49     ` Lars Schneider [this message]
2016-09-13 14:44       ` Torsten Bögershausen
2016-09-13 16:42         ` Junio C Hamano
2016-09-15 17:23           ` Lars Schneider
2016-09-15 20:04             ` Junio C Hamano
2016-09-29  6:33               ` Torsten Bögershausen
2016-09-29  9:37                 ` Jakub Narębski
2016-09-10 16:40   ` Torsten Bögershausen
2016-09-13 22:04     ` Lars Schneider
2016-09-13 15:22   ` Junio C Hamano
2016-09-15 20:16     ` Lars Schneider
2016-09-15 20:24       ` Junio C Hamano
2016-09-13 16:00 ` [PATCH v7 00/10] Git filter protocol 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=10020380-76ED-4371-A0BA-59D07AF33CE0@gmail.com \
    --to=larsxschneider@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jacob.keller@gmail.com \
    --cc=jnareb@gmail.com \
    --cc=mlbright@gmail.com \
    --cc=peff@peff.net \
    --cc=sbeller@google.com \
    --cc=tboegi@web.de \
    /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).