Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miranda: init at 2.066 #100085

Merged
merged 1 commit into from Oct 11, 2020
Merged

miranda: init at 2.066 #100085

merged 1 commit into from Oct 11, 2020

Conversation

siraben
Copy link
Member

@siraben siraben commented Oct 9, 2020

Motivation for this change

Add miranda. It's not building ATM, hope to get more eyes on it.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@doronbehar
Copy link
Contributor

@GrahamcOfBorg eval

@siraben
Copy link
Member Author

siraben commented Oct 9, 2020

@doronbehar It compiles but when one tries to run the ./result/bin/mira executable it complains about not being able to find libraries.

pkgs/development/compilers/miranda/default.nix Outdated Show resolved Hide resolved
pkgs/development/compilers/miranda/default.nix Outdated Show resolved Hide resolved
pkgs/development/compilers/miranda/default.nix Outdated Show resolved Hide resolved
pkgs/development/compilers/miranda/default.nix Outdated Show resolved Hide resolved
pkgs/development/compilers/miranda/default.nix Outdated Show resolved Hide resolved
pkgs/development/compilers/miranda/default.nix Outdated Show resolved Hide resolved
@siraben siraben force-pushed the miranda-init branch 2 times, most recently from 8008242 to 60bedc3 Compare October 9, 2020 18:16
@siraben
Copy link
Member Author

siraben commented Oct 10, 2020

Build succeeds but I see a bunch of permission errors due to the way the Makefile is written. http://ix.io/2Agp

@siraben
Copy link
Member Author

siraben commented Oct 10, 2020

Result of running the mira executable.

$ ./result/bin/mira 
fatal error: miralib version 2.066 not found
found%                        

When I perform cd $(mktemp -d) && unpackPhase && genericBuild in a Nix shell, it runs fine. Not sure what could be causing the issue.

@jtojnar
Copy link
Contributor

jtojnar commented Oct 10, 2020

It probably finds miralib in $PWD. Look into steer.c and new/steer.c for /usr/lib/miralib, we will need to replace /usr by $out.

@jtojnar
Copy link
Contributor

jtojnar commented Oct 10, 2020

I created three patches here: https://github.com/jtojnar/miranda/commits/master and sent them to the e-mail address from the Miranda homepage.

@siraben
Copy link
Member Author

siraben commented Oct 10, 2020

I extracted the changes into a .patch file, but the build fails with

compiling ex/stack.m
checking types in ex/stack.m
compiling ex/topsort.m
checking types in ex/topsort.m
compiling ex/treesort.m
checking types in ex/treesort.m
mkdir -p /usr/bin /usr/lib /usr/share/man/man1
cp mira /usr/bin
cp: cannot create regular file '/usr/bin/mira': Operation not permitted
make: *** [Makefile:56: install] Error 1
builder for '/nix/store/5j89w3fwmx06sgyl8vyn9iwdwy1is084-miranda-2.066.drv' failed with exit code 2
error: build of '/nix/store/5j89w3fwmx06sgyl8vyn9iwdwy1is084-miranda-2.066.drv' failed

@jtojnar
Copy link
Contributor

jtojnar commented Oct 10, 2020

The patch uses different makeFlags ("PREFIX=${placeholder "out"}").

@siraben
Copy link
Member Author

siraben commented Oct 10, 2020

Thanks @jtojnar , the patches fixes the build.

@siraben
Copy link
Member Author

siraben commented Oct 10, 2020

Permission error when running mira executable

