Skip to content

Commit c3be5b6

Browse files
Peter Oberparleiteroberpar
authored andcommitted
lcov: fix whitespace handling in --rc command line option
Specifying blanks around --rc options results in the options not being correctly recognized, for example: This doesn't work: geninfo . -o - --rc="geninfo_adjust_src_path = /tmp => /usr" This works: geninfo . -o - --rc="geninfo_adjust_src_path=/tmp => /usr" Fix this by automatically removing whitespaces at the start and end of --rc options and values.
1 parent 4699f8d commit c3be5b6

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

bin/geninfo

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ if( $^O eq "msys" )
6161
}
6262

6363
# Constants
64-
our $lcov_version = 'LCOV version 1.11 pre (CVS $Revision: 1.120 $)';
64+
our $lcov_version = 'LCOV version 1.11 pre (CVS $Revision: 1.121 $)';
6565
our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
6666
our $gcov_tool = "gcov";
6767
our $tool_name = basename($0);
@@ -275,6 +275,16 @@ GetOptions("config-file=s" => \$opt_config_file,
275275
"rc=s%" => \%opt_rc);
276276
Getopt::Long::Configure("default");
277277

278+
# Remove spaces around rc options
279+
while (my ($key, $value) = each(%opt_rc)) {
280+
delete($opt_rc{$key});
281+
282+
$key =~ s/^\s+|\s+$//g;
283+
$value =~ s/^\s+|\s+$//g;
284+
285+
$opt_rc{$key} = $value;
286+
}
287+
278288
# Read configuration file if available
279289
if (defined($opt_config_file)) {
280290
$config = read_config($opt_config_file);

bin/lcov

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ use Cwd qw /abs_path getcwd/;
7171

7272

7373
# Global constants
74-
our $lcov_version = 'LCOV version 1.11 pre (CVS $Revision: 1.95 $)';
74+
our $lcov_version = 'LCOV version 1.11 pre (CVS $Revision: 1.96 $)';
7575
our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
7676
our $tool_name = basename($0);
7777

@@ -228,6 +228,16 @@ GetOptions("config-file=s" => \$opt_config_file,
228228
"rc=s%" => \%opt_rc);
229229
Getopt::Long::Configure("default");
230230

231+
# Remove spaces around rc options
232+
while (my ($key, $value) = each(%opt_rc)) {
233+
delete($opt_rc{$key});
234+
235+
$key =~ s/^\s+|\s+$//g;
236+
$value =~ s/^\s+|\s+$//g;
237+
238+
$opt_rc{$key} = $value;
239+
}
240+
231241
# Read configuration file if available
232242
if (defined($opt_config_file)) {
233243
$config = read_config($opt_config_file);

0 commit comments

Comments
 (0)