[6.0] 2061c2c49 Fix vmodtool with python3

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:11 UTC 2018


commit 2061c2c492b5b7100bd48ac76742c7950c0dd407
Author: Bernhard M. Wiedemann <bwiedemann at suse.de>
Date:   Mon Sep 3 11:58:14 2018 +0200

    Fix vmodtool with python3
    
    Without this patch, it did
    TypeError: Unicode-objects must be encoded before hashing
    
    Fixes: #2436

diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index 673b53102..e60cca6e5 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -859,7 +859,7 @@ class vcc(object):
     def parse(self):
         global inputline
         a = "\n" + open(self.inputfile, "r").read()
-        self.file_id = hashlib.sha256(a).hexdigest()
+        self.file_id = hashlib.sha256(a.encode('utf-8')).hexdigest()
         s = a.split("\n$")
         self.copyright = s.pop(0).strip()
         while s:


More information about the varnish-commit mailing list