Hi!

I'm trying to package keepass.

When I run `guix build --rounds=2` though, it fails with "guix build: error: derivation|/gnu/store/m99ws3k0wkh3rzdxz4d57mjmdpglv7id-keepass-2.57.1.drv' may not be deterministic: output |/gnu/store/8d2fyvp8vgkmfr3d17gzjyf4281b1czx-keepass-2.57.1' differs".

There surely is some change:

```plaintext
(bash) $ diffoscope /gnu/store/*keepass-2.57.1
2025-06-09 02:13:08 W: diffoscope.comparators.xml: Vulnerable version of pyexpat detected; disabling comparison of XML documents. Install defusedxml or upgrade your pyexpat.
--- /gnu/store/1bwmk7da99jmwmm6pz9is6apfhpbx7sx-keepass-2.57.1
+++ /gnu/store/8d2fyvp8vgkmfr3d17gzjyf4281b1czx-keepass-2.57.1
│   --- /gnu/store/1bwmk7da99jmwmm6pz9is6apfhpbx7sx-keepass-2.57.1/bin
├── +++ /gnu/store/8d2fyvp8vgkmfr3d17gzjyf4281b1czx-keepass-2.57.1/bin
│ │   --- /gnu/store/1bwmk7da99jmwmm6pz9is6apfhpbx7sx-keepass-2.57.1/bin/keepass │ ├── +++ /gnu/store/8d2fyvp8vgkmfr3d17gzjyf4281b1czx-keepass-2.57.1/bin/keepass
│ │ @@ -1,2 +1,2 @@
│ │ +#!/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/sh │ │ +exec "/gnu/store/1kq77x1xx3506q92fq88vplxcpwjr6zi-mono-6.12.0.206"/bin/mono "/gnu/store/8d2fyvp8vgkmfr3d17gzjyf4281b1czx-keepass-2.57.1"/lib/keepass/KeePass.exe "$@" │ │ -#!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh │ │ -exec "/gnu/store/fyx3xh348p7cj220x5wicpygbnj9dj4q-mono-6.12.0.206"/bin/mono "/gnu/store/1bwmk7da99jmwmm6pz9is6apfhpbx7sx-keepass-2.57.1"/lib/keepass/KeePass.exe "$@"
│   --- /gnu/store/1bwmk7da99jmwmm6pz9is6apfhpbx7sx-keepass-2.57.1/lib
├── +++ /gnu/store/8d2fyvp8vgkmfr3d17gzjyf4281b1czx-keepass-2.57.1/lib
│ │   --- /gnu/store/1bwmk7da99jmwmm6pz9is6apfhpbx7sx-keepass-2.57.1/lib/keepass │ ├── +++ /gnu/store/8d2fyvp8vgkmfr3d17gzjyf4281b1czx-keepass-2.57.1/lib/keepass │ │ │   --- /gnu/store/1bwmk7da99jmwmm6pz9is6apfhpbx7sx-keepass-2.57.1/lib/keepass/KeePass.exe │ │ ├── +++ /gnu/store/8d2fyvp8vgkmfr3d17gzjyf4281b1czx-keepass-2.57.1/lib/keepass/KeePass.exe │ │ │┄ Format-specific differences are supported for Mono 'Portable Executable' files but no file-specific differences were detected; falling back to a binary diff. file(1) reports: PE32 executable (GUI) Intel 80386 Mono/.Net assembly, for MS Windows, 4 sections
│ │ │ @@ -163703,15 +163703,15 @@
│ │ │  0027f760: 3200 c31a d048 3200 c41a e048 3200 c51a 2....H2....H2...
│ │ │  0027f770: f048 3200 c61a 0049 3200 c71a 1049 3200 .H2....I2....I2.
│ │ │  0027f780: c81a 2049 3200 c91a 3049 3200 ca1a 4049  .. I2...0I2...@I
│ │ │  0027f790: 3200 cb1a 4849 3200 cc1a 5849 3200 cd1a 2...HI2...XI2...
│ │ │  0027f7a0: 7049 3200 ce1a 7849 3200 cf1a 8049 3200 pI2...xI2....I2.
│ │ │  0027f7b0: d01a 8849 3200 d11a b849 3200 d21a d049 ...I2....I2....I
│ │ │  0027f7c0: 3200 d31a e049 3200 d41a 0480 0000 0200 2....I2.........
│ │ │ -0027f7d0: 3900 0100 6916 0000 0000 0000 0000 ca27 9...i..........'
│ │ │ +0027f7d0: 3900 0100 fd09 0000 0000 0000 0000 ca27 9..............'
│ │ │  0027f7e0: 0000 0000 0000 0400 0000 0000 0000 0000 ................
│ │ │  0027f7f0: 0000 da6b 0100 1775 0400 0000 0000 0000 ...k...u........
│ │ │  0027f800: 0000 0400 0000 0000 0000 0000 0000 da6b ...............k
│ │ │  0027f810: 0100 4a31 0000 0000 0000 0000 0000 0400 ..J1............
│ │ │  0027f820: 0000 0000 0000 0000 0000 e36b 0100 163e ...........k...>
│ │ │  0027f830: 0000 0000 0000 0000 0000 0400 0000 0000 ................
│ │ │  0027f840: 0000 0000 0000 da6b 0100 9b5a 0000 0000 .......k...Z....
│ │ │ @@ -170578,17 +170578,17 @@
│ │ │  0029a510: 7373 656d 626c 7951 7561 6c69 6669 6564 ssemblyQualified
│ │ │  0029a520: 4e61 6d65 0073 7472 436c 6173 7300 4765 Name.strClass.Ge
│ │ │  0029a530: 7456 616c 7565 0053 7472 696e 6754 6f43 tValue.StringToC
│ │ │  0029a540: 6f54 6173 6b4d 656d 416e 7369 0053 697a oTaskMemAnsi.Siz
│ │ │  0029a550: 654f 6600 5374 7275 6374 7572 6554 6f50 eOf.StructureToP
│ │ │  0029a560: 7472 0067 6372 795f 6368 6563 6b5f 7665 tr.gcry_check_ve
│ │ │  0029a570: 7273 696f 6e00 2f67 6e75 2f73 746f 7265 rsion./gnu/store
│ │ │ -0029a580: 2f6d 737a 6e71 6670 6c73 6163 6871 7278 /msznqfplsachqrx
│ │ │ -0029a590: 6e68 3038 7771 3278 646a 7178 3878 3139 nh08wq2xdjqx8x19
│ │ │ -0029a5a0: 722d 6c69 6267 6372 7970 742d 312e 3131 r-libgcrypt-1.11
│ │ │ +0029a580: 2f76 6c35 3731 7132 386b 666c 6c62 7034 /vl571q28kfllbp4
│ │ │ +0029a590: 3273 7132 706e 6137 6466 676c 727a 766a 2sq2pna7dfglrzvj
│ │ │ +0029a5a0: 372d 6c69 6267 6372 7970 742d 312e 3131 7-libgcrypt-1.11
│ │ │  0029a5b0: 2e30 2f6c 6962 2f6c 6962 6763 7279 7074 .0/lib/libgcrypt
│ │ │  0029a5c0: 2e73 6f2e 3230 006c 7052 6571 5665 7273 .so.20.lpReqVers
│ │ │  0029a5d0: 696f 6e00 6763 7279 5f63 6970 6865 725f ion.gcry_cipher_
│ │ │  0029a5e0: 6f70 656e 0070 6800 6e41 6c67 6f00 6e4d open.ph.nAlgo.nM
│ │ │  0029a5f0: 6f64 6500 7546 6c61 6773 0067 6372 795f ode.uFlags.gcry_
│ │ │  0029a600: 6369 7068 6572 5f63 6c6f 7365 0067 6372 cipher_close.gcr
│ │ │  0029a610: 795f 6369 7068 6572 5f73 6574 6b65 7900 y_cipher_setkey.
│ │ │ @@ -199053,16 +199053,16 @@
│ │ │  003098c0: 6500 4300 6800 6900 6c00 6400 7200 6500 e.C.h.i.l.d.r.e.
│ │ │  003098d0: 6e00 5300 6f00 7200 7400 4f00 7200 6400 n.S.o.r.t.O.r.d.
│ │ │  003098e0: 6500 7200 000b 4f00 7400 6800 6500 7200 e.r...O.t.h.e.r.
│ │ │  003098f0: 0009 5400 6800 6900 7300 0021 6600 6e00 ..T.h.i.s..!f.n.
│ │ │  00309900: 4700 6500 7400 4e00 6f00 6400 6500 4f00 G.e.t.N.o.d.e.O.
│ │ │  00309910: 7000 7400 6900 6f00 6e00 7300 0019 6600 p.t.i.o.n.s...f.
│ │ │  00309920: 6e00 4700 6500 7400 4e00 6f00 6400 6500 n.G.e.t.N.o.d.e.
│ │ │ -00309930: 4b00 6500 7900 0000 d8cb de61 dae4 fd4c K.e.y......a...L
│ │ │ -00309940: b06d 5f50 3800 d7f2 0002 0608 0206 0502 .m_P8...........
│ │ │ +00309930: 4b00 6500 7900 0000 3a28 7e04 8b91 1945 K.e.y...:(~....E
│ │ │ +00309940: 9d92 10ad 4b6e 32d6 0002 0608 0206 0502 ....Kn2.........
│ │ │  00309950: 060b 0206 0a02 0609 0306 1108 0206 0e02 ................
│ │ │  00309960: 0602 0706 1512 0501 120c 0906 1512 0902 ................
│ │ │  00309970: 0e12 8238 0906 1512 0d02 0812 8238 0906 ...8.........8..
│ │ │  00309980: 1512 0902 0e12 8240 0706 1512 0501 1300 .......@........
│ │ │  00309990: 0b06 1512 0902 1282 2012 8140 0906 1512 ........ ..@....
│ │ │  003099a0: 0d02 1282 200b 0906 1512 0d02 0b12 8140  .... ..........@
│ │ │  003099b0: 0306 1111 0306 1228 0706 1512 0902 0e0e .......(........
│ │ │ @@ -199479,19 +199479,19 @@
│ │ │  0030b360: 83c5 0420 0102 0e04 0612 82ad 0406 128c  ... ............
│ │ │  0030b370: 9806 2001 0111 83c9 0520 0012 8081 0520  .. ...... .....
│ │ │  0030b380: 0012 83cd 0404 0100 0008 ffff ffff ffff ................
│ │ │  0030b390: ffff 0400 0020 0001 0206 0003 080e 0e02  ..... ..........
│ │ │  0030b3a0: 0400 010e 1807 0003 124d 0e02 0204 2001 .........M.... .
│ │ │  0030b3b0: 1c1c 0400 0118 0e04 0001 081c 0600 0301 ................
│ │ │  0030b3c0: 1c18 0280 a02f 0067 006e 0075 002f 0073 ...../.g.n.u./.s
│ │ │ -0030b3d0: 0074 006f 0072 0065 002f 006d 0073 007a .t.o.r.e./.m.s.z
│ │ │ -0030b3e0: 006e 0071 0066 0070 006c 0073 0061 0063 .n.q.f.p.l.s.a.c
│ │ │ -0030b3f0: 0068 0071 0072 0078 006e 0068 0030 0038 .h.q.r.x.n.h.0.8
│ │ │ -0030b400: 0077 0071 0032 0078 0064 006a 0071 0078 .w.q.2.x.d.j.q.x
│ │ │ -0030b410: 0038 0078 0031 0039 0072 002d 006c 0069 .8.x.1.9.r.-.l.i
│ │ │ +0030b3d0: 0074 006f 0072 0065 002f 0076 006c 0035 .t.o.r.e./.v.l.5
│ │ │ +0030b3e0: 0037 0031 0071 0032 0038 006b 0066 006c .7.1.q.2.8.k.f.l
│ │ │ +0030b3f0: 006c 0062 0070 0034 0032 0073 0071 0032 .l.b.p.4.2.s.q.2
│ │ │ +0030b400: 0070 006e 0061 0037 0064 0066 0067 006c .p.n.a.7.d.f.g.l
│ │ │ +0030b410: 0072 007a 0076 006a 0037 002d 006c 0069 .r.z.v.j.7.-.l.i
│ │ │  0030b420: 0062 0067 0063 0072 0079 0070 0074 002d .b.g.c.r.y.p.t.-
│ │ │  0030b430: 0031 002e 0031 0031 002e 0030 002f 006c .1...1.1...0./.l
│ │ │  0030b440: 0069 0062 002f 006c 0069 0062 0067 0063 .i.b./.l.i.b.g.c
│ │ │  0030b450: 0072 0079 0070 0074 002e 0073 006f 002e .r.y.p.t...s.o..
│ │ │  0030b460: 0032 0030 0004 0900 0000 0920 0212 8195 .2.0....... ....
│ │ │  0030b470: 0e11 8395 0900 0202 1281 9512 8195 0720 ...............
│ │ │  0030b480: 0301 1c1c 1d1c 0920 0212 81b1 0e1d 124d ....... .......M
```

