darcs

Patch 1966 make the index format depend on endianness

Title make the index format depend on endianness
Superseder Nosy List bf
Related Issues
Status accepted Assigned To
Milestone

Created on 2020-01-26.16:40:46 by bf, last changed 2020-02-15.22:06:30 by ganesh.

Files
File name Status Uploaded Type Edit Remove
make-the-index-format-depend-on-endianness.dpatch bf, 2020-01-26.16:40:45 application/x-darcs-patch
pEpkey.asc bf, 2020-01-27.11:21:44 application/pgp-keys
patch-preview.txt bf, 2020-01-26.16:40:45 text/x-darcs-patch
unnamed bf, 2020-01-26.16:40:45 text/plain
See mailing list archives for discussion on individual patches.
Messages
msg21728 (view) Author: bf Date: 2020-01-26.16:40:45
1 patch for repository http://darcs.net/screened:

patch 60d2900f59e31985dad429447103fb80b1b47feb
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sun Jan 26 17:34:03 CET 2020
  * make the index format depend on endianness
  
  Previously the index had a format that was independent from the
  architecture's endianness. This required that the code must be aware of
  endianness, which led to #ifdefs, and extra work in the custom Setup.hs. The
  new format avoids all that, at the cost of being architecture dependent.
  Since the index is just a cache, it can and should be re-created if it is
  found to be invalid. We merely need to make sure we can detect whether the
  format of the index has the same endianness as that expected by our code.
  This is done by adding a second word to the header (after the magic word)
  which should always read as 1 for the file to be considered in valid format.
Attachments
msg21745 (view) Author: bf Date: 2020-01-27.11:21:44
Ganesh, do you see a chance we can test that this works on big endian
arch? I guess it would be difficult to find that nowadays (with either
Unix or Windows OS) except for embedded stuff...
Attachments
msg21748 (view) Author: ganesh Date: 2020-01-27.18:08:36
Maybe we could use sparc64 under qemu?

https://packages.debian.org/search?keywords=ghc
https://unix.stackexchange.com/questions/77691/how-i-can-emulate-a-
big-endian-platform-on-a-x86

Not sure the effort to set it up is worth it though.
msg21756 (view) Author: bf Date: 2020-01-27.21:51:37
I agree it's not worth the effort and i do believe it should work.
msg21822 (view) Author: ganesh Date: 2020-02-15.20:26:34
> patch 60d2900f59e31985dad429447103fb80b1b47feb
> Author: Ben Franksen <ben.franksen@online.de>
> Date:   Sun Jan 26 17:34:03 CET 2020
>   * make the index format depend on endianness


> +index_endianness :: Int32
> +index_endianness = 1

This name is a bit confusing, it's more like
"index_endianness_indicator" or something. A comment along the lines of
"-- |Stored to the index to verify we are on the same endianness when
reading it back" would help.

Looks fine otherwise.
History
Date User Action Args
2020-01-26 16:40:46bfcreate
2020-01-27 11:21:44bfsetfiles: + pEpkey.asc
messages: + msg21745
2020-01-27 18:08:36ganeshsetmessages: + msg21748
2020-01-27 21:51:37bfsetstatus: needs-screening -> needs-review
messages: + msg21756
2020-02-15 20:26:26ganeshsetstatus: needs-review -> accepted-pending-tests
2020-02-15 20:26:34ganeshsetmessages: + msg21822
2020-02-15 22:06:30ganeshsetstatus: accepted-pending-tests -> accepted