[6.0] 0dba1788b Back down a little bit on UTF-8 in .vcc files.

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


commit 0dba1788b8b4852776c87987c271c5f62d5b9383
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 f307a1ce7..ac54ceebd 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 da535a212..2b56f2e35 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