Skip to contentSkip to conversation

b4 prep and --manual-reroll

PATCH Dmitry Torokhov 3 participants 3 messages Nov 4, 2022

lore
Share & tools
lore
#0 lore raw

Hi Konstantin,

Somehow "b4 send -o dir" followed by "git send-email ..." managed to produce quoted-printable cover letter message (see
https://lore.kernel.org/all/[email protected]/)
and that confused "b4 prep --manual-reroll ..." as this produced a tag that had "=0D" as line ends. I was able to work around it with the patch below (not sure if this is right thing to do)...

Also, doing "b4 send --resend" with this series did produce double signature on the cover letter, even though I see in the code it tries to remove it.

Thanks.

Signature · 1 line
Dmitry
b4/ez.py +1 -1
index 4fcc988..8fb39d2 100644
@@ -1350,7 +1350,7 @@ def get_sent_tagname(branch: str, tagprefix: str, revstr: Union[str, int]) -> Tu
 def reroll(mybranch: str, cover_msg: email.message.Message, tagprefix: str = SENT_TAG_PREFIX):
     # Prepare annotated tag body from the cover letter
     lsubject = b4.LoreSubject(cover_msg.get('subject'))
-    cbody = cover_msg.get_payload()
+    cbody = cover_msg.get_payload(decode=True).decode()
     # Remove signature
     chunks = cbody.rsplit('\n-- \n')
     if len(chunks) > 1:
#1 lore raw
Quoted 8 lines · Dmitry Torokhov

Hi Konstantin,

Somehow "b4 send -o dir" followed by "git send-email ..." managed to produce quoted-printable cover letter message (see
https://lore.kernel.org/all/[email protected]/)
and that confused "b4 prep --manual-reroll ..." as this produced a tag that had "=0D" as line ends. I was able to work around it with the patch below (not sure if this is right thing to do)...

Ah, yes, quoted-printable is the bane of my existence. Thank you for reporting this. I think a better way forward is to get away from get_payload(), which is a legacy method that I kept around when we cared about python3.6 compatibility. I'll comb the codebase for a better solution.

Quoted 3 lines

Also, doing "b4 send --resend" with this series did produce double signature on the cover letter, even though I see in the code it tries to remove it.

I'll poke at it -- thanks for testing that out. I'm pretty sure you're the first person to actually use it. :)

-K

#2 lore raw
Quoted 11 lines · Konstantin Ryabitsev
Quoted 8 lines · Dmitry Torokhov

Hi Konstantin,

Somehow "b4 send -o dir" followed by "git send-email ..." managed to produce quoted-printable cover letter message (see
https://lore.kernel.org/all/[email protected]/)
and that confused "b4 prep --manual-reroll ..." as this produced a tag that had "=0D" as line ends. I was able to work around it with the patch below (not sure if this is right thing to do)...

Quoted 4 lines

Ah, yes, quoted-printable is the bane of my existence. Thank you for reporting this. I think a better way forward is to get away from get_payload(), which is a legacy method that I kept around when we cared about python3.6 compatibility. I'll comb the codebase for a better solution.

FWIW, this is what I use:

body = orig_msg.get_body(preferencelist='plain').get_content(errors='strict')

For sending replies, python prefers base64 if any encoding is needed, so I do this:

msg = email.message.EmailMessage(policy=email.policy.default) charset = orig_msg.get_content_charset()
if charset:
msg.set_content(body, charset=charset, cte='8bit')
else:
msg.set_content(body, charset='ascii', cte='7bit')

Rob