cli_wallet core dumps when cli_wallet -v is used #278

Closed
opened 2022-02-15 10:36:18 +00:00 by bobinson · 8 comments
bobinson commented 2022-02-15 10:36:18 +00:00 (Migrated from gitlab.com)

Behaviour is shown below:

bunker@son-hive:~/peerplays-testnet$ ./cli_wallet -v
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::unknown_option> >'
  what():  unrecognised option '-v'
Aborted (core dumped)

Expected behavior:

When a non-existent value is passed on to the program as command line argument, it should not crash the program but it should be handled.

Version and environment information:

bunker@son-hive:~/peerplays-testnet$ ./witness_node -v
Version: test-1.5.4-48-g732cae96
Git Revision: 732cae963d97756c3abd4e4b6ffe332c2bc8a82c
Built: Dec  2 2021 at 14:47:06
SSL: OpenSSL 1.1.1  11 Sep 2018
Boost: 1.67
Linux son-hive.public 4.15.0-161-generic #169-Ubuntu SMP Fri Oct 15 13:41:54 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Behaviour is shown below: ``` bunker@son-hive:~/peerplays-testnet$ ./cli_wallet -v terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::unknown_option> >' what(): unrecognised option '-v' Aborted (core dumped) ``` Expected behavior: When a non-existent value is passed on to the program as command line argument, it should not crash the program but it should be handled. Version and environment information: ``` bunker@son-hive:~/peerplays-testnet$ ./witness_node -v Version: test-1.5.4-48-g732cae96 Git Revision: 732cae963d97756c3abd4e4b6ffe332c2bc8a82c Built: Dec 2 2021 at 14:47:06 SSL: OpenSSL 1.1.1 11 Sep 2018 Boost: 1.67 ``` ``` Linux son-hive.public 4.15.0-161-generic #169-Ubuntu SMP Fri Oct 15 13:41:54 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux ```
serkixenos commented 2022-02-15 13:12:25 +00:00 (Migrated from gitlab.com)

assigned to @serkixenos

assigned to @serkixenos
serkixenos commented 2022-02-15 14:49:37 +00:00 (Migrated from gitlab.com)

assigned to @prandnum

assigned to @prandnum
serkixenos commented 2022-02-15 14:52:03 +00:00 (Migrated from gitlab.com)

Use develop branch for testing.

cli_wallet whould give version output with both long and short parameter

 ./cli_wallet --version
Version: test-1.5.4-95-gfcd360c2
Git Revision: fcd360c2fdb9a9a97657cfcc46165c133ff08ef4
Built: Feb 15 2022 at 09:12:04
SSL: OpenSSL 1.1.1f  31 Mar 2020
Boost: 1.67


$ ./cli_wallet -v
Version: test-1.5.4-95-gfcd360c2
Git Revision: fcd360c2fdb9a9a97657cfcc46165c133ff08ef4
Built: Feb 15 2022 at 09:12:04
SSL: OpenSSL 1.1.1f  31 Mar 2020
Boost: 1.67
Use develop branch for testing. cli_wallet whould give version output with both long and short parameter ``` ./cli_wallet --version Version: test-1.5.4-95-gfcd360c2 Git Revision: fcd360c2fdb9a9a97657cfcc46165c133ff08ef4 Built: Feb 15 2022 at 09:12:04 SSL: OpenSSL 1.1.1f 31 Mar 2020 Boost: 1.67 $ ./cli_wallet -v Version: test-1.5.4-95-gfcd360c2 Git Revision: fcd360c2fdb9a9a97657cfcc46165c133ff08ef4 Built: Feb 15 2022 at 09:12:04 SSL: OpenSSL 1.1.1f 31 Mar 2020 Boost: 1.67 ```
prandnum commented 2022-02-16 03:58:42 +00:00 (Migrated from gitlab.com)

Version part is handled as shown below:

qa@PBSA-Dev:~/15022022/peerplays/programs/cli_wallet$ ./cli_wallet --version
Version: test-1.5.4-97-g8be4dd5e
Git Revision: 8be4dd5e3ca2997540a7c184de996f4befb021db
Built: Feb 15 2022 at 13:36:19
SSL: OpenSSL 1.1.1  11 Sep 2018
Boost: 1.67
qa@PBSA-Dev:~/15022022/peerplays/programs/cli_wallet$ ./cli_wallet --v
Version: test-1.5.4-97-g8be4dd5e
Git Revision: 8be4dd5e3ca2997540a7c184de996f4befb021db
Built: Feb 15 2022 at 13:36:19
SSL: OpenSSL 1.1.1  11 Sep 2018
Boost: 1.67
qa@PBSA-Dev:~/15022022/peerplays/programs/cli_wallet$

but "When a non-existent value is passed on to the program as command line argument, it should not crash the program but it should be handled." this is not taken care. Essentially we should not core dump when the option is not known to the program(in this case --chainid).

qa@PBSA-Dev:~/15022022/peerplays/programs/cli_wallet$ ./cli_wallet --chainid
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::unknown_option> >'
  what():  unrecognised option '--chainid'
