Bug #5864
openLibosmocore: Fix order of config parsing output
0%
Description
In libosmocore/src/vty/vty.c: 1514
when calling vty_read_config_filep()
, we use fprintf()
to print to stderr
.
Generally, config_from_file(vty, confp)
will call parsing callbacks up the callstack, which instead of fprintf()
will use vty_out()
, resulting in all the parsing output from those sections of code for parsing functions of previous lines to be printed after vty_read_config_filep()
returns.
In my case, I had a warning (which wasn't a warning as in CMD_WARNING
being printed) from line 18 of the config file attached printed after vty_read_config_filep()
gave me an error message for line 135 of said config file, with the specific error message for line 135 being printed after said warning
$ './src/osmo-bsc/osmo-bsc' '-r' 'tmp_dummy_sock' '-c' './tests/ctrl/osmo-bsc-neigh-test.cfg' Error occurred during reading the below line: bts 17 T3212 = 5 * 6min (Periodic Location Update timer, sent to MS (1 = 6 minutes)) % Warning: The CTRL interface for Neighbor Address Resolution is now deprecated.Upgrade osmo-pcu and drop the 'neighbor-resolution bind (A.B.C.D|X:X::X:X) [<0-65535>]' VTY option in order to let osmo-pcu use the new resoluton method using the PCUIF over IPA multiplex, which will work out of the box without required configuration. % The next unused BTS number is 2 <0004> osmo_bsc_main.c:486 Failed to parse the config file: './tests/ctrl/osmo-bsc-neigh-test.cfg' Bootstrapping the network failed. exiting.
I think it would be much better to suppress the output from vty_read_config_filep
and instead print the line along with the error message from osmo_bsc_main.c
, e.g.
$ './src/osmo-bsc/osmo-bsc' '-r' 'tmp_dummy_sock' '-c' 'tests/ctrl/osmo-bsc-neigh-test.cfg' T3212 = 5 * 6min (Periodic Location Update timer, sent to MS (1 = 6 minutes)) % Warning: The CTRL interface for Neighbor Address Resolution is now deprecated.Upgrade osmo-pcu and drop the 'neighbor-resolution bind (A.B.C.D|X:X::X:X) [<0-65535>]' VTY option in order to let osmo-pcu use the new resoluton method using the PCUIF over IPA multiplex, which will work out of the box without required configuration. % The next unused BTS number is 2 <0004> osmo_bsc_main.c:486 Failed to parse statement at ./tests/ctrl/osmo-bsc-neigh-test.cfg:18 <0004> osmo_bsc_main.c:486 ' bts 17' Bootstrapping the network failed. exiting.
Or if that would mean too much work with the other libs used, as an alternative, print to the vty buffer, so that a more sensible order of logging is preserved (not sure if that's possible, but if all the functions up the call stack do, then I would assume that vty_read_config_filep
can do that, as well).
$ './src/osmo-bsc/osmo-bsc' '-r' 'tmp_dummy_sock' '-c' 'tests/ctrl/osmo-bsc-neigh-test.cfg' T3212 = 5 * 6min (Periodic Location Update timer, sent to MS (1 = 6 minutes)) % Warning: The CTRL interface for Neighbor Address Resolution is now deprecated.Upgrade osmo-pcu and drop the 'neighbor-resolution bind (A.B.C.D|X:X::X:X) [<0-65535>]' VTY option in order to let osmo-pcu use the new resoluton method using the PCUIF over IPA multiplex, which will work out of the box without required configuration. % The next unused BTS number is 2 % Error occurred during reading the below line: % bts 17 <0004> osmo_bsc_main.c:486 Failed to parse statement at ./tests/ctrl/osmo-bsc-neigh-test.cfg:18 Bootstrapping the network failed. exiting.
Files
Updated by arehbein over 1 year ago
- Subject changed from Libosmocore: Fix order of output to Libosmocore: Fix order of config parsing output