Skip to content
Permalink
Browse files Browse the repository at this point in the history
Make the vmod->file_id a hash over the .vcc file.
I belive this makes our builds reproducible.

Fixes:	#2436
  • Loading branch information
bsdphk committed Sep 3, 2018
1 parent 61dc72e commit d6b3076
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/vrt.h
Expand Up @@ -59,7 +59,7 @@
* VRT_STRANDS_string() removed from vrt.h (never implemented)
* VRT_Healthy() changed prototype
* VRT_Vmod_Init signature changed
* VRT_Vmod_Fini changed to VRT_Vmod_Unload
* VRT_Vmod_Fini changed to VRT_Vmod_Unload
* 7.0 (2018-03-15)
* lots of stuff moved from cache.h to cache_varnishd.h
* (ie: from "$Abi vrt" to "$Abi strict")
Expand Down
11 changes: 3 additions & 8 deletions lib/libvcc/vmodtool.py
Expand Up @@ -44,6 +44,7 @@
import random
import copy
import json
import hashlib

AMBOILERPLATE = '''
# Boilerplate generated by vmodtool.py - changes will be overwritten
Expand Down Expand Up @@ -858,6 +859,7 @@ def commit(self):
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:
Expand Down Expand Up @@ -983,14 +985,7 @@ def vmod_data(self, fo):
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):
Expand Down

0 comments on commit d6b3076

Please sign in to comment.