Aborted (core dumped)
qa@PBSA-Dev:~/15022022/peerplays/programs/cli_wallet$
Version part is handled as shown below: ``` qa@PBSA-Dev:~/15022022/peerplays/programs/cli_wallet$ ./cli_wallet --version Version: test-1.5.4-97-g8be4dd5e Git Revision: 8be4dd5e3ca2997540a7c184de996f4befb021db Built: Feb 15 2022 at 13:36:19 SSL: OpenSSL 1.1.1 11 Sep 2018 Boost: 1.67 qa@PBSA-Dev:~/15022022/peerplays/programs/cli_wallet$ ./cli_wallet --v Version: test-1.5.4-97-g8be4dd5e Git Revision: 8be4dd5e3ca2997540a7c184de996f4befb021db Built: Feb 15 2022 at 13:36:19 SSL: OpenSSL 1.1.1 11 Sep 2018 Boost: 1.67 qa@PBSA-Dev:~/15022022/peerplays/programs/cli_wallet$ ``` but "When a non-existent value is passed on to the program as command line argument, it should not crash the program but it should be handled." this is not taken care. Essentially we should not core dump when the option is not known to the program(in this case --chainid). ``` qa@PBSA-Dev:~/15022022/peerplays/programs/cli_wallet$ ./cli_wallet --chainid terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::unknown_option> >' what(): unrecognised option '--chainid' Aborted (core dumped) qa@PBSA-Dev:~/15022022/peerplays/programs/cli_wallet$ ```
serkixenos commented 2022-02-16 13:37:58 +00:00 (Migrated from gitlab.com)

This behavior is related to the way Boos program_options are implemented. However, it is possible to allow unknown options:

https://www.boost.org/doc/libs/1_67_0/doc/html/program_options/howto.html#id-1.3.31.6.9

This behavior is related to the way Boos program_options are implemented. However, it is possible to allow unknown options: https://www.boost.org/doc/libs/1_67_0/doc/html/program_options/howto.html#id-1.3.31.6.9
serkixenos commented 2022-02-16 17:31:28 +00:00 (Migrated from gitlab.com)

Related commit
639e242693

Please retest on develop branch

Related commit https://gitlab.com/PBSA/peerplays/-/commit/639e242693d2a501a7dec1e978aa00371d806e46 Please retest on develop branch
serkixenos commented 2022-02-16 17:33:54 +00:00 (Migrated from gitlab.com)

Expected output is similar to this

$ ./cli_wallet --abcd --efgh --ijkl
Unknown parameter(s): 
  --abcd
  --efgh
  --ijkl
Expected output is similar to this ``` $ ./cli_wallet --abcd --efgh --ijkl Unknown parameter(s): --abcd --efgh --ijkl ```
prandnum commented 2022-02-18 04:52:32 +00:00 (Migrated from gitlab.com)

verified:

qa@PBSA-Dev:~/Pipeline472760902/build/programs/cli_wallet$ ./cli_wallet --chainid
Unknown parameter(s):
  --chainid
qa@PBSA-Dev:~/Pipeline472760902/build/programs/cli_wallet$ ./cli_wallet --chainid --erew
Unknown parameter(s):
  --chainid
  --erew
qa@PBSA-Dev:~/Pipeline472760902/build/programs/cli_wallet$ ./cli_wallet --chainid --erew --rpc-endpoint1
Unknown parameter(s):
  --chainid
  --erew
  --rpc-endpoint1
qa@PBSA-Dev:~/Pipeline472760902/build/programs/cli_wallet$ ./cli_wallet --chainid --erew --rpc-endpoint1 --server-rpc-user 23
Unknown parameter(s):
  --chainid
  --erew
  --rpc-endpoint1
qa@PBSA-Dev:~/Pipeline472760902/build/programs/cli_wallet$ ./cli_wallet --chainid --erew --rpc-endpoint1 --server-rpc-user11
Unknown parameter(s):
  --chainid
  --erew
  --rpc-endpoint1
  --server-rpc-user11
qa@PBSA-Dev:~/Pipeline472760902/build/programs/cli_wallet$
verified: ``` qa@PBSA-Dev:~/Pipeline472760902/build/programs/cli_wallet$ ./cli_wallet --chainid Unknown parameter(s): --chainid qa@PBSA-Dev:~/Pipeline472760902/build/programs/cli_wallet$ ./cli_wallet --chainid --erew Unknown parameter(s): --chainid --erew qa@PBSA-Dev:~/Pipeline472760902/build/programs/cli_wallet$ ./cli_wallet --chainid --erew --rpc-endpoint1 Unknown parameter(s): --chainid --erew --rpc-endpoint1 qa@PBSA-Dev:~/Pipeline472760902/build/programs/cli_wallet$ ./cli_wallet --chainid --erew --rpc-endpoint1 --server-rpc-user 23 Unknown parameter(s): --chainid --erew --rpc-endpoint1 qa@PBSA-Dev:~/Pipeline472760902/build/programs/cli_wallet$ ./cli_wallet --chainid --erew --rpc-endpoint1 --server-rpc-user11 Unknown parameter(s): --chainid --erew --rpc-endpoint1 --server-rpc-user11 qa@PBSA-Dev:~/Pipeline472760902/build/programs/cli_wallet$ ```
prandnum (Migrated from gitlab.com) closed this issue 2022-02-18 04:52:33 +00:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Peerplays_Blockchain/peerplays_migrated#278
No description provided.