Regression from recent changes in OutputStream
!1432 (merged) modified the behaviour of OutputStream such that it tries to create the output file during start instead of the first time execute is invoked and there is something to write.
This behaves perfectly fine in normal cases, but there is one corner case when it causes a segfault while before it was working fine: when a default configured OutputStream is used, as in:
gaudirun.py --option "ApplicationMgr(OutStream=['OutputStream'])"
A default configured OutputStream is (was) essentially a no-op algorithm, because the properties ItemList and OptItemList are empty, so it is requested to write nothing nowhere. The code is somehow protected so that when (Opt)ItemList are empty OutputStream does not even try to connect the output file, so it ignores if the output file is not configured.
The change introduced in !1432 (merged) expects that the output file configuration is always handled, and the conversion service pointer (m_pConversionSvc) is set, but as explained, empty (Opt)ItemList cause that branch to be skipped and we get a segfault when we try to access the conversion service at start.
At this point the options are:
- protect
startto not create the output file if(Opt)ItemListis empty (actually it is enough to testm_pConversionSvcbefore using it)- this is restoring the old behaviour so that
gaudirun.py --option "ApplicationMgr(OutStream=['OutputStream'])"is equivalent togaudirun.py --option "ApplicationMgr(OutStream=[])"
- this is restoring the old behaviour so that
- ensure that whenever used
OutputStreamis correctly configured (withItemListandOutput)- this makes the use case
gaudirun.py --option "ApplicationMgr(OutStream=['OutputStream'])"invalid, which makes some sense as what is the point in configuring a no-opOutputStreamwhen it could be directly skipped?
- this makes the use case
I cannot decide which option to pick. The first resolves a regression, while the second changes the behaviour implicitly assuming that a no-op OutputStream is a bug rather than a feature.