Bug 1217917

Summary: nodejs: reproducible builds v8_snapshot_blob_data
Product: [openSUSE] openSUSE Tumbleweed Reporter: Bernhard Wiedemann <bwiedemann>
Component: OtherAssignee: Adam Majer <amajer>
Status: IN_PROGRESS --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None    
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: All   
URL: https://github.com/nodejs/build/issues/3043
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Bernhard Wiedemann 2023-12-10 07:49:57 UTC
While working on reproducible builds for ALP+openSUSE, I found that
our nodejs20 package varies between builds.

https://rb.zq1.de/compare.factory-20231209/diffs/nodejs20-compare.out
shows the diff output from build-compare.


I found in the buildroot, it comes from
--- /home/abuild/rpmbuild/BUILD/node-v20.8.1/out/Release/obj/gen/node_snapshot.cc   2023-12-04 09:44:53.133333331 +0100
+++ /home/abuild/rpmbuild/BUILD/node-v20.8.1/out/Release/obj/gen/node_snapshot.cc  2025-01-09 00:03:19.749999998 +0100
@@ -6,7 +6,7 @@
 // This file is generated by tools/snapshot. Do not edit.

 namespace node {
-static const char *v8_snapshot_blob_data = "\004\000\000\000\001\000\000\000l>\310\31711.3.244.8-node.16\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
+static const char *v8_snapshot_blob_data = "\004\000\000\000\001\000\000\000\253\077\212(11.3.244.8-node.16\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"


Strace showed that it is written by 
["/home/abuild/rpmbuild/BUILD/node-v20.8.1/out/Release/node_mksnapshot", "/home/abuild/rpmbuild/BUILD/node-v20.8.1/out/Release/obj/gen/node_snapshot.cc"]

Interestingly, this is called 3 times. Once in %build %install and %check
Maybe unrelated.
Comment 1 Bernhard Wiedemann 2023-12-10 08:28:12 UTC
Reproducer (in build env):

for i in $(seq 3) ; do
  /home/abuild/rpmbuild/BUILD/node-v20.8.1/out/Release/node_mksnapshot /tmp/x | md5sum /tmp/x
done | sort -u | wc -l

currently produces 3, but should give 1
Comment 2 Bernhard Wiedemann 2023-12-10 08:36:57 UTC
oops, I meant

for i in $(seq 3) ; do
  /home/abuild/rpmbuild/BUILD/node-v20.8.1/out/Release/node_mksnapshot /tmp/x
  md5sum /tmp/x
done | sort -u | wc -l
Comment 3 Adam Majer 2023-12-11 11:40:13 UTC
There are more issues here than just the first line. I separate it here.

> 9c9
> < static const char *v8_snapshot_blob_data = "\004\000\000\000\001\000\000\000\337MM\241\240\025\365\25711.8.172.17-node.17\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
> ---
> > static const char *v8_snapshot_blob_data = "\004\000\000\000\001\000\000\000\343M\255\003\240\025\365\25711.8.172.17-node.17\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"



> 6168c6168
> < "t.js\000\001\014Qa\003\000\000\000\006\000\000\000out.cc\000\000\003\204\001\020Mb\000\000\000\000\002\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\026\000\000\000\001\020Mb\000\000\000\000\002"
> ---
> > "t.js\000\001\014Qa\003\000\000\000\007\000\000\000out3.cc\000\003\204\001\020Mb\000\000\000\000\002\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\026\000\000\000\001\020Mb\000\000\000\000\002"



> 15132c15132
> < "\203D\027\027\027\001\014\220D`\000\000\000\000\000\000\000\000EF`\000\000\000\000\0019\000\000\207D\005Y\013H`\000\000\000\000\000\015\000\000\204D\010)'a\000\000\000\000\271\011\000\000\000\000\000\000\004I"
> ---
> > "\203D\027\027\027\001\014\220D`\000\000\000\000\000\000\000\000EF`\000\000\000\000\0019\000\000\207D\005Y\013H`\000\000\000\000\000\015\000\000\204D\010)'a\000\000\000\000\376\012\000\000\000\000\000\000\004I"



> 17880c17880
> < "\001`\000\000\000\000(\000\000\000\0138D`0\274q\372fU\000\000DGDGb\000\000\000\000\000\000\000\000\220\315q\372fU\000\000@-\314\370fU\000\000D\001\034\003`\200]\005\235\010\004\000\202"
> ---
> > "\001`\000\000\000\000(\000\000\000\0138D`0\374\255a\241U\000\000DGDGb\000\000\000\000\000\000\000\000\220\015\256a\241U\000\000@-\014`\241U\000\000D\001\034\003`\200]\005\235\010\004\000\202"



> 23167c23167
> < "\016\000\025\001\000\010\005\000\000\025\001\004`\005\272\272\272\272\272\272\272\030\000\000\000\000\000\000\0006\000\000\000\000\000\000\000\000\001\014\000\010\006\000\000\001\014\004@\006\247oV\005\000\000\000\020\000\000\000\000\000\000"
> ---
> > "\016\000\025\001\000\010\005\000\000\025\001\004`\005\272\272\272\272\272\272\272\030\000\000\000\000\000\000\0006\000\000\000\000\000\000\000\000\001\014\000\010\006\000\000\001\014\004@\006\032\026Z\005\000\000\000\020\000\000\000\000\000\000"



> 23170c23170
> < "\000\000\000\000\000\0005i\000\010\004\000\0005i\004@\004\036\033\254cU\000\000\020\000\000\000\000\000\000\000\000=i\000\010\007\000\000=i\004@\007\021\033\254cU\000\000\020\000\000\000\000\000\000\000\012\011\011"
> ---
> > "\000\000\000\000\000\0005i\000\010\004\000\0005i\004@\004\343\246;\244U\000\000\020\000\000\000\000\000\000\000\000=i\000\010\007\000\000=i\004@\007\342\246;\244U\000\000\020\000\000\000\000\000\000\000\012\011\011"
Comment 4 Adam Majer 2023-12-11 12:59:51 UTC
Looks like this is currently in progress upstream

https://github.com/nodejs/build/issues/3043
Comment 5 Bernhard Wiedemann 2023-12-12 03:29:37 UTC
A good find, indeed. Their
https://ci.nodejs.org/job/reproducibility-test/35/artifact/snapshot.cc-diff.log
looks very much like our diff.