[6.0] 6527437cd Don't attempt to normalize .vcc file encoding, just take the bytes

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


commit 6527437cdfed7beac93ca34e5ab5f9346213e4d6
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 e60cca6e5..f307a1ce7 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 3e6b06108..da535a212 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