dskvr / opkg

Automatically exported from code.google.com/p/opkg
0 stars 0 forks source link

Segfault in opkg-cl while using verbosity option #57

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

What steps will reproduce the problem?
1. opkg-cl --verbosity 4 => segfault

What version of the product are you using? On what operating system?
opkg, revision 549

Please provide any additional information below.
Option management is weird here : the long option --verbosity has an optional 
argument while the short option -V requires an argument. Therefore, optarg may 
be set to NULL in the switch handling arguments. The atoi(optarg) leads to a 
segfault

In the following patch, I set the argument of the -V option as optional, and I 
use 1 as default verbosity level. Since the syntax of opkg-cl has to be 
modified, I updated the help text. 

Original issue reported on code.google.com by david.ba...@grassvalley.com on 11 Aug 2010 at 10:08

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for finding this. Although I'm not sure I understand why you've done 
this bit:

    while (1) {
-       c = getopt_long_only(argc, argv, "Ad:f:no:p:t:vV:",
+       c = getopt_long_only(argc, argv, "Ad:f:no:p:t:vV::",
                long_options, &option_index);

Also, I think the default verbosity should be 2, as 1 is the normal versbosity 
without any -V parameter and getting the same verbosity would be confusing.

Original comment by graham.g...@gmail.com on 11 Aug 2010 at 11:25

GoogleCodeExporter commented 8 years ago
I should read the getopt man page before asking about a change.... "Two colons 
mean an option takes an optional arg".

Original comment by graham.g...@gmail.com on 11 Aug 2010 at 11:36

GoogleCodeExporter commented 8 years ago
I've applied your change, but made the fallback verbosity=INFO (2) when no -V 
parameter is given. Thanks.

Original comment by graham.g...@gmail.com on 12 Aug 2010 at 12:41