All of lore.kernel.org
 help / color / mirror / Atom feed
From: dwh@linuxprogrammer.org
To: git@vger.kernel.org
Subject: pkt-line and LF terminated lines of data
Date: Wed, 28 Apr 2021 15:22:19 -0700	[thread overview]
Message-ID: <20210428222219.GA982@localhost> (raw)

I was just reading the Documentation/technical/protocol-common.txt
description of the pkt-line format. One detail that is left out is how a
receiver of pkt-line encoded data determines if a line is binary data or
contains non-binary data.

The documentation says:

> A non-binary line SHOULD BE terminated by an LF, which if present MUST
> be included in the total length. Receivers MUST treat pkt-lines with
> non-binary data the same whether or not they contain the trailing LF
> (stripping the LF if present, and not complaining when it is missing).

It seems like a pkt-line with binary data could easily end with 0x0a
(LF) and a receiver would strip it off even though that is a legitimate
byte in the binary stream. I don't think receivers should be trying to
determine if the pkt-line is binary or non-binary and never strip off
any 0x0a bytes at the end of a pkt-line.

The client code that relies on the pkt-line receiver is where the logic
should reside that figures out what to do with strings that end with LF.
The pkt-line receiver just parses the pkg-line length, reads the correct
number of bytes and passes them along for further processing.

What am I missing? What should be added to this documentation that gives
more detail on when/why/how a pkt-line would be determined to be
non-binary and the LF stripping would occur?

Cheers!
Dave

             reply	other threads:[~2021-04-28 22:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28 22:22 dwh [this message]
2021-04-29  0:12 ` pkt-line and LF terminated lines of data Ævar Arnfjörð Bjarmason
2021-04-29  2:08   ` brian m. carlson
2021-04-29  3:16 ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210428222219.GA982@localhost \
    --to=dwh@linuxprogrammer.org \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.