git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Christian Couder <christian.couder@gmail.com>
Cc: git@vger.kernel.org,
	Matthias Buehlmann <Matthias.Buehlmann@mabulous.com>
Subject: Re: Bug Report: Multi-line trailers containing empty lines break parsing
Date: Mon, 15 Feb 2021 18:29:55 -0800	[thread overview]
Message-ID: <xmqqczx0sq1o.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <CALz+XyW+XU++58eEYm5=jxTckK-VuuPoA-ecj4QCZw1o44JFUQ@mail.gmail.com> (Matthias Buehlmann's message of "Mon, 15 Feb 2021 22:54:52 +0100")

Matthias Buehlmann <Matthias.Buehlmann@mabulous.com> writes:

> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.

Thanks; let's ping our resident trailers expert ;-)

I somehow thought that a trailer is always a single-line thing,
without funky line-folding that we have to deal with when we are
dealing with e-mail headers.


> What did you do before the bug happened? (Steps to reproduce your issue)
>
>     create a file containing multiline trailer:
>
>     $ echo "Test" > test.txt
>     $ git interpret-trailers --where end --if-exists addIfDifferent
> --trailer "SingleLineTrailer: This is a single line trailer"
> --in-place test.txt
>     $ git interpret-trailers --where end --if-exists addIfDifferent
> --trailer "MultiLineTrailer: This is"$'\n a folded multi-line\n
> trailer' --in-place test.txt
>
>     parse trailers:
>
>     $ git interpret-trailers --parse test.txt
>     SingleLineTrailer: This is a single line trailer
>     MultiLineTrailer: This is a folded multi-line trailer
>
>     (so far, all is as expected)
>
>     now, adding multiline trailer containing empty line:
>
>     $ git interpret-trailers --where end --if-exists addIfDifferent
> --trailer "MultiLineTrailer: This is"$'\n a folded multi-line\n
> trailer which\n \n contains an\n empty line' --in-place test.txt
>
>     parse trailers again:
>
>     $ git interpret-trailers --parse test.txt
>
> What did you expect to happen? (Expected behavior)
>
> I would expect the following output:
>
>     $ git interpret-trailers --parse test.txt
>     SingleLineTrailer: This is a single line trailer
>     MultiLineTrailer: This is a folded multi-line trailer
>     MultiLineTrailer: This is a folded multi-line trailer which
> contains an empty line
>
> What happened instead? (Actual behavior)
>
>     no output is generated, but exit code is nevertheless 0:
>
>     $ git interpret-trailers --parse test.txt
>     $ echo $?
>     0
>
> What's different between what you expected and what actually happened?
>
>     I would expect either to get an output or the call to exit non-zero
>
> Anything else you want to add:
>
>     According to my interpretation of the documentation of git
> intepret-trailers, empty lines should be supported if properly folded,
> in the same way as for example the PGP signature added to the commit
> header contains a (properly folded) empty line
>
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.
>
>
> [System Info]
> git version:
> git version 2.30.0.windows.2
> cpu: x86_64
> built from commit: f8cbc844b81bf6b9e72178bbe891a86c8bf5e9e7
> sizeof-long: 4
> sizeof-size_t: 8
> shell-path: /bin/sh
> uname: Windows 10.0 18363
> compiler info: gnuc: 10.2
> libc info: no libc information available
> $SHELL (typically, interactive shell): C:\Program Files\Git\usr\bin\bash.exe
>
>
> [Enabled Hooks]
> post-commit

  reply	other threads:[~2021-02-16  2:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 21:54 Bug Report: Multi-line trailers containing empty lines break parsing Matthias Buehlmann
2021-02-16  2:29 ` Junio C Hamano [this message]
2021-02-16 18:07   ` Taylor Blau
2021-02-16 19:39     ` Junio C Hamano
2021-02-16 19:47       ` Taylor Blau
2021-03-23 15:17         ` Christian Couder
2021-03-23 17:39           ` Junio C Hamano
2021-03-25  7:53             ` Christian Couder
2021-03-25  9:33               ` ZheNing Hu
2021-03-25 18:16                 ` Junio C Hamano
2021-03-26 10:25                   ` ZheNing Hu
2021-03-25 18:08               ` 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=xmqqczx0sq1o.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=Matthias.Buehlmann@mabulous.com \
    --cc=christian.couder@gmail.com \
    --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.
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).