[master] fe5584216 Don't attempt to normalize .vcc file encoding, just take the bytes

Poul-Henning Kamp phk at FreeBSD.org
Wed Sep 5 09:00:15 UTC 2018


commit fe558421628f17340fae6a0b1cca477f04d033b1
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Sep 5 08:58:10 2018 +0000

    Don't attempt to normalize .vcc file encoding, just take the bytes
    
    Fixes #2761

diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index 3032f380f..7a4e362fc 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.encode('utf-8')).hexdigest()
+        self.file_id = hashlib.sha256(bytearray(a)).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 0ab33501f..200b69de2 100644
--- a/lib/libvmod_debug/vmod.vcc
+++ b/lib/libvmod_debug/vmod.vcc
@@ -24,6 +24,8 @@
 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 # 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