[libvirt] [PATCH v1] rpc: reproducible genprotocol output

Olaf Hering posted 1 patch 5 years, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20181010091537.2329-1-olaf@aepfle.de
Test syntax-check passed
src/rpc/genprotocol.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH v1] rpc: reproducible genprotocol output
Posted by Olaf Hering 5 years, 5 months ago
If the same source gets built twice ('build same source on different
hosts at different times') the resulting files may differ.
Fix this by sorting the hash keys before usage.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 src/rpc/genprotocol.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl
index 6ce268c024..6baa4f22d5 100755
--- a/src/rpc/genprotocol.pl
+++ b/src/rpc/genprotocol.pl
@@ -104,7 +104,7 @@ while (<RPCGEN>) {
         if (keys %uses >= 1) {
             my $i = 1;
 
-            foreach (keys %uses) {
+            foreach (sort(keys %uses)) {
                 $i = $uses{$_};
                 unshift @function,
                 ("        char **objp_cpp$i = (char **) (void *) &$_;\n");

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v1] rpc: reproducible genprotocol output
Posted by Michal Privoznik 5 years, 5 months ago
On 10/10/2018 11:15 AM, Olaf Hering wrote:
> If the same source gets built twice ('build same source on different
> hosts at different times') the resulting files may differ.
> Fix this by sorting the hash keys before usage.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> ---
>  src/rpc/genprotocol.pl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

ACKed and pushed.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list