git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 0/3] Sideband-all demultiplexer fixes

From
Jiang Xin <worldhello.net@gmail.com>
Date
Dec 17, 2023, 14:41 UTC
Message-ID
<cover.1702823801.git.zhiyou.jx@alibaba-inc.com>
In-Reply-To
<cover.1696425168.git.zhiyou.jx@alibaba-inc.com>
From: Jiang Xin <zhiyou.jx@alibaba-inc.com>
# Changes since v3:
Change commit message and comments to make them clear for review.
# range-diff v3...v4
1:  e387088da2 ! 1:  ff4e5aff2a test-pkt-line: add option parser for unpack-sideband
    @@ Commit message
          * Use "test-tool pkt-line send-split-sideband" to generate sideband
            messages.
     
    -     * We can pipe these generated sideband messages to command "test-tool
    -       pkt-line unpack-sideband" to test packet_reader_read() function.
    +     * Pipe these generated sideband messages to command "test-tool pkt-line
    +       unpack-sideband" to test packet_reader_read() function.
     
         In order to make a complete test of the packet_reader_read() function,
         add option parser for command "test-tool pkt-line unpack-sideband".
     
    -    To remove newlines in sideband messages, we can use:
    +     * To remove newlines in sideband messages, we can use:
     
    -        $ test-tool pkt-line unpack-sideband --chomp-newline
    +            $ test-tool pkt-line unpack-sideband --chomp-newline
     
    -    To preserve newlines in sideband messages, we can use:
    +     * To preserve newlines in sideband messages, we can use:
     
    -        $ test-tool pkt-line unpack-sideband --no-chomp-newline
    +            $ test-tool pkt-line unpack-sideband --no-chomp-newline
     
    -    To parse sideband messages using "demultiplex_sideband()" inside the
    -    function "packet_reader_read()", we can use:
    +     * To parse sideband messages using "demultiplex_sideband()" inside the
    +       function "packet_reader_read()", we can use:
     
    -        $ test-tool pkt-line unpack-sideband --reader-use-sideband
    +            $ test-tool pkt-line unpack-sideband --reader-use-sideband
     
    -    Add several new test cases in t0070. Among these test cases, we pipe
    +    We also add new example sideband packets in send_split_sideband() and
    +    add several new test cases in t0070. Among these test cases, we pipe
         output of the "send-split-sideband" subcommand to the "unpack-sideband"
         subcommand. We found two issues:
     
          1. The two splitted sideband messages "Hello," and " world!\n" should
    -        be concatenated together. But when we enabled the function
    -        "demultiplex_sideband()" to parse sideband messages, the first part
    -        of the splitted message ("Hello,") is lost.
    +        be concatenated together. But when we turn on use_sideband field of
    +        reader to parse sideband messages, the first part of the splitted
    +        message ("Hello,") is lost.
     
          2. The newline characters in sideband 2 (progress info) and sideband 3
    -        (error message) should be preserved, but they are also trimmed.
    +        (error message) should be preserved, but they are both trimmed.
     
         Will fix the above two issues in subsequent commits.
     
         Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
     
      ## t/helper/test-pkt-line.c ##
     @@
    @@ t/helper/test-pkt-line.c: static void unpack_sideband(void)
     +			/*
     +			 * When the "use_sideband" field of the reader is turned
     +			 * on, sideband packets other than the payload have been
    -+			 * parsed and consumed.
    ++			 * parsed and consumed in packet_reader_read(), and only
    ++			 * the payload arrives here.
     +			 */
     +			if (reader.use_sideband) {
     +				write_or_die(1, reader.line, reader.pktlen - 1);
    @@ t/helper/test-pkt-line.c: static void unpack_sideband(void)
      	packet_response_end(1);
      
     +	/*
    -+	 * The unpack_sideband() function above requires a flush
    -+	 * packet to end parsing.
    ++	 * We use unpack_sideband() to consume packets. A flush packet
    ++	 * is required to end parsing.
     +	 */
     +	packet_flush(1);
     +
    @@ t/t0070-fundamental.sh: test_expect_success 'missing sideband designator is repo
     +	test_cmp expect-err err
     +'
     +
    -+test_expect_failure 'unpack-sideband with demultiplex_sideband(), no chomp newline' '
    ++test_expect_failure 'unpack-sideband: packet_reader_read() consumes sideband, no chomp payload' '
     +	test_when_finished "rm -f expect-out expect-err" &&
     +	test-tool pkt-line send-split-sideband >split-sideband &&
     +	test-tool pkt-line unpack-sideband \
    @@ t/t0070-fundamental.sh: test_expect_success 'missing sideband designator is repo
     +	test_cmp expect-err err
     +'
     +
    -+test_expect_failure 'unpack-sideband with demultiplex_sideband(), chomp newline' '
    ++test_expect_failure 'unpack-sideband: packet_reader_read() consumes sideband, chomp payload' '
     +	test_when_finished "rm -f expect-out expect-err" &&
     +	test-tool pkt-line send-split-sideband >split-sideband &&
     +	test-tool pkt-line unpack-sideband \
2:  633bfbac39 ! 2:  5942b74cab pkt-line: memorize sideband fragment in reader
    @@ t/t0070-fundamental.sh: test_expect_success 'unpack-sideband: --chomp-newline (d
      	test_cmp expect-err err
      '
      
    --test_expect_failure 'unpack-sideband with demultiplex_sideband(), no chomp newline' '
    -+test_expect_success 'unpack-sideband with demultiplex_sideband(), no chomp newline' '
    +-test_expect_failure 'unpack-sideband: packet_reader_read() consumes sideband, no chomp payload' '
    ++test_expect_success 'unpack-sideband: packet_reader_read() consumes sideband, no chomp payload' '
      	test_when_finished "rm -f expect-out expect-err" &&
      	test-tool pkt-line send-split-sideband >split-sideband &&
      	test-tool pkt-line unpack-sideband \
3:  2a2da65fac ! 3:  dd2e34da16 pkt-line: do not chomp newlines for sideband messages
    @@ pkt-line.h: void packet_fflush(FILE *f);
      /*
     
      ## t/t0070-fundamental.sh ##
    -@@ t/t0070-fundamental.sh: test_expect_success 'unpack-sideband with demultiplex_sideband(), no chomp newli
    +@@ t/t0070-fundamental.sh: test_expect_success 'unpack-sideband: packet_reader_read() consumes sideband, no
      	test_cmp expect-err err
      '
      
    --test_expect_failure 'unpack-sideband with demultiplex_sideband(), chomp newline' '
    -+test_expect_success 'unpack-sideband with demultiplex_sideband(), chomp newline' '
    +-test_expect_failure 'unpack-sideband: packet_reader_read() consumes sideband, chomp payload' '
    ++test_expect_success 'unpack-sideband: packet_reader_read() consumes sideband, chomp payload' '
      	test_when_finished "rm -f expect-out expect-err" &&
      	test-tool pkt-line send-split-sideband >split-sideband &&
      	test-tool pkt-line unpack-sideband \
Jiang Xin (3):
  test-pkt-line: add option parser for unpack-sideband
  pkt-line: memorize sideband fragment in reader
  pkt-line: do not chomp newlines for sideband messages
 pkt-line.c               | 36 ++++++++++++++++++++----
 pkt-line.h               |  4 +++
 t/helper/test-pkt-line.c | 59 ++++++++++++++++++++++++++++++++++++----
 t/t0070-fundamental.sh   | 58 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 147 insertions(+), 10 deletions(-)
-- 
2.41.0.232.g2f6f0bca4f.agit.8.0.4.dev
Previous: Jiang XinNext: Jiang Xin
Message 16 of 19 in “pkt-line: do not chomp EOL for sideband progress info”
  1. pkt-line: do not chomp EOL for sideband progress infoJiang Xin, Sep 19, 2023
  2. Junio C HamanoSep 19, 2023
  3. Jonathan TanSep 20, 2023
  4. Jiang XinSep 25, 2023
  5. 1/3 test-pkt-line: add option parser for unpack-sidebandJiang Xin, Sep 25, 2023
  6. 2/3 pkt-line: memorize sideband fragment in readerJiang Xin, Sep 25, 2023
  7. 3/3 pkt-line: do not chomp newlines for sideband messagesJiang Xin, Sep 25, 2023
  8. Junio C HamanoSep 25, 2023
  9. Oswald BuddenhagenSep 26, 2023
  10. Jiang XinOct 4, 2023
  11. Junio C HamanoOct 4, 2023
  12. 0/3 Sideband demultiplexer fixesJiang Xin, Oct 4, 2023
  13. 2/3 pkt-line: memorize sideband fragment in readerJiang Xin, Oct 4, 2023
  14. 1/3 test-pkt-line: add option parser for unpack-sidebandJiang Xin, Oct 4, 2023
  15. 3/3 pkt-line: do not chomp newlines for sideband messagesJiang Xin, Oct 4, 2023
  16. 0/3 Sideband-all demultiplexer fixesJiang Xin, Dec 17, 2023
  17. 1/3 test-pkt-line: add option parser for unpack-sidebandJiang Xin, Dec 17, 2023
  18. 2/3 pkt-line: memorize sideband fragment in readerJiang Xin, Dec 17, 2023
  19. 3/3 pkt-line: do not chomp newlines for sideband messagesJiang Xin, Dec 17, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.