My package definition is:

```scheme
(define-public keepass
  (package
    (name "keepass")
    (version "2.57.1")
    (source
     (origin
       (method url-fetch)
       (uri
        (string-append "mirror://sourceforge/keepass/KeePass%202.x/" version
         "/KeePass-" version "-Source.zip"))
       (sha256 (base32 "11i9h0pbvbmz3a6wkp97qhrc8r4l5a2iwxw6vl0zwcp19ka5gdpp"))))
    (build-system gnu-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'unpack
           (lambda* (#:key source #:allow-other-keys)
             (mkdir "source")
             (chdir "source")
             (invoke "unzip" source)))
         (replace 'configure
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* "KeePassLib/Native/NativeMethods.Unix.cs"
              (("libgcrypt.so.20" all)
               (string-append (assoc-ref inputs "libgcrypt") "/lib/" all))
              (("libglib-2.0.so.0" all)
               (string-append (assoc-ref inputs "glib") "/lib/" all))
              (("libgtk-3.so.0" all)
               (string-append (assoc-ref inputs "gtk+") "/lib/" all)))
             (substitute* "KeePass.sln"
(("GlobalSection\\(ExtensibilityGlobals\\).*?EndGlobalSection")
                "")
(("GlobalSection\\(ExtensibilityGlobals\\).*?EndGlobalSection"
                 all)
                "")
               (("Format Version 10\\.0")
                "Format Version 11.00"))
             (substitute* "KeePass/KeePass.csproj"
               ((" ToolsVersion=\\\"3\\.5\\\"")
                " ToolsVersion=\"4.0\"")
(("<SignAssembly>true</SignAssembly>")
"<SignAssembly>false</SignAssembly>")
               ;; XML Serializer AOT compiler doesn't work here.
               ;; mono will just fall back to the runtime compiler.
               (("[$][(]FrameworkSDKDir[)]bin.sgen[.]exe")
                "echo")
(("<TargetFrameworkVersion>v4\\.8</TargetFrameworkVersion>")
"<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>"))
             (copy-file
              "Ext/Icons_15_VA/LowResIcons/KeePass_LR.ico"
              "KeePass/KeePass.ico")
             (copy-file
              "Ext/Icons_15_VA/LowResIcons/KeePass_LR.ico"
              "KeePass/IconsKeePass.ico")
             (copy-file
              "Ext/Icons_15_VA/LowResIcons/KeePass_LR_G.ico"
              "KeePass/IconsKeePass_G.ico")
             (copy-file
              "Ext/Icons_15_VA/LowResIcons/KeePass_LR_R.ico"
              "KeePass/IconsKeePass_R.ico")
             (copy-file
              "Ext/Icons_15_VA/LowResIcons/KeePass_LR_Y.ico"
              "KeePass/IconsKeePass_Y.ico")
             (substitute* "KeePassLib/KeePassLib.csproj"
               ((" ToolsVersion=\\\"3\\.5\\\"")
                " ToolsVersion=\"4.0\"")
(("<SignAssembly>true</SignAssembly>")
"<SignAssembly>false</SignAssembly>"))
             (substitute* "Translation/TrlUtil/TrlUtil.csproj"
               ((" ToolsVersion=\\\"3\\.5\\\"") " ToolsVersion=\"4.0\""))
             (copy-file
              "Ext/Icons_15_VA/LowResIcons/KeePass_LR.ico"
              "KeePass/Resources/KeePass.ico")))
         (delete 'patch-source)
         (replace 'build
           (lambda* (#:key outputs #:allow-other-keys)
             (setenv "MONO_REGISTRY_PATH" "/dev/null")
             (setenv "LANG" "C")
             (setenv "LC_ALL" "C")
             (invoke
              "xbuild"
              "/target:KeePass"
              "/property:Configuration=Release"
              "/property:CscToolExe=mcs"
              "/verbosity:diagnostic")))
         (replace 'install
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (script (string-append out "/bin/keepass"))
                    (mono (assoc-ref inputs "mono"))
                    (lib (string-append out "/lib/keepass")))
               (install-file "KeePass/obj/Release/KeePass.exe" lib)
               (install-file "Ext/KeePass.config.xml" lib)
               (mkdir (string-append out "/bin"))
               (call-with-output-file script
                   (lambda (port)
                     (format port "#!/bin/sh
exec ~s/bin/mono ~s/lib/keepass/KeePass.exe \"$@\"
"
                             mono out)))
               (chmod script #o755)
               (patch-shebang script)))))
       #:tests? #f)) ;no tests
    (native-inputs (list unzip icoutils))
    (inputs (list mono-6.12.0 libgdiplus libgcrypt glib gtk+))
    (home-page "https://keepass.info/";)
    (synopsis
     "Light-weight and easy-to-use password manager")
    (description
     "KeePass is a light-weight and easy-to-use password manager that helps
you manage your passwords in a secure way.  All passwords are stored
in an encrypted database, which is locked with a master key or key file.")
    (license license:gpl2)))
```

The package definition requires https://codeberg.org/guix/guix/pulls/374 to be merged first. It is pending on my submission of keepass though, as that's needed to test that MR.

A don't have experience in that kind of issue yet:
Does someone know how to tackle this?

Thanks
nomike



Reply via email to