Message ID | Y2ScVwTlqH/zz36J@google.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | b4 prep and --manual-reroll | expand |
On Thu, Nov 03, 2022 at 10:00:07PM -0700, Dmitry Torokhov wrote: > 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/20221103-omapfb-gpiod-v1-0-c3d53ca7988f@gmail.com/) > 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. > 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
On Fri, Nov 4, 2022 at 12:14 PM Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote: > > On Thu, Nov 03, 2022 at 10:00:07PM -0700, Dmitry Torokhov wrote: > > 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/20221103-omapfb-gpiod-v1-0-c3d53ca7988f@gmail.com/) > > 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. 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
diff --git a/b4/ez.py b/b4/ez.py index 4fcc988..8fb39d2 100644 --- a/b4/ez.py +++ b/b4/ez.py @@ -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: