In recent psrchive (at least 2021-02-23 and later), running psrstat on a file with no other command line options results in segfault. If -c options are added it seems to work fine. I haven't tracked down exactly what is happening, but gdb backtrace from the segfault seems to implicate some of the new statistics code (see below). I've attached one example file where this happens. Let me know if there is any other info that would help!
(gdb) bt
#0 UnaryStatistics::Minimum::get (this=<optimized out>, data=...) at /home/pdemores/miniconda3/envs/dev/x86_64-conda-linux-gnu/include/c++/9.3.0/bits/stl_iterator.h:819
#1 0x00007faf8202ce87 in Pulsar::PhaseWeightStatistic::get (this=0x7faf835db9b0, prof=<optimized out>) at ../../local_include/ReferenceTo.h:57
#2 0x00007faf8202a605 in Functor<double (Pulsar::PhaseWeight const*), __functor_empty, __functor_empty>::Method<Pulsar::PhaseWeightStatistic, double (Pulsar::PhaseWeightStatistic::*)(Pulsar::PhaseWeight const*)>::call(Pulsar::PhaseWeight const* const&) const (this=0x7faf835dc920, p1=@0x7fff3994a098: 0x7faf833c1df0) at ../../local_include/ReferenceTo.h:60
#3 0x00007faf8202ab39 in Functor<double (Pulsar::PhaseWeight const*), __functor_empty, __functor_empty>::operator()(Pulsar::PhaseWeight const* const&) const (p1=@0x7fff3994a098: 0x7faf833c1df0,
this=<optimized out>) at ../../local_include/ReferenceTo.h:57
#4 TextInterface::UnaryGet<Pulsar::PhaseWeight, Functor<double (Pulsar::PhaseWeight const*), __functor_empty, __functor_empty> >::get_value[abi:cxx11](Pulsar::PhaseWeight const*) const (
this=<optimized out>, ptr=<optimized out>) at ../../local_include/TextInterfaceTo.h:59
#5 0x00007faf820466cd in TextInterface::HasAProxy<Pulsar::ProfileStats, Pulsar::PhaseWeight, Pulsar::PhaseWeight* (Pulsar::ProfileStats::*)()>::get_value[abi:cxx11](Pulsar::ProfileStats const*) const (
this=0x7faf835e1ee0, ptr=<optimized out>) at ../../local_include/ReferenceTo.h:57
#6 0x00007faf8206d2e5 in TextInterface::HasAProxy<Pulsar::Statistics, Pulsar::ProfileStats, Pulsar::ProfileStats* (Pulsar::Statistics::*)()>::get_value[abi:cxx11](Pulsar::Statistics const*) const (
this=0x7faf835e1dc0, ptr=<optimized out>) at ../../local_include/ReferenceTo.h:57
#7 0x00007faf8206a577 in TextInterface::Attribute<Pulsar::Statistics>::get_value[abi:cxx11]() const (this=<optimized out>) at ../../local_include/TextInterfaceAttribute.h:32
#8 0x00007faf8251095a in TextInterface::Parser::get_name_value (this=this@entry=0x7faf833c3f50, name=...) at TextInterface.C:234
#9 0x00007faf82510a21 in TextInterface::Parser::get_value (this=this@entry=0x7faf833c3f50, name=...) at TextInterface.C:212
#10 0x00007faf8251160f in TextInterface::Parser::help[abi:cxx11](bool, bool, char const*) (this=0x7faf833c3f50, default_value=<optimized out>, print_header=<optimized out>, indent=<optimized out>)
at /home/pdemores/miniconda3/envs/dev/x86_64-conda-linux-gnu/include/c++/9.3.0/ext/new_allocator.h:89
#11 0x00007faf825e672b in psrstat::process (this=this@entry=0x7fff3994a580, _archive=<optimized out>) at ../../local_include/ReferenceTo.h:57
#12 0x00007faf81b5a8fc in Pulsar::Application::run (this=0x7fff3994a580) at ../../local_include/ReferenceTo.h:60
#13 0x00007faf81b5a531 in Pulsar::Application::main (this=0x7fff3994a580, argc=<optimized out>, argv=<optimized out>) at Application.C:216
#14 0x00007faf825e94b6 in main (argc=2, argv=0x7fff3994a898) at psrstat.C:83
Hi Paul,
Thanks for attaching a file that demonstrates the problem. I've checked in a fix (29373ef4d..96b8d4477).
Cheers,
Willem
... this bug was happening in the PhaseWeightStatistic class, which is a wrapper around the UnaryStatistic class.
PhaseWeightStatistic::get calls PhaseWeight::get_filtered, which can return an empty vector. When an empty vector is passed to the UnaryStatistic child (in this case, the Minimum class) it causes a segfault. PhaseWeightStatistic::get now checks for an empty vector and returns nan().
Thanks Willem!