[build] prevent bad sed usage under osx
Merge pull request #737 from Chilledheart/fix_sed_osx

[build] prevent bad sed usage under osx
[tests] fix bad usage of read_index_from and test_write_chunk