checking types in /nix/store/m177icpry4fmkcjmrdlapy163s33vwad-miranda-2.066/lib/miralib/stdenv.m
WARNING: CANNOT WRITE TO /nix/store/m177icpry4fmkcjmrdlapy163s33vwad-miranda-2.066/lib/miralib/stdenv.x
TO FIX THIS PROBLEM PLEASE GET SUPER-USER TO EXECUTE `mira'
new file script.m
for help type /h
Miranda 

@siraben
Copy link
Member Author

siraben commented Oct 10, 2020

Should the patch be adjusted to remove the call to chown?

@jtojnar
Copy link
Contributor

jtojnar commented Oct 10, 2020

The chown should not be an issue, the failure is just ignored. The issue is somewhere else.

If I apply https://github.com/jtojnar/miranda/commit/daf8abb8f30ec1cca21698e3fc355578b9f7c571.patch and then replace src with the path to directory extracted by tar -xzf $(nix-build -A miranda.src), it works without trying to rebuild the .x files at runtime.

Basically, if src is an extracted directory, instead of tarball to unpack in unpackPhase. fetchzip will work too:

fetchzip {
    url = "https://www.cs.kent.ac.uk/people/staff/dat/miranda/src/mira-${builtins.replaceStrings [ "." ] [ "" ] version}-src.tgz";
    sha256 = "KE/FTL9YW9l7VBAgkFZlqgSM1Bt/BXT6GkkONtyKJjQ=";
  }

The installed files differ slightly between those two sources and it makes no sense to me.

diffoscope output
--- /nix/store/wspaq7bgpvbszblwvm6sgksdgm8g9npm-miranda-2.066
+++ /nix/store/gpdq75fd12fchm0x7bf60p12drbnh9w7-miranda-2.066
├── bin
│ ├── mira
│ │ ├── readelf --wide --decompress --hex-dump=.rodata {}
│ │ │ @@ -1,16 +1,16 @@
│ │ │  
│ │ │  Hex dump of section '.rodata':
│ │ │    0x00436000 01000200 00000000 2f6e6978 2f73746f ......../nix/sto
│ │ │ -  0x00436010 72652f77 73706171 37626770 7662737a re/wspaq7bgpvbsz
│ │ │ -  0x00436020 626c7776 6d367367 6b736467 6d386739 blwvm6sgksdgm8g9
│ │ │ -  0x00436030 6e706d2d 6d697261 6e64612d 322e3036 npm-miranda-2.06
│ │ │ +  0x00436010 72652f67 70647137 35666431 32666368 re/gpdq75fd12fch
│ │ │ +  0x00436020 6d307837 62663630 70313264 72626e68 m0x7bf60p12drbnh
│ │ │ +  0x00436030 3977372d 6d697261 6e64612d 322e3036 9w7-miranda-2.06
│ │ │    0x00436040 362f6c69 622f6d69 72616c69 62000000 6/lib/miralib...
│ │ │ -  0x00436050 636f6d70 696c6564 3a203230 32302d30 compiled: 2020-0
│ │ │ -  0x00436060 312d3331 0a676363 202d7720 2d4f320a 1-31.gcc -w -O2.
│ │ │ +  0x00436050 636f6d70 696c6564 3a203139 38302d30 compiled: 1980-0
│ │ │ +  0x00436060 312d3031 0a676363 202d7720 2d4f320a 1-01.gcc -w -O2.
│ │ │    0x00436070 686f7374 3a207838 365f3634 204c696e host: x86_64 Lin
│ │ │    0x00436080 75782035 2e342e30 2d34382d 67656e65 ux 5.4.0-48-gene
│ │ │    0x00436090 7269630a 67636320 76657273 696f6e20 ric.gcc version 
│ │ │    0x004360a0 392e332e 30202847 43432920 0a003130 9.3.0 (GCC) ..10
│ │ │    0x004360b0 204f6374 6f626572 20323032 30004b00  October 2020.K.
│ │ │    0x004360c0 43420048 4400544c 00424f44 5900535f CB.HD.TL.BODY.S_
│ │ │    0x004360d0 70005500 55660055 5f005567 00434f4e p.U.Uf.U_.Ug.CON
├── lib
│ ├── miralib
│ │ ├── ex
│ │ │ ├── ack.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 6163 6b2e 6d00 ed56 dc5d 0000 0000  @Sack.m..V.]....
│ │ │ │ +00000000: 4053 6163 6b2e 6d00 0100 0000 0000 0000  @Sack.m.........
│ │ │ │  00000010: 01bf dabf d9c0 00cb bfb5 bfe8 cbc0 01cb  ................
│ │ │ │  00000020: cbcb bfda bfdc c001 cbbf b6bf d9c0 00cb  ................
│ │ │ │  00000030: cbbf b5c3 6163 6b00 cbc0 01cb cbcb cbbf  ....ack.........
│ │ │ │  00000040: dabf dcc0 01cb bfb6 bfdc c001 cbcb bfe0  ................
│ │ │ │  00000050: bfb6 cbc3 6163 6b00 cbbf b6c3 6163 6b00  ....ack.....ack.
│ │ │ │  00000060: cbbf b5bf e8cb c001 cbcb cbcb cbcb bfb3  ................
│ │ │ │  00000070: bfb3 c365 7272 6f72 00bc 67cc 72cc 61cc  ...error..g.r.a.
│ │ │ ├── barry.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 6261 7272 792e 6d00 eecc 195e 0000  @Sbarry.m....^..
│ │ │ │ +00000000: 4053 6261 7272 792e 6d00 0100 0000 0000  @Sbarry.m.......
│ │ │ │  00000010: 0000 01c3 666f 6c64 6c00 c36d 6178 7475  ....foldl..maxtu
│ │ │ │  00000020: 706c 6500 cbc0 00c0 01cc cbc3 6d61 7000  ple.........map.
│ │ │ │  00000030: c363 6f6c 6c61 747a 7061 6972 00cb bfcb  .collatzpair....
│ │ │ │  00000040: c001 cbc1 3f42 0000 1e00 0000 ffff ffff  ....?B..........
│ │ │ │  00000050: cbc0 01cb cbcb 0502 cb05 02cb 07cb cbc5  ................
│ │ │ │  00000060: 001f 00c3 7465 7374 3500 cac3 666f 6c64  ....test5...fold
│ │ │ │  00000070: 7200 c36d 6178 7475 706c 6500 cbc0 00c0  r..maxtuple.....
│ │ │ ├── box.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 626f 782e 6d00 c1ac df5d 0000 0000  @Sbox.m....]....
│ │ │ │ +00000000: 4053 626f 782e 6d00 0100 0000 0000 0000  @Sbox.m.........
│ │ │ │  00000010: 01bf dabf c0bf e0bf b5cb bfe2 bfe2 bfb6  ................
│ │ │ │  00000020: cbcb bfe2 bfb5 cbbf b5bf e1bf e1bf b6cb  ................
│ │ │ │  00000030: cbbf e1bf c9bc 7ccc 7ccc cbcb cbbf c9cb  ......|.|.......
│ │ │ │  00000040: cbbf e1bf b5bf c9cb cbbf c9bc 0acc 7ccc  ..............|.
│ │ │ │  00000050: 7ccc cbcb c372 655f 626f 7800 cbcb cbbf  |....re_box.....
│ │ │ │  00000060: b5c3 7265 7000 cb09 cbcb cbbf e2bf eacb  ..rep...........
│ │ │ │  00000070: bfe2 bfe8 cbbf e7c3 626f 7857 6964 00cb  ........boxWid..
│ │ │ ├── divmodtest.x
│ │ │ │ @@ -1,9 +1,9 @@
│ │ │ │ -00000000: 4053 6469 766d 6f64 7465 7374 2e6d 003f  @Sdivmodtest.m.?
│ │ │ │ -00000010: a760 4300 0000 0001 bfe1 c361 6e64 00cb  .`C........and..
│ │ │ │ +00000000: 4053 6469 766d 6f64 7465 7374 2e6d 0001  @Sdivmodtest.m..
│ │ │ │ +00000010: 0000 0000 0000 0001 bfe1 c361 6e64 00cb  ...........and..
│ │ │ │  00000020: c363 6f6e 6361 7400 cbbf e2bf cdcb bfb5  .concat.........
│ │ │ │  00000030: bfe2 bfcd cbcb bfd2 bfb5 bfc4 cbc0 00cb  ................
│ │ │ │  00000040: cbbf cbc0 01cb c00f cbbf c5c0 0fcb cbcb  ................
│ │ │ │  00000050: cbcb bfcb c001 cbc0 0fcb bfc5 c00f cbcb  ................
│ │ │ │  00000060: cbcb bfda bfb2 bfe1 bfb2 cbbf e0bf c2cb  ................
│ │ │ │  00000070: bfb5 bfed cbc0 00cb cbcb bfb2 bfe1 bfb2  ................
│ │ │ │  00000080: cbbf e1bf c6cb bfb5 bfee cbc0 00cb cbcb  ................
│ │ │ ├── edigits.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 6564 6967 6974 732e 6d00 6b21 f05d  @Sedigits.m.k!.]
│ │ │ │ +00000000: 4053 6564 6967 6974 732e 6d00 0100 0000  @Sedigits.m.....
│ │ │ │  00000010: 0000 0000 01bf dabf e1bf c0cb bfb6 bfc0  ................
│ │ │ │  00000020: cbcb bfb2 bfe1 bfb5 cbbf e1bf b2cb bfe1  ................
│ │ │ │  00000030: bfb6 cbbf becb cbcb bfe0 bfb2 cbbf b2bf  ................
│ │ │ │  00000040: e1bf e1bf b5cb cbbf e0bf c2cb cbbf e0bf  ................
│ │ │ │  00000050: e2bf b5bf edcb cbcb bfe2 bfe2 bfe8 cbcb  ................
│ │ │ │  00000060: bfb5 bfec cbcb c009 cbcb bfb8 cbcb cbbf  ................
│ │ │ │  00000070: e0bf e2bf b5cb cbbf b5bf e1bf e2bf e2bf  ................
│ │ │ ├── fib.x
│ │ │ │ @@ -1,7 +1,7 @@
│ │ │ │ -00000000: 4053 6669 622e 6d00 7699 bc5d 0000 0000  @Sfib.m.v..]....
│ │ │ │ +00000000: 4053 6669 622e 6d00 0100 0000 0000 0000  @Sfib.m.........
│ │ │ │  00000010: 01bf b2bf e2bf c2cb bfb5 bfb5 bfee cbcb  ................
│ │ │ │  00000020: c002 cbcb c001 cbcb bfb2 bfe1 bfe8 cbc3  ................
│ │ │ │  00000030: 6669 6200 cbbf b5bf e7cb c001 cbcb cbbf  fib.............
│ │ │ │  00000040: b6c3 6669 6200 cbbf b5bf e7cb c002 cbcb  ..fib...........
│ │ │ │  00000050: cbcb 0602 cb02 cbc5 0003 00c3 6669 6200  ............fib.
│ │ │ │  00000060: caca 00ca bcca bcca bcca ca              ...........
│ │ │ ├── fibs.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 6669 6273 2e6d 00ce a05a 4300 0000  @Sfibs.m...ZC...
│ │ │ │ +00000000: 4053 6669 6273 2e6d 0001 0000 0000 0000  @Sfibs.m........
│ │ │ │  00000010: 0001 c36c 6179 6e00 c36d 6170 00c3 7368  ...layn..map..sh
│ │ │ │  00000020: 6f77 6e75 6d00 cbc3 6669 6273 00cb cb04  ownum...fibs....
│ │ │ │  00000030: 03cb c500 0c00 c374 6573 7400 cabf dabf  .......test.....
│ │ │ │  00000040: d9c0 00cb c000 cbcb bfda bfd9 c001 cbc0  ................
│ │ │ │  00000050: 01cb cbbf dabf dcc0 02cb bfe0 bfe8 cbbf  ................
│ │ │ │  00000060: e2bf dbcb bfb5 bfe8 cbc0 01cb cbc3 6669  ..............fi
│ │ │ │  00000070: 6273 00cb cbbf b5bf dbcb c366 6962 7300  bs.........fibs.
│ │ │ ├── genmat.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 6765 6e6d 6174 2e6d 0083 8e54 2500  @Sgenmat.m...T%.
│ │ │ │ +00000000: 4053 6765 6e6d 6174 2e6d 0001 0000 0000  @Sgenmat.m......
│ │ │ │  00000010: 0000 0000 bfe0 bfb6 c374 7261 6e73 706f  .........transpo
│ │ │ │  00000020: 7365 00cb cbbf e0bf e2bf cdcb cbbf b2bf  se..............
│ │ │ │  00000030: e1bf e2bf e2bf cdcb cbcb bfe2 bfe2 c80a  ................
│ │ │ │  00000040: 00cb cbcb bfe2 bfb5 cbc8 0300 cbcb cbc3  ................
│ │ │ │  00000050: 696e 6465 7800 cbcb c369 6e64 6578 00cb  index....index..
│ │ │ │  00000060: cbc3 6465 7400 cb06 0404 c80d 00cb cbcb  ..det...........
│ │ │ │  00000070: 0404 c80d 00cb cbcb c500 4f00 c369 6e76  ..........O..inv
│ │ │ ├── graphics.x
│ │ │ │ @@ -1,9 +1,9 @@
│ │ │ │ -00000000: 4053 6772 6170 6869 6373 2e6d 003e 93b7  @Sgraphics.m.>..
│ │ │ │ -00000010: 5d00 0000 0001 bfe1 bfb5 bfe0 bfb5 cbbf  ]...............
│ │ │ │ +00000000: 4053 6772 6170 6869 6373 2e6d 0001 0000  @Sgraphics.m....
│ │ │ │ +00000010: 0000 0000 0001 bfe1 bfb5 bfe0 bfb5 cbbf  ................
│ │ │ │  00000020: b5bf b8cb cbbf b8cb cbcb bfb4 cbbf e1bf  ................
│ │ │ │  00000030: b6bf e1bf b2bf e2bf c2cb bfb5 bfc3 cbbc  ................
│ │ │ │  00000040: cbcb bccb cbcb bfb2 bfc9 cbcb cbcb bfb5  ................
│ │ │ │  00000050: bfe2 bfe0 cbbf e0cb bfc9 cbcb cbbf e1bf  ................
│ │ │ │  00000060: b6bf b6c3 6d6b 7365 7400 cbcb cbbf b5bf  ....mkset.......
│ │ │ │  00000070: e2bf e1cb bfe1 bfd2 cbbf b6bf c8cb cbc3  ................
│ │ │ │  00000080: 6d65 6d62 6572 00cb cbc3 636f 6e63 6174  member....concat
│ │ │ ├── hamming.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 6861 6d6d 696e 672e 6d00 581f 6243  @Shamming.m.X.bC
│ │ │ │ +00000000: 4053 6861 6d6d 696e 672e 6d00 0100 0000  @Shamming.m.....
│ │ │ │  00000010: 0000 0000 01bf e2bf dec0 01cb cbbf e2bf  ................
│ │ │ │  00000020: b6cb c366 6f6c 6472 3100 cbbf bdbf b5bf  ...foldr1.......
│ │ │ │  00000030: b5bf b8cb c002 cbcb c368 616d 00cb cbbf  .........ham....
│ │ │ │  00000040: bdbf b5bf b5bf b8cb c003 cbcb c368 616d  .............ham
│ │ │ │  00000050: 00cb cbbf dfbf b5bf b5bf b8cb c005 cbcb  ................
│ │ │ │  00000060: c368 616d 00cb cbbc cbcb cbcb cbbf b6bf  .ham............
│ │ │ │  00000070: cdcb bfe9 cbcb bfb4 bfe2 bfda cbbf e1bf  ................
│ │ │ ├── hanoi.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 6861 6e6f 692e 6d00 5832 cd5d 0000  @Shanoi.m.X2.]..
│ │ │ │ +00000000: 4053 6861 6e6f 692e 6d00 0100 0000 0000  @Shanoi.m.......
│ │ │ │  00000010: 0000 01bf b6bf b6bf c9bc 20cc 6dcc 6fcc  .......... .m.o.
│ │ │ │  00000020: 72cc 66cc 20cc 63cc 73cc 69cc 64cc 20cc  r.f. .c.s.i.d. .
│ │ │ │  00000030: 70cc 6fcc 74cc 20cc 65cc 68cc 74cc 20cc  p.o.t. .e.h.t. .
│ │ │ │  00000040: 65cc 76cc 6fcc 6dcc cbcb cbbf b5bf e2bf  e.v.o.m.........
│ │ │ │  00000050: e1cb bfc9 cbbf c9bc 20cc 6fcc 74cc 20cc  ........ .o.t. .
│ │ │ │  00000060: cbcb cbbf b5bf c9cb bc0a cccb cbcb 0604  ................
│ │ │ │  00000070: 03cb cb06 0403 cbcb 0403 cbcb cbc5 000b  ................
│ │ │ ├── just.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 6a75 7374 2e6d 006d cf5b 4300 0000  @Sjust.m.m.[C...
│ │ │ │ +00000000: 4053 6a75 7374 2e6d 0001 0000 0000 0000  @Sjust.m........
│ │ │ │  00000010: 0001 bfe2 bfb2 cbbf e2bf e2bf c2cb cbbf  ................
│ │ │ │  00000020: b5bf c3cb cbbf ddbc cbcb cbbf e2bf bdcb  ................
│ │ │ │  00000030: bfb5 bfde cbc3 6864 00cb cbc3 746c 00cb  ......hd....tl..
│ │ │ │  00000040: cbc8 0000 cabf e1bf e2bf b6cb bfc9 cbcb  ................
│ │ │ │  00000050: bfc9 cbbf dfbf b8cb bccb cbc8 0100 cac3  ................
│ │ │ │  00000060: 666f 6c64 7231 00c8 0100 20cb cbc8 0200  foldr1.... .....
│ │ │ │  00000070: cabf b6c3 6669 6c74 6572 00bf b5bf c4cb  ....filter......
│ │ │ ├── kate.lit.x
│ │ │ │ @@ -1,9 +1,9 @@
│ │ │ │ -00000000: 4053 6b61 7465 2e6c 6974 2e6d 0055 c166  @Skate.lit.m.U.f
│ │ │ │ -00000010: 4300 0000 0001 bfb6 c373 7761 7043 6173  C........swapCas
│ │ │ │ +00000000: 4053 6b61 7465 2e6c 6974 2e6d 0001 0000  @Skate.lit.m....
│ │ │ │ +00000010: 0000 0000 0001 bfb6 c373 7761 7043 6173  .........swapCas
│ │ │ │  00000020: 6500 cbc3 7377 6170 576f 7264 7300 cb06  e...swapWords...
│ │ │ │  00000030: 0403 cbcb 0403 cbcb c500 8700 c36b 6174  .............kat
│ │ │ │  00000040: 6500 cabf b2bf e1bf e2bf c3cb cbc3 7461  e.............ta
│ │ │ │  00000050: 6b65 00cb bff2 cbcb bfb8 cb06 04cd 01cb  ke..............
│ │ │ │  00000060: cb06 04cd 01cb cb01 cbcb c500 7d00 c369  ............}..i
│ │ │ │  00000070: 7370 7265 6669 7800 cabf b2bf e2bf b2cb  sprefix.........
│ │ │ │  00000080: bfe2 bfc2 cbbf b5bf c3cb bccb cbcb c368  ...............h
│ │ │ ├── keith.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 6b65 6974 682e 6d00 a79a bc5d 0000  @Skeith.m....]..
│ │ │ │ +00000000: 4053 6b65 6974 682e 6d00 0100 0000 0000  @Skeith.m.......
│ │ │ │  00000010: 0000 01bf b6c3 6c61 7900 cbbf b5bf b8cb  ......lay.......
│ │ │ │  00000020: c001 cbcb bfb4 bfb6 bfbd c36b 6569 7468  ...........keith
│ │ │ │  00000030: 00cb cbbf b5bf b6cb bfb5 bfe9 cbc0 02cb  ................
│ │ │ │  00000040: cbcb cbcb 0403 cbc5 000e 00c3 6c69 6d00  ............lim.
│ │ │ │  00000050: cac3 666f 6c64 7200 bfe9 cbc0 01cb 0604  ..foldr.........
│ │ │ │  00000060: 02cb cb02 cbc5 000d 00c3 7072 6f64 00ca  ..........prod..
│ │ │ │  00000070: bfb5 bfb2 bfe1 bfb6 cbbf c9cb c373 686f  .............sho
│ │ │ ├── makebug.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 6d61 6b65 6275 672e 6d00 102d cd5d  @Smakebug.m..-.]
│ │ │ │ +00000000: 4053 6d61 6b65 6275 672e 6d00 0100 0000  @Smakebug.m.....
│ │ │ │  00000010: 0000 0000 01bf b6bf c9bc 0acc 5bcc 3dcc  ............[.=.
│ │ │ │  00000020: 0acc 74cc 73cc 69cc 6ccc 5fcc 67cc 69cc  ..t.s.i.l._.g.i.
│ │ │ │  00000030: 62cc cbcb bfb5 bfe1 bfc9 cbc3 6c61 7900  b...........lay.
│ │ │ │  00000040: cbbf b5c3 7265 7000 cbbc 2ccc 22cc 6fcc  ....rep...,.".o.
│ │ │ │  00000050: 6ccc 6ccc 65cc 68cc 22cc 20cc 20cc cbcb  l.l.e.h.". . ...
│ │ │ │  00000060: cbbc 0acc 5dcc 22cc 6fcc 6ccc 6ccc 65cc  ....].".o.l.l.e.
│ │ │ │  00000070: 68cc 22cc 20cc 20cc cbcb 0602 cb04 03cb  h.". . .........
│ │ │ ├── matrix.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 6d61 7472 6978 2e6d 0021 e4d8 2600  @Smatrix.m.!..&.
│ │ │ │ +00000000: 4053 6d61 7472 6978 2e6d 0001 0000 0000  @Smatrix.m......
│ │ │ │  00000010: 0000 0001 c36d 6174 6d75 6c74 00c8 0500  .....matmult....
│ │ │ │  00000020: cbc3 696e 7600 c805 00cb cbc8 0000 cac3  ..inv...........
│ │ │ │  00000030: 6964 6d61 7400 c004 cbc8 0100 cac3 6964  idmat.........id
│ │ │ │  00000040: 6d61 7400 c003 cbc8 0200 cac3 6964 6d61  mat.........idma
│ │ │ │  00000050: 7400 c002 cbc8 0300 cabc bcc0 01cc c000  t...............
│ │ │ │  00000060: ccc0 04cc c003 cccc bcc0 00cc c004 ccc0  ................
│ │ │ │  00000070: 03cc c002 cccc bcc0 04cc c003 ccc0 02cc  ................
│ │ │ ├── parafs.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 7061 7261 6673 2e6d 001b 8bf1 5d00  @Sparafs.m....].
│ │ │ │ +00000000: 4053 7061 7261 6673 2e6d 0001 0000 0000  @Sparafs.m......
│ │ │ │  00000010: 0000 0001 c805 00c0 00cb c000 cbbc bc43  ...............C
│ │ │ │  00000020: cccc cbc8 1800 c500 2100 c363 656e 7472  ........!..centr
│ │ │ │  00000030: 6500 cac8 0500 c000 cbc0 00cb bcbc 2dcc  e.............-.
│ │ │ │  00000040: cccb c818 00c5 0020 00c3 626f 6e64 00ca  ....... ..bond..
│ │ │ │  00000050: bfe1 c813 00c0 01cb c000 cbcb c80e 00cb  ................
│ │ │ │  00000060: bfde c362 6f6e 6400 cbbf dfbf b8cb bccb  ...bond.........
│ │ │ │  00000070: cbcb 06c8 1800 cbc8 1800 cbc5 001f 00c3  ................
│ │ │ │ @@ -105,15 +105,15 @@
│ │ │ │  00000680: c373 6f72 7400 cb06 04c3 6d6f 6c00 cbcb  .sort.....mol...
│ │ │ │  00000690: c36d 6f6c 00cb c500 0400 c363 00ca bcc3  .mol.......c....
│ │ │ │  000006a0: 4300 ccc3 4800 cc00 ccc8 0000 00cc cc0a  C...H...........
│ │ │ │  000006b0: c500 0300 c36d 6f6c 00ca c348 00c6 0000  .....mol...H....
│ │ │ │  000006c0: c36d 6f6c 00c5 0003 00c3 4800 cac3 4300  .mol......H...C.
│ │ │ │  000006d0: c601 0006 04c3 6d6f 6c00 cbcb c36d 6f6c  ......mol....mol
│ │ │ │  000006e0: 00cb c500 0300 c343 00ca ca67 7261 7068  .......C...graph
│ │ │ │ -000006f0: 6963 732e 6d00 3e93 b75d 0000 0000 01bf  ics.m.>..]......
│ │ │ │ +000006f0: 6963 732e 6d00 0100 0000 0000 0000 01bf  ics.m...........
│ │ │ │  00000700: e1bf b5bf e0bf b5cb bfb5 bfb8 cbcb bfb8  ................
│ │ │ │  00000710: cbcb cbbf b4cb bfe1 bfb6 bfe1 bfb2 bfe2  ................
│ │ │ │  00000720: bfc2 cbbf b5bf c3cb bccb cbbc cbcb cbbf  ................
│ │ │ │  00000730: b2bf c9cb cbcb cbbf b5bf e2bf e0cb bfe0  ................
│ │ │ │  00000740: cbbf c9cb cbcb bfe1 bfb6 bfb6 c36d 6b73  .............mks
│ │ │ │  00000750: 6574 00cb cbcb bfb5 bfe2 bfe1 cbbf e1bf  et..............
│ │ │ │  00000760: d2cb bfb6 bfc8 cbcb c36d 656d 6265 7200  .........member.
│ │ │ ├── polish.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 706f 6c69 7368 2e6d 00f4 1505 2600  @Spolish.m....&.
│ │ │ │ +00000000: 4053 706f 6c69 7368 2e6d 0001 0000 0000  @Spolish.m......
│ │ │ │  00000010: 0000 0001 c80f 00bc 78cc 37cc 2fcc 33cc  ........x.7./.3.
│ │ │ │  00000020: 78cc 2bcc 2acc cbbc 31cc 79cc 2fcc 79cc  x.+.*...1.y./.y.
│ │ │ │  00000030: 31cc 2bcc 2acc cbc8 1000 0403 cbcb c500  1.+.*...........
│ │ │ │  00000040: 2200 c374 6573 7431 00ca c80f 00bc 78cc  "..test1......x.
│ │ │ │  00000050: 37cc 2fcc 33cc 78cc 2bcc 2acc cbbc 31cc  7./.3.x.+.*...1.
│ │ │ │  00000060: 7acc 2fcc 79cc 31cc 2bcc 2acc cbc8 1000  z./.y.1.+.*.....
│ │ │ │  00000070: 0403 cbcb c500 2100 c374 6573 7400 cabf  ......!..test...
│ │ │ │ @@ -40,16 +40,16 @@
│ │ │ │  00000270: cac3 6864 0006 04cd 01cb cbcd 01cb c500  ..hd............
│ │ │ │  00000280: 1200 c372 6174 6f72 00ca bfb5 bfdd cbbc  ...rator........
│ │ │ │  00000290: cb06 cd01 cb04 cd01 cbcb c500 1100 c370  ...............p
│ │ │ │  000002a0: 7574 7661 7200 cac3 6864 0006 04cd 01cb  utvar...hd......
│ │ │ │  000002b0: cbcd 01cb c500 1000 c367 6574 7661 7200  .........getvar.
│ │ │ │  000002c0: cabf b6c3 6c65 7474 6572 00cb c368 6400  ....letter...hd.
│ │ │ │  000002d0: cb06 0403 cbcb 01cb c500 0f00 c369 7376  .............isv
│ │ │ │ -000002e0: 6172 00ca ca75 6e69 6679 2e6d 0097 7a76  ar...unify.m..zv
│ │ │ │ -000002f0: 4700 0000 0000 bfe0 bfb2 cbbf b5bf e1bf  G...............
│ │ │ │ +000002e0: 6172 00ca ca75 6e69 6679 2e6d 0001 0000  ar...unify.m....
│ │ │ │ +000002f0: 0000 0000 0000 bfe0 bfb2 cbbf b5bf e1bf  ................
│ │ │ │  00000300: e1bf c6cb cbbf c3cb c806 00cb cbc8 0600  ................
│ │ │ │  00000310: cbcb bfb5 bfe2 bfe1 cbbf e1bf c3cb bff2  ................
│ │ │ │  00000320: cbc8 0500 cbcb bff2 cbcb c805 00cb cbc8  ................
│ │ │ │  00000330: 0100 cabf b2bf e1bf b2cb bfe0 bfc2 cbc8  ................
│ │ │ │  00000340: 0900 cbcb bfb5 bfc3 cbcb cbbf b5bf e1bf  ................
│ │ │ │  00000350: e1c3 6f72 00cb cbc3 6d61 7000 cbc8 0200  ..or....map.....
│ │ │ │  00000360: cbcb c805 00cb cbc8 0200 cac5 0030 00c4  .............0..
│ │ │ ├── powers.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 706f 7765 7273 2e6d 0080 b61b 5e00  @Spowers.m....^.
│ │ │ │ +00000000: 4053 706f 7765 7273 2e6d 0001 0000 0000  @Spowers.m......
│ │ │ │  00000010: 0000 0001 bfb5 bfe1 bfc9 cbc3 636f 6e63  ............conc
│ │ │ │  00000020: 6174 00cb bfb5 bfe1 bfcd cbbf e1c3 666f  at............fo
│ │ │ │  00000030: 726d 6174 00cb 81cb cbbf efcb cbbf cbc0  rmat............
│ │ │ │  00000040: 01cb c005 cbc0 01cb cbcb cbbc 0acc cb06  ................
│ │ │ │  00000050: 02cb 0403 cbcb c500 0f00 c36c 696e 6500  ...........line.
│ │ │ │  00000060: cac3 726a 7573 7469 6679 00c0 0ccb 0604  ..rjustify......
│ │ │ │  00000070: 03cb cb04 03cb cbc5 000d 00c3 666f 726d  ............form
│ │ │ ├── primes.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 7072 696d 6573 2e6d 009b cc54 2500  @Sprimes.m...T%.
│ │ │ │ +00000000: 4053 7072 696d 6573 2e6d 0001 0000 0000  @Sprimes.m......
│ │ │ │  00000010: 0000 0001 bfda bfc0 bfb2 bfde cbbf e1bf  ................
│ │ │ │  00000020: b6c3 7369 6576 6500 cbcb bfd2 cbbf e2bf  ..sieve.........
│ │ │ │  00000030: e2bf c4cb cbbf b5bf eccb cbc0 00cb cbcb  ................
│ │ │ │  00000040: cbcb b6c5 0007 00c4 7369 6576 6500 cccb  ........sieve...
│ │ │ │  00000050: cb06 0402 cbcb 0402 cbcb c500 0700 c373  ...............s
│ │ │ │  00000060: 6965 7665 00ca c373 6965 7665 00bf cac0  ieve...sieve....
│ │ │ │  00000070: 01cb c002 cbcb 0402 cbc5 0006 00c3 7072  ..............pr
│ │ │ ├── pyths.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 7079 7468 732e 6d00 dfe7 6043 0000  @Spyths.m...`C..
│ │ │ │ +00000000: 4053 7079 7468 732e 6d00 0100 0000 0000  @Spyths.m.......
│ │ │ │  00000010: 0000 01bf e0bf c3cb bfe2 bfef cbc3 696e  ..............in
│ │ │ │  00000020: 7473 7172 7400 cbc0 02cb cbbf b8cb 0602  tsqrt...........
│ │ │ │  00000030: cb01 cbc5 0009 00c3 6973 5f73 7100 cabf  ........is_sq...
│ │ │ │  00000040: b6c3 656e 7469 6572 00cb c373 7172 7400  ..entier...sqrt.
│ │ │ │  00000050: cb06 02cb 02cb c500 0800 c369 6e74 7371  ...........intsq
│ │ │ │  00000060: 7274 00ca c363 6f6e 6361 7400 c3e4 6961  rt...concat...ia
│ │ │ │  00000070: 676f 6e61 6c69 7365 00bf cdbf e0bf cdcb  gonalise........
│ │ │ ├── queens.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 7175 6565 6e73 2e6d 00f8 2494 4800  @Squeens.m..$.H.
│ │ │ │ +00000000: 4053 7175 6565 6e73 2e6d 0001 0000 0000  @Squeens.m......
│ │ │ │  00000010: 0000 0001 bfe0 bfb2 cbbf b5bf e1bf e1bf  ................
│ │ │ │  00000020: b2cb cbbf e1bf c7cb cbbf c3cb cbbf b5bf  ................
│ │ │ │  00000030: dbcb cbcb bfe2 bfb5 cbbf b5bf e1bf e1bf  ................
│ │ │ │  00000040: e0bf c3cb cbcb bfe1 c361 6273 00cb cbbf  .........abs....
│ │ │ │  00000050: e7cb cbbf b5bf dbcb cbcb bfb5 bfe8 cbc0  ................
│ │ │ │  00000060: 01cb cbcb 0602 cb06 0402 cbcb 0602 cb01  ................
│ │ │ │  00000070: cbcb cbc5 000b 00c3 6368 6563 6b73 00ca  ........checks..
│ │ │ ├── queens1.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 7175 6565 6e73 312e 6d00 848e 5425  @Squeens1.m...T%
│ │ │ │ +00000000: 4053 7175 6565 6e73 312e 6d00 0100 0000  @Squeens1.m.....
│ │ │ │  00000010: 0000 0000 01bf e0bf b2cb bfb5 bfe1 bfe1  ................
│ │ │ │  00000020: bfb2 cbcb bfe1 bfc7 cbcb bfc3 cbcb bfb5  ................
│ │ │ │  00000030: bfdb cbcb cbbf e2bf b5cb bfb5 bfe1 bfe1  ................
│ │ │ │  00000040: bfe0 bfc3 cbcb cbbf e1c3 6162 7300 cbcb  ..........abs...
│ │ │ │  00000050: bfe7 cbcb bfb5 bfdb cbcb cbbf b5bf e8cb  ................
│ │ │ │  00000060: c001 cbcb cb06 02cb 0604 02cb cb06 02cb  ................
│ │ │ │  00000070: 01cb cbcb c500 1000 c363 6865 636b 7300  .........checks.
│ │ │ ├── quicksort.x
│ │ │ │ @@ -1,9 +1,9 @@
│ │ │ │ -00000000: 4053 7175 6963 6b73 6f72 742e 6d00 62ca  @Squicksort.m.b.
│ │ │ │ -00000010: 6043 0000 0000 01bf e1c3 636f 6e63 6174  `C........concat
│ │ │ │ +00000000: 4053 7175 6963 6b73 6f72 742e 6d00 0100  @Squicksort.m...
│ │ │ │ +00000010: 0000 0000 0000 01bf e1c3 636f 6e63 6174  ..........concat
│ │ │ │  00000020: 00cb c374 7261 6e73 706f 7365 00cb bfbd  ...transpose....
│ │ │ │  00000030: bfe2 bfcb bfe7 c002 cbc0 00cb cbcb bfe9  ................
│ │ │ │  00000040: c002 cbcb c000 cbcb bfdf bfb2 bfe2 bfcb  ................
│ │ │ │  00000050: cbbf e0bf e7cb bfe2 bfe7 cbbf e9c0 02cb  ................
│ │ │ │  00000060: cbc0 03cb cbbf e2bf e7cb bfe9 c002 cbcb  ................
│ │ │ │  00000070: c001 cbcb cbc0 01cb cbbf e2bf e7cb bfe9  ................
│ │ │ │  00000080: c002 cbcb c001 cbcb cbbc cbcb cb06 02cb  ................
│ │ │ ├── rational.x
│ │ │ │ @@ -1,9 +1,9 @@
│ │ │ │ -00000000: 4053 7261 7469 6f6e 616c 2e6d 0084 8e54  @Srational.m...T
│ │ │ │ -00000010: 2500 0000 0001 bfb2 bfe0 bfc2 cbbf b5bf  %...............
│ │ │ │ +00000000: 4053 7261 7469 6f6e 616c 2e6d 0001 0000  @Srational.m....
│ │ │ │ +00000010: 0000 0000 0001 bfb2 bfe0 bfc2 cbbf b5bf  ................
│ │ │ │  00000020: b5bf edcb cbc0 00cb cbbf b6bf c9bc 28cc  ..............(.
│ │ │ │  00000030: cbcb bfe2 bfc9 cbc3 7368 6f77 6e75 6d00  ........shownum.
│ │ │ │  00000040: cbbc 29cc cbcb cbcb c373 686f 776e 756d  ..)......shownum
│ │ │ │  00000050: 00cb 0602 cb04 03cb cbc5 0032 00c3 7368  ...........2..sh
│ │ │ │  00000060: 6f77 6e75 6d31 00ca 0502 cb05 02cb 07cb  ownum1..........
│ │ │ │  00000070: cb02 ccc3 7368 6f77 7261 7469 6f6e 616c  ....showrational
│ │ │ │  00000080: 0000 cccc 0ac5 000f 00c3 7261 7469 6f6e  ..........ration
│ │ │ ├── refoliate.x
│ │ │ │ @@ -1,9 +1,9 @@
│ │ │ │ -00000000: 4053 7265 666f 6c69 6174 652e 6d00 16e2  @Srefoliate.m...
│ │ │ │ -00000010: 195e 0000 0000 01c3 7361 6d65 5f73 6861  .^......same_sha
│ │ │ │ +00000000: 4053 7265 666f 6c69 6174 652e 6d00 0100  @Srefoliate.m...
│ │ │ │ +00000010: 0000 0000 0000 01c3 7361 6d65 5f73 6861  ........same_sha
│ │ │ │  00000020: 7065 00c3 7431 00cb c372 656f 7264 6572  pe..t1...reorder
│ │ │ │  00000030: 00c3 7431 00cb cb01 c500 3c00 c374 6573  ..t1......<..tes
│ │ │ │  00000040: 7400 cabf dabf c1c3 4c65 6166 00c6 0000  t.......Leaf....
│ │ │ │  00000050: cbbf b3bf c1c3 4c65 6166 00c6 0000 cbbf  ......Leaf......
│ │ │ │  00000060: b3bb cbcb cbcb cbbf dabf c1c3 466f 726b  ............Fork
│ │ │ │  00000070: 00c6 0100 cbbf e2bf e1bf c1c3 466f 726b  ............Fork
│ │ │ │  00000080: 00c6 0100 cbcb cbbf e1bf b5cb bfe1 bfb6  ................
│ │ │ ├── selflines.x
│ │ │ │ @@ -1,9 +1,9 @@
│ │ │ │ -00000000: 4053 7365 6c66 6c69 6e65 732e 6d00 848e  @Sselflines.m...
│ │ │ │ -00000010: 5425 0000 0000 01bf dabf d9c0 01cb bc74  T%.............t
│ │ │ │ +00000000: 4053 7365 6c66 6c69 6e65 732e 6d00 0100  @Sselflines.m...
│ │ │ │ +00000010: 0000 0000 0000 01bf dabf d9c0 01cb bc74  ...............t
│ │ │ │  00000020: cc73 cccb cbbf dabf d9c0 02cb bc64 cc6e  .s...........d.n
│ │ │ │  00000030: cccb cbbf dabf d9c0 03cb bc64 cc72 cccb  ...........d.r..
│ │ │ │  00000040: cbbf b2bf e2bf c2cb bfe0 bfc7 cbbf b5bf  ................
│ │ │ │  00000050: c3cb c000 cbcb bfe0 bfc6 cbbf b5bf eecb  ................
│ │ │ │  00000060: c003 cbcb bfb5 bfb5 bfee cbcb c009 cbcb  ................
│ │ │ │  00000070: cbcb bc68 cc74 cccb cbbf b2bf e2bf c2cb  ...h.t..........
│ │ │ │  00000080: bfe2 bfc3 cbbf e2bf eacb bfb5 bfec cbc0  ................
│ │ │ ├── set.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 7365 742e 6d00 848e 5425 0000 0000  @Sset.m...T%....
│ │ │ │ +00000000: 4053 7365 742e 6d00 0100 0000 0000 0000  @Sset.m.........
│ │ │ │  00000010: 01bf dabf c0bf b6bf c0cb bfe0 bfe0 bfb2  ................
│ │ │ │  00000020: cbcb bfe0 bfb5 cbbf b5bf e1bf b5cb bfe1  ................
│ │ │ │  00000030: bfe1 cbbf c2cb cbbf c3cb cbc8 0000 cbcb  ................
│ │ │ │  00000040: bfdd cbcb bfb5 bfe2 bfe1 cbbf decb bfb6  ................
│ │ │ │  00000050: c800 00cb cbcb bfdd cbcb cbcb cbbf b8cb  ................
│ │ │ │  00000060: c800 00ca 04cd 01cb 02cc c373 686f 7773  ...........shows
│ │ │ │  00000070: 6574 0001 cccc 0ac5 0016 00c3 7365 7400  et..........set.
│ │ │ ├── stack.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 7374 6163 6b2e 6d00 848e 5425 0000  @Sstack.m...T%..
│ │ │ │ +00000000: 4053 7374 6163 6b2e 6d00 0100 0000 0000  @Sstack.m.......
│ │ │ │  00000010: 0000 01c3 7075 7368 00c0 01cb c370 7573  ....push.....pus
│ │ │ │  00000020: 6800 c002 cbc3 7075 7368 00c0 03cb c365  h.....push.....e
│ │ │ │  00000030: 6d70 7479 00cb cbcb c373 7461 636b 0002  mpty.....stack..
│ │ │ │  00000040: cbc5 0013 00c3 7465 7374 7374 6163 6b00  ......teststack.
│ │ │ │  00000050: ca04 cd01 cb02 ccc3 7368 6f77 7374 6163  ........showstac
│ │ │ │  00000060: 6b00 01cc cc0a c500 0a00 c373 7461 636b  k..........stack
│ │ │ │  00000070: 00ca bfda bfb3 bfd8 bccb bc79 cc74 cc70  ...........y.t.p
│ │ │ ├── topsort.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 746f 7073 6f72 742e 6d00 0a15 5c47  @Stopsort.m...\G
│ │ │ │ +00000000: 4053 746f 7073 6f72 742e 6d00 0100 0000  @Stopsort.m.....
│ │ │ │  00000010: 0000 0000 01bf b6bf b6c3 6d6b 7365 7400  ..........mkset.
│ │ │ │  00000020: cbcb bfc9 cb06 04cd 01cb cb06 04cd 01cb  ................
│ │ │ │  00000030: cb04 cd01 cbcb cbc5 0020 00c3 756e 696f  ......... ..unio
│ │ │ │  00000040: 6e00 cabf e0c3 756e 696f 6e00 cbc3 646f  n.....union...do
│ │ │ │  00000050: 6d00 cbc3 7261 6e00 cb06 0405 cd01 cb05  m...ran.........
│ │ │ │  00000060: cd01 cb07 cbcb cbcb 04cd 01cb cbc5 001f  ................
│ │ │ │  00000070: 00c3 6361 7272 6965 7200 cabf b6c3 6d6b  ..carrier.....mk
│ │ │ ├── treesort.x
│ │ │ │ @@ -1,9 +1,9 @@
│ │ │ │ -00000000: 4053 7472 6565 736f 7274 2e6d 0084 8e54  @Streesort.m...T
│ │ │ │ -00000010: 2500 0000 0001 bfc9 bfcb c001 cbc0 05cb  %...............
│ │ │ │ +00000000: 4053 7472 6565 736f 7274 2e6d 0001 0000  @Streesort.m....
│ │ │ │ +00000010: 0000 0000 0001 bfc9 bfcb c001 cbc0 05cb  ................
│ │ │ │  00000020: c001 cbcb bfc9 bfcb bfe7 c013 cbc0 14cb  ................
│ │ │ │  00000030: cbc0 10cb c014 cbcb bfc9 bfcb c001 cbc0  ................
│ │ │ │  00000040: 0acb c006 cbcb bfcb bfe7 c00e cbc0 0fcb  ................
│ │ │ │  00000050: cbc0 0bcb c00f cbcb cbcb 0402 cbc5 0013  ................
│ │ │ │  00000060: 00c3 7465 7374 6461 7461 00ca bfda bfc1  ..testdata......
│ │ │ │  00000070: c34e 494c 5400 c600 00cb bccb cbbf dabf  .NILT...........
│ │ │ │  00000080: c1c3 4e4f 4445 00c6 0100 cbbf e2bf b5cb  ..NODE..........
│ │ │ ├── unify.x
│ │ │ │ @@ -1,8 +1,8 @@
│ │ │ │ -00000000: 4053 756e 6966 792e 6d00 977a 7647 0000  @Sunify.m..zvG..
│ │ │ │ +00000000: 4053 756e 6966 792e 6d00 0100 0000 0000  @Sunify.m.......
│ │ │ │  00000010: 0000 00bf e0bf b2cb bfb5 bfe1 bfe1 bfc6  ................
│ │ │ │  00000020: cbcb bfc3 cbc8 0600 cbcb c806 00cb cbbf  ................
│ │ │ │  00000030: b5bf e2bf e1cb bfe1 bfc3 cbbf f2cb c805  ................
│ │ │ │  00000040: 00cb cbbf f2cb cbc8 0500 cbcb c801 00ca  ................
│ │ │ │  00000050: bfb2 bfe1 bfb2 cbbf e0bf c2cb c809 00cb  ................
│ │ │ │  00000060: cbbf b5bf c3cb cbcb bfb5 bfe1 bfe1 c36f  ...............o
│ │ │ │  00000070: 7200 cbcb c36d 6170 00cb c802 00cb cbc8  r....map........
│ │ ├── preludx
│ │ │ @@ -1,8 +1,8 @@
│ │ │ -00000000: 4053 7072 656c 7564 6500 96f0 ec5d 0000  @Sprelude....]..
│ │ │ +00000000: 4053 7072 656c 7564 6500 0100 0000 0000  @Sprelude.......
│ │ │  00000010: 0000 01bf dabf c0bf b5bf e2bf e2cb bfde  ................
│ │ │  00000020: cbbf b5bf b8cb cbcb bfb4 bfb6 bfda bfc0  ................
│ │ │  00000030: bfbe bfb6 bfb3 cbbf b5bf e1bf b5cb bfc2  ................
│ │ │  00000040: cbbf b5bf c3cb c36f 6666 7369 6465 00cb  .......offside..
│ │ │  00000050: cbcb b9cb cbcb cbcb cbbf b5bf e1bf dacb  ................
│ │ │  00000060: bfc0 cbbf b5bf decb cbcb bfda bfd8 bccb  ................
│ │ │  00000070: bccb cbb6 c500 6a00 c467 00cc cbcb cbcb  ......j..g......
│ │ ├── stdenv.x
│ │ │ @@ -1,8 +1,8 @@
│ │ │ -00000000: 4053 7374 6465 6e76 2e6d 0000 b2f3 5d00  @Sstdenv.m....].
│ │ │ +00000000: 4053 7374 6465 6e76 2e6d 0001 0000 0000  @Sstdenv.m......
│ │ │  00000010: 0000 0001 bfbe c37a 6970 3200 cb06 0504  .......zip2.....
│ │ │  00000020: cd01 cbcb 0504 cd02 cbcb 07cb cbcb 0405  ................
│ │ │  00000030: cd01 cb05 cd02 cb07 cbcb cbcb c500 f602  ................
│ │ │  00000040: c37a 6970 00ca bfda bfc0 bfe2 bfe1 bfc0  .zip............
│ │ │  00000050: cbcb bfe1 bfe2 bfe1 bfc0 cbcb cbbf e1bf  ................
│ │ │  00000060: b5cb bfe1 bfe1 bfc0 cbcb bfb5 cbcb cbbf  ................
│ │ │  00000070: e2bf e2bf e1bf e1bf e1bf c0cb cbbf b5cb  ................

