[master] 7a0f2cf7e Back down a little bit on UTF-8 in .vcc files.

Poul-Henning Kamp phk at FreeBSD.org
Mon Sep 10 11:40:15 UTC 2018


commit 7a0f2cf7e208035090b5f8ddb98a91e3681d11f6
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 10 11:38:52 2018 +0000

    Back down a little bit on UTF-8 in .vcc files.
    
    Not ready to tackle the Python2/Python3 monster a week before release.

diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index 7a4e362fc..25b8cc621 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -858,8 +858,9 @@ class vcc(object):
 
     def parse(self):
         global inputline
-        a = "\n" + open(self.inputfile, "r").read()
-        self.file_id = hashlib.sha256(bytearray(a)).hexdigest()
+        b = open(self.inputfile, "rb").read()
+        a = "\n" + b.decode("utf-8")
+        self.file_id = hashlib.sha256(b).hexdigest()
         s = a.split("\n$")
         self.copyright = s.pop(0).strip()
         while s:
diff --git a/lib/libvmod_debug/vmod.vcc b/lib/libvmod_debug/vmod.vcc
index 200b69de2..fecf9b150 100644
--- a/lib/libvmod_debug/vmod.vcc
+++ b/lib/libvmod_debug/vmod.vcc
@@ -25,7 +25,6 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# Test vmodtool.py's UTF-8 handling: Æbleflæsk med koldskål eller øl
 
 $Module debug 3 Development, test and debug
 $ABI strict


More information about the varnish-commit mailing list