stefanha / git-publish

Prepare and store patch revisions as git tags
MIT License
133 stars 35 forks source link

Crash if cover letter has ~60 chars. #96

Closed ehabkost closed 4 years ago

ehabkost commented 4 years ago

The new word wrap logic seems to confuse git-send-email, if the cover letter subject line doesn't fit immediately after "Subject:", but fits completely in a separate line.

Steps to reproduce:

  1. Create cover letter with the following contents:
123456789 123456789 123456789 123456789 123456789 123456789

testing.
  1. Run git-publish. e.g.:
$ git publish -b master --to ehabkost@gmail.com
[...]
Stopping so you can inspect the patch emails:
  cd /tmp/tmplorrwjuo

[PATCH 0/1] 123456789 123456789 123456789 123456789 123456789 123456789
[PATCH 1/1] test

To: ehabkost@gmail.com

[c] Edit Cc list in editor (save after edit)
[t] Edit To list in editor (save after edit)
[e] Edit patches in editor
[s] Select patches to send (default: all)
[p] Print final email headers (dry run)
[a] Send all
[q] Cancel (quit)
p
/tmp/tmplorrwjuo/0000-cover-letter.patch
/tmp/tmplorrwjuo/0001-test.patch
Stopping so you can inspect the patch emails:
  cd /tmp/tmplorrwjuo

[PATCH 0/1] 123456789 123456789 123456789 123456789 123456789 123456789
[PATCH 1/1] test

To: ehabkost@gmail.com

[c] Edit Cc list in editor (save after edit)
[t] Edit To list in editor (save after edit)
[e] Edit patches in editor
[s] Select patches to send (default: all)
[p] Print final email headers (dry run)
[a] Send all
[q] Cancel (quit)
a
No subject line in /tmp/tmplorrwjuo/0000-cover-letter.patch? at /usr/libexec/git-core/git-send-email line 720.

This is how the Subject line is formatted by git-publish in that case:

From: Eduardo Habkost <ehabkost@redhat.com>
Date: Mon, 31 Aug 2020 17:00:32 -0400
Subject:     
 [PATCH 0/1] 123456789 123456789 123456789 123456789 123456789 123456789

testing.

Eduardo Habkost (1):
  test

 b | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 b

--·
2.26.2
ehabkost commented 4 years ago

For reference, this is the git-send-email version I have installed: git-email-2.26.2-1.fc32.noarch

stefano-garzarella commented 4 years ago

I reproduced it and bisected to c1bcca9 ("Fix Subject: line wrap").

It seems that email module is doing something that git-send-email doesn't like, also for encoding. (maybe because it does not expect an email)

I'll try to bring up the patch I did avoiding to use the email module, taking care long Subject: lines.