@siraben
Copy link
Member Author

siraben commented Oct 10, 2020

Huh, that's interesting. Is there some source of non-determinism?

@jtojnar
Copy link
Contributor

jtojnar commented Oct 10, 2020

Looking at https://github.com/jtojnar/miranda/blob/daf8abb8f30ec1cca21698e3fc355578b9f7c571/data.c#L578-L580, the .x file contains:

Field Size Comment
word size 1
format version 1 currently 83
file name varying NUL-terminated
mtime 4

Sizes are in bytes, numeric fields seem to use little-endian here.

From diffoscope output, we can see that it is the mtime of the .m modules, which is another source of non-determinism. For example stdenv.x has mtime field = 00b2f35d16,LE = 157625190410 = Fri Dec 13 15:45:04 2019, which matches the mtime of stdenv.m file.

When pointing src to a directory (either locally extracted or one produced by fetchzip) the data will be taken from Nix store, where all files have Jan 1 1970 (UNIX time 1) for mtime. When unpacking the tarball in unpackPhase, the original mtime will remain and end up in the .x file.

I would expect the reason mira tries to re-generate the .x files at runtime is because once the .m files end up in the Nix store, they will have 1 for mtime and mira will detect a mismatch between the .x files and try to regenerate them.

@jtojnar
Copy link
Contributor

