[PATCH] dim: avoid early decode on email body.

Rodrigo Vivi rodrigo.vivi at intel.com
Mon Sep 14 18:28:50 UTC 2020


get_payload decode works different on python2 and python3.

python2's msg payload:
Hi, As we split pull request for 5.10 this time, here's gvt-next pull for 5.10. For gvt ww lock fix, Zhi would send another pull based on gem-next. This includes current command access flag cleanup for handlers which would be used for next refined cmd scan. And also two more recent fixes on workaround cmd access and MIA reset state. Thanks -- The following changes since commit ced026e959bec5046afa310d6474e147b6294da2: drm/i915: Update DRIVER_DATE to 20200824 (2020-08-24 14:26:38 -0400) are available in the Git repository at: https://github.com/intel/gvt-linux tags/gvt-next-2020-09-10 for you to fetch changes up to df398e33b8fd3ac28b3c7166de555e38d26e7391: drm/i915/gvt: Init vreg GUC_STATUS to GS_MIA_IN_RESET (2020-09-10 13:49:05 +0800) ---------------------------------------------------------------- gvt-next-2020-09-10 - Cleanup command access flag (Yan) - New workaround cmd access fix (Colin) - MIA reset state fix (Colin) ---------------------------------------------------------------- Colin Xu (2): drm/i915/gvt: Add F_CMD_ACCESS for some GEN9 SKU WA MMIO access drm/i915/gvt: Init vreg GUC_STATUS to GS_MIA_IN_RESET Yan Zhao (4): drm/i915/gvt: rename F_IN_CTX flag to F_SR_IN_CTX drm/i915/gvt: remove flag F_CMD_ACCESSED drm/i915/gvt: add/modify interfaces for flag F_CMD_ACCESS drm/i915/gvt: remove F_CMD_ACCESS flag for some registers drivers/gpu/drm/i915/gvt/cmd_parser.c | 6 ++--- drivers/gpu/drm/i915/gvt/gvt.h | 44 +++++++++++++++++++-------------- drivers/gpu/drm/i915/gvt/handlers.c | 32 +++++++++++++----------- drivers/gpu/drm/i915/gvt/mmio.c | 3 +++ drivers/gpu/drm/i915/gvt/mmio_context.c | 2 +- 5 files changed, 49 insertions(+), 38 deletions(-) -- $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

python3's msg payload:
b"\nHi,\n\nAs we split pull request for 5.10 this time, here's gvt-next pull\nfor 5.10. For gvt ww lock fix, Zhi would send another pull based\non gem-next.\n\nThis includes current command access flag cleanup for\nhandlers which would be used for next refined cmd scan. And also\ntwo more recent fixes on workaround cmd access and MIA reset state.\n\nThanks\n--\nThe following changes since commit ced026e959bec5046afa310d6474e147b6294da2:\n\n drm/i915: Update DRIVER_DATE to 20200824 (2020-08-24 14:26:38 -0400)\n\nare available in the Git repository at:\n\n https://github.com/intel/gvt-linux tags/gvt-next-2020-09-10\n\nfor you to fetch changes up to df398e33b8fd3ac28b3c7166de555e38d26e7391:\n\n drm/i915/gvt: Init vreg GUC_STATUS to GS_MIA_IN_RESET (2020-09-10 13:49:05 +0800)\n\n----------------------------------------------------------------\ngvt-next-2020-09-10\n\n- Cleanup command access flag (Yan)\n- New workaround cmd access fix (Colin)\n- MIA reset state fix (Colin)\n\n----------------------------------------------------------------\nColin Xu (2):\n drm/i915/gvt: Add F_CMD_ACCESS for some GEN9 SKU WA MMIO access\n drm/i915/gvt: Init vreg GUC_STATUS to GS_MIA_IN_RESET\n\nYan Zhao (4):\n drm/i915/gvt: rename F_IN_CTX flag to F_SR_IN_CTX\n drm/i915/gvt: remove flag F_CMD_ACCESSED\n drm/i915/gvt: add/modify interfaces for flag F_CMD_ACCESS\n drm/i915/gvt: remove F_CMD_ACCESS flag for some registers\n\n drivers/gpu/drm/i915/gvt/cmd_parser.c | 6 ++---\n drivers/gpu/drm/i915/gvt/gvt.h | 44 +++++++++++++++++++--------------\n drivers/gpu/drm/i915/gvt/handlers.c | 32 +++++++++++++-----------\n drivers/gpu/drm/i915/gvt/mmio.c | 3 +++\n drivers/gpu/drm/i915/gvt/mmio_context.c | 2 +-\n 5 files changed, 49 insertions(+), 38 deletions(-)\n\n-- \n\n$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827\n"

I couldn't find any option to change the decode behavior.
Replacing '\n' doesn't work with current sed in place and also it would differ
from python2 to python3.

But if we avoid decoding when getting the payload, the print will
equally decode and we have the same result.

Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
 dim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dim b/dim
index c3a048db8956..16bcf7d80b34 100755
--- a/dim
+++ b/dim
@@ -447,7 +447,7 @@ def print_msg(file):
     msg = email.message_from_file(file)
     for part in msg.walk():
         if part.get_content_type() == 'text/plain':
-            print(part.get_payload(decode=True))
+            print(part.get_payload())
 
 print_msg(open('$1', 'r'))
 EOF
-- 
2.26.2



More information about the dim-tools mailing list