htslib 1.3.1 (and older) non-compatible header_read for SAM
Created by: avullo
I've recently addressed #54 (closed), which involved seeking at the beginning of the buffer not only for BAM/CRAM but for SAM files as well, using a dedicated function call (hseek).
This works well for htslib >= 1.5, but generates segmentation faults for v1.3.1 and probably before.
I could see the hseek code in htslib has changed since then: there are some guards acting in special circumstances in the newer versions using hFILE attributes which are not defined in the older versions, but cannot say this is the cause for sure.
This is a problem which is preventing deployment of the upcoming v2.10 in the ensembl web environment, as they rely on htslib 1.3.1 (to support GRCh37 with samtools): the SAM file tests exit unexpectedly so they are deemed to fail. Obviously, this is affecting any installation which ties to htslib < 1.5.
Am I calling hseek correctly with htslib < 1.5.? https://github.com/Ensembl/Bio-DB-HTS/blob/master/lib/Bio/DB/HTS.xs#L496 I cannot see why not.
The current workaround has just the goal of avoiding seg faults and make the tests pass with htslib 1.3.1 and older. Unfortunately, this exposes #54 (closed) again in these cases.