[6.0] 9f6cae739 Make the vmod->file_id a hash over the .vcc file.
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:11 UTC 2018
commit 9f6cae73952dfbf2e6f185be208416af8eaea174
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Sep 3 06:52:32 2018 +0000
Make the vmod->file_id a hash over the .vcc file.
I belive this makes our builds reproducible.
Fixes: #2436
Conflicts:
include/vrt.h
diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index 669450fb7..673b53102 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -44,6 +44,7 @@ import unittest
import random
import copy
import json
+import hashlib
AMBOILERPLATE = '''
# Boilerplate generated by vmodtool.py - changes will be overwritten
@@ -858,6 +859,7 @@ class vcc(object):
def parse(self):
global inputline
a = "\n" + open(self.inputfile, "r").read()
+ self.file_id = hashlib.sha256(a).hexdigest()
s = a.split("\n$")
self.copyright = s.pop(0).strip()
while s:
@@ -983,14 +985,7 @@ class vcc(object):
fo.write('\t.proto =\tVmod_Proto,\n')
fo.write('\t.json =\t\tVmod_Json,\n')
fo.write('\t.abi =\t\tVMOD_ABI_Version,\n')
- # NB: Sort of hackish:
- # Fill file_id with random stuff, so we can tell if
- # VCC and VRT_Vmod_Init() dlopens the same file
- #
- fo.write("\t.file_id =\t\"")
- for i in range(32):
- fo.write("%c" % random.randint(0x40, 0x5a))
- fo.write("\",\n")
+ fo.write("\t.file_id =\t\"%s\",\n" % self.file_id)
fo.write("};\n")
def cfile(self):
More information about the varnish-commit
mailing list