Closed phil-rt closed 1 year ago
Thanks for the report @phil-rt
A more devious bug is that any non-first, non-SLDATA/SLINF/SLINFT/SLKEEP packets are potentially written to the wrong archive file, because the msr
structure is already populated from the previous record.
This section will be reworked to write all data packets to the archive output, with the only exceptions being communications injected into the data stream (SLINF/SLINFT/SLKEEP). It is not the role of slinktool to decide what is part of the data stream.
I believe this is fixed in 1bb47b24a951192b7b23bef32579ea38083217a2
@phil-rt if you could test the 4.x branch with your data streams it would be appreciated: https://github.com/EarthScope/slinktool/tree/4.x
Your changes resolve the problems I was seeing. I also suspected things would get written to the wrong file, but had not had a chance to verify. Your rewrite to archive all miniSEED records is appreciated. How soon do you expect to release this?
Thanks @phil-rt. New release cut: https://github.com/EarthScope/slinktool/releases/tag/v4.4
slinktool v4.3 crashes when archiving data if the first miniSEED record received is not a data packet, for example a 'message' (LOG) packet. slinktool::packet_handler() if(packet_type...) ... else ... does not parse the packet and does not disable archiving for the packet. If this is the very first packet then msr is still NULL but gets passed down into the archiver which attempts to use it. If this is not the first packet, then msr points to non-current informtion.
Suggested change: if (packet_type == SLDATA) ... else if (packet_type == SLINF || packet_type == SLINFT) ... else if (packet_type == SLKEEP) ... else if (packet_type == SLMSG) { sl_log (1, 1, "%s, seq %d, Received %s blockette\n", timestamp, seqnum, type[packet_type]); sl_msr_parse (slconn->log, msrecord, &msr, 0, 0); } else { sl_log (1, 1, "%s, seq %d, Received %s blockette\n", timestamp, seqnum, type[packet_type]); archflag = 0; }