jtojnar commented Oct 10, 2020

I would suggest you use fetchzip instead of fetchurl as suggested above and add a comment like:

The build generates object files (.x) from module files (.m). To be able to invalidate object file, it contains the mtime of the corresponding module file at the time of the build. When a file is installed to Nix store its mtime is set to 1, so the mtime field in the object file would no longer match and Miranda would try to regenerate it at the runtime, even though it is up to date. Using fetchzip will make all the source files have mtime=1 from the start so this mismatch cannot occur.

@jtojnar
Copy link
Contributor

jtojnar commented Oct 10, 2020

This seems to build and run correctly:

diff --git a/pkgs/development/compilers/miranda/default.nix b/pkgs/development/compilers/miranda/default.nix
index 21c0194cb04..bdad89e1e52 100644
--- a/pkgs/development/compilers/miranda/default.nix
+++ b/pkgs/development/compilers/miranda/default.nix
@@ -1,37 +1,69 @@
-{ stdenv, lib, fetchurl, fetchpatch, gcc }:
+{ stdenv, lib, fetchzip, fetchpatch, gcc }:
 
 stdenv.mkDerivation rec {
-  version = "2.066";
   pname = "miranda";
+  version = "2.066";
 
-  src = fetchurl {
+  # The build generates object files (`.x`) from module files (`.m`).
+  # To be able to invalidate object file, it contains the `mtime`
+  # of the corresponding module file at the time of the build.
+  # When a file is installed to Nix store its `mtime` is set to `1`,
+  # so the `mtime` field in the object file would no longer match
+  # and Miranda would try to regenerate it at the runtime,
+  # even though it is up to date.
+  # Using `fetchzip` will make all the source files have `mtime=1`
+  # from the start so this mismatch cannot occur.
+  src = fetchzip {
     url = "https://www.cs.kent.ac.uk/people/staff/dat/miranda/src/mira-${builtins.replaceStrings [ "." ] [ "" ] version}-src.tgz";
-    sha256 = "1sqn031agwwgq3pka55pxd6m22dagmkxjhbwrni8gpigihg2h72j";
+    sha256 = "KE/FTL9YW9l7VBAgkFZlqgSM1Bt/BXT6GkkONtyKJjQ=";
   };
 
-  enableParallelBuilding = true;
-
   patches = [
+    # Allow passing `PREFIX` to makeFlags.
+    # Sent upstream on 2020-10-10.
     (fetchpatch {
       name = "fix-makefile-variables.patch";
       url = "https://github.com/jtojnar/miranda/commit/be62d2150725a4c314aa7e3e1e75a165c90be65d.patch";
       sha256 = "0r8nnr7iyzp1a3w3n6y1xi0ralqhm1ifp75yhyj3h1g229vk51a6";
     })
+
+    # Create the installation directories.
+    # Sent upstream on 2020-10-10.
     (fetchpatch {
       name = "add-mkdirs-makefile.patch";
       url = "https://github.com/jtojnar/miranda/commit/048754606625975d5358e946549c41ae7b5d3428.patch";
       sha256 = "1n8xv679i7s789km2dxxrs2pphyyi7vr7rhafqvmkcdmhmxk9h2a";
     })
+
+    # Use correct installation path for finding the library.
+    # Sent upstream on 2020-10-10.
     (fetchpatch {
       name = "c-path-fixes.patch";
       url = "https://github.com/jtojnar/miranda/commit/aea0a118a802a0da6029b781f7cfd388224263cf.patch";
       sha256 = "1z3giv8fzc35a23ga9ahz9d1fbvya67kavnb8h4rv2icbzr5j5gd";
     })
+
+    # Make build reproducible.
+    # Sent upstream on 2020-10-10.
+    (fetchpatch {
+      name = "deterministic-build.patch";
+      url = "https://github.com/jtojnar/miranda/commit/daf8abb8f30ec1cca21698e3fc355578b9f7c571.patch";
+      sha256 = "TC/YrHrMzdlwicJ3oJ/TjwhkufmV3ypemgyqhMmVut4=";
+    })
+  ];
+
+  nativeBuildInputs = lib.optionals stdenv.isDarwin [ gcc ];
+
+  makeFlags = [
+    "CFLAGS=-O2"
+    "PREFIX=${placeholder "out"}"
   ];
 
-  makeFlags = [ "CFLAGS=-O2" "PREFIX=${placeholder "out"}" ];
+  enableParallelBuilding = true;
 
-  buildInputs = lib.optionals stdenv.isDarwin [ gcc ];
+  postPatch = ''
+    patchShebangs quotehostinfo
+  '';
 
   meta = with stdenv.lib; {
     description = "Compiler for Miranda -- a pure, non-strict, polymorphic, higher order functional programming language";

@siraben
Copy link
Member Author

siraben commented Oct 10, 2020

Patch applied!

@jtojnar jtojnar merged commit b6c7e8c into NixOS:master Oct 11, 2020
@jtojnar
Copy link
Contributor

jtojnar commented Oct 11, 2020

Thanks.

@siraben siraben deleted the miranda-init branch October 11, 2020 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants