]> git.proxmox.com Git - mirror_ovs.git/commitdiff
cksum: Refine schema cksum validation
authorRodriguez Betancourt, Esteban <estebarb@hpe.com>
Fri, 15 Apr 2016 23:08:47 +0000 (23:08 +0000)
committerBen Pfaff <blp@ovn.org>
Fri, 22 Apr 2016 15:43:00 +0000 (08:43 -0700)
Calculates the cksum removing the cksum line using a more
strict regex than the used previously.
It fixes a problem when calculating the cksum of a schema that
has fields with the substring cksum (e.g.: a checksum column),
lines that the previous cksum calculation incorrectly removes
before running cksum.
Also, the tool calculate-schema-cksum is introduced. This tool
calculates the cksum of a schema file. It could be used in other
programs, instead of calculating the cksum in an eventually
different way than the expected by cksum-schema-check and other
tools.

Signed-off-by: Esteban Rodriguez Betancourt <estebarb@hpe.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Makefile.am
build-aux/calculate-schema-cksum [new file with mode: 0755]
build-aux/cksum-schema-check

index bd9ee005e90645941851da5bc4e9deef4e5ce756..69dbe3db6d57762da71e9b11ea82d80c57e8362d 100644 (file)
@@ -107,6 +107,7 @@ EXTRA_DIST = \
        boot.sh \
        build-aux/cccl \
        build-aux/cksum-schema-check \
+       build-aux/calculate-schema-cksum \
        build-aux/dist-docs \
        build-aux/sodepends.pl \
        build-aux/soexpand.pl \
diff --git a/build-aux/calculate-schema-cksum b/build-aux/calculate-schema-cksum
new file mode 100755 (executable)
index 0000000..4ce9bf8
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+schema=$1
+sed '/"cksum": *"[0-9][0-9]* [0-9][0-9]*",/d' $schema | cksum
index 0fe37e4af440f030c5614e9a8990afa6a46c04a0..335e6456a88016c3557d8b543271d80f454a5de8 100755 (executable)
@@ -3,7 +3,8 @@
 schema=$1
 stamp=$2
 
-sum=`sed '/cksum/d' $schema | cksum`
+cksumcheckpath=`dirname $0`
+sum=`$cksumcheckpath/calculate-schema-cksum $schema`
 expected=`sed -n 's/.*"cksum": "\(.*\)".*/\1/p' $schema`
 if test "X$sum" = "X$expected"; then
     touch $stamp