diff mbox series

[v2] protocol-v2.txt: align delim-pkt spec with usage

Message ID 20211111220048.1702896-1-calvinwan@google.com (mailing list archive)
State Accepted
Commit 59f42a7cfc8c0a8b259103b07e6035eeb7b5e98a
Headers show
Series [v2] protocol-v2.txt: align delim-pkt spec with usage | expand

Commit Message

Calvin Wan Nov. 11, 2021, 10 p.m. UTC
The current protocol EBNF allows command-request to end with the
capability list, if no command specific arguments follow, but the
protocol requires that after the capability list, there must be a
delim-pkt regardless of the number of command specific arguments.  Fixed
the EBNF to match. Both JGit and libgit2's implementation has the
delim-pkt as mandatory. JGit's code is not publicly linkable, but
libgit2 is linked below[1]. As for currently implemented commands on v2
(ls-ref and fetch), the delim packet is already being passed through

[1]: https://github.com/libgit2/libgit2/blob/main/src/transports/git.c

Reported-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Calvin Wan <calvinwan@google.com>
---
 Documentation/technical/protocol-v2.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


base-commit: e9e5ba39a78c8f5057262d49e261b42a8660d5b9

Comments

Nasser Grainawi Nov. 11, 2021, 10:09 p.m. UTC | #1
> On Nov 11, 2021, at 3:00 PM, Calvin Wan <calvinwan@google.com> wrote:
> 
> The current protocol EBNF allows command-request to end with the
> capability list, if no command specific arguments follow, but the
> protocol requires that after the capability list, there must be a
> delim-pkt regardless of the number of command specific arguments.  Fixed
> the EBNF to match. Both JGit and libgit2's implementation has the
> delim-pkt as mandatory. JGit's code is not publicly linkable, but

Why is JGit not linkable? Isn’t it https://git.eclipse.org/r/plugins/gitiles/jgit/jgit/+/refs/heads/master/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Parser.java ?
Junio C Hamano Nov. 11, 2021, 10:53 p.m. UTC | #2
Calvin Wan <calvinwan@google.com> writes:

> The current protocol EBNF allows command-request to end with the
> capability list, if no command specific arguments follow, but the
> protocol requires that after the capability list, there must be a
> delim-pkt regardless of the number of command specific arguments.  Fixed
> the EBNF to match. Both JGit and libgit2's implementation has the
> delim-pkt as mandatory. JGit's code is not publicly linkable, but
> libgit2 is linked below[1]. As for currently implemented commands on v2
> (ls-ref and fetch), the delim packet is already being passed through
>
> [1]: https://github.com/libgit2/libgit2/blob/main/src/transports/git.c

Thanks for an extra level of research. Very much appreciated.

Will queue.

>
> Reported-by: Ivan Frade <ifrade@google.com>
> Signed-off-by: Calvin Wan <calvinwan@google.com>
> ---
>  Documentation/technical/protocol-v2.txt | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/technical/protocol-v2.txt b/Documentation/technical/protocol-v2.txt
> index 21e8258ccf..8a877d27e2 100644
> --- a/Documentation/technical/protocol-v2.txt
> +++ b/Documentation/technical/protocol-v2.txt
> @@ -125,11 +125,11 @@ command can be requested at a time.
>      empty-request = flush-pkt
>      command-request = command
>  		      capability-list
> -		      [command-args]
> +		      delim-pkt
> +		      command-args
>  		      flush-pkt
>      command = PKT-LINE("command=" key LF)
> -    command-args = delim-pkt
> -		   *command-specific-arg
> +    command-args = *command-specific-arg
>  
>      command-specific-args are packet line framed arguments defined by
>      each individual command.
>
> base-commit: e9e5ba39a78c8f5057262d49e261b42a8660d5b9
diff mbox series

Patch

diff --git a/Documentation/technical/protocol-v2.txt b/Documentation/technical/protocol-v2.txt
index 21e8258ccf..8a877d27e2 100644
--- a/Documentation/technical/protocol-v2.txt
+++ b/Documentation/technical/protocol-v2.txt
@@ -125,11 +125,11 @@  command can be requested at a time.
     empty-request = flush-pkt
     command-request = command
 		      capability-list
-		      [command-args]
+		      delim-pkt
+		      command-args
 		      flush-pkt
     command = PKT-LINE("command=" key LF)
-    command-args = delim-pkt
-		   *command-specific-arg
+    command-args = *command-specific-arg
 
     command-specific-args are packet line framed arguments defined by
     each individual command.