Miniseed file accidentally recognised as tar

Hi all,

I have attached a small miniseed file which cannot be read by obspy. After some debugging, I found out that the problem lies in obspy/core/util/decorator.py

It has a function "uncompress_file" which serves as a decorator to _read in stream.py. Obviously, the file is recognised as tar and treated as such despite the fact that it is not. I suppose a simple test whether any data was read successfully from the tar file would prevent this problem.

Kind reagards

Roman Racine

wrongmseed.py (68 Bytes)

Hi Roman,

can you send us the actual file as well or open an issue on Github?

It is a bit strange as all files that are opened with ObsPy go through
that decorator and don't get false positives for the tarfile detection.
So we either have to improve the detection or something else is wrong.

Cheers!

Lion

Hi Lion,

oops, I have attached the wrong file. I have attached the miniseed file now.

Kind regards

Roman

wrongcheck.mseed (7 KB)

Can we use the file as part of a regression test in ObsPy? e.g. it will
then be included in ObsPy to make sure this never happens again.

Hi Lion,

yes, sure.

Kind regards

Roman

Great. Here you go then: https://github.com/obspy/obspy/pull/1436

The fix will be included in the next ObsPy bugfix release.

The file is interesting as the header by pure chance mimics a tar file
thus ObsPy thinks it is one. You can also try to unpack it with the
`tar` CLI tool - it will start to unpack but complain that it is corrupt :wink:

Cheers!

Lion