Skip to content

Commit 1789981

Browse files
committed
Fix #283: callback parameters should be either single comma-separated string or list of individual arguments.
See Signed-off-by: Henry Cox <[email protected]>
1 parent 00b1654 commit 1789981

File tree

2 files changed

+58
-16
lines changed

2 files changed

+58
-16
lines changed

lib/lcovutil.pm

+6-1
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,12 @@ sub do_mangle_check
868868

869869
sub configure_callback
870870
{
871-
my @args = split($lcovutil::split_char, join($lcovutil::split_char, @_));
871+
# if there is just one argument, then assume it might be a
872+
# concatentation - otherwise, just use straight.
873+
my @args =
874+
1 == scalar(@_) ?
875+
split($lcovutil::split_char, join($lcovutil::split_char, @_)) :
876+
@_;
872877
my $script = $args[0];
873878
my $rtn;
874879
if ($script =~ /\.pm$/) {

man/genhtml.1

+52-15
Original file line numberDiff line numberDiff line change
@@ -532,21 +532,25 @@ if the source file is not found by the callback.
532532
.RE
533533

534534
.IP 2. 3
535-
The option may be specified as a
535+
The option may be specified as a single
536536
.I split_char
537-
separated string (see
537+
separated string which is divied into words (see
538538
.B man lcovrc(5)
539-
) - which is divied into words. The resulting command line is passed
540-
to a shell interpreter to run the script.
541-
This includes the script path followed by optional additional parameters
539+
), or as a list of arguments.
540+
The resulting command line is passed
541+
to a shell interpreter to be executed.
542+
The command line includes the script path followed by optional additional parameters
542543
separated by spaces. Care must be taken to provide proper quoting if script
543544
path or any parameter contains spaces or shell special characters.
544545
.PP
545546

546547
.IP 3. 3
547-
If an option is specified multiple times, all of the parameters are
548-
split as described above, then concatentated to form the command line.
548+
If an option is specified multiple times, then the parameters are
549+
.I not
550+
split, but are simply concatentated to form the command line - see the examples, below.
549551
.br
552+
For simplicity and ease of understanding: your command line should
553+
pass all arguments individually, or all as a comma-separated list - not a mix of the two.
550554
.PP
551555

552556
.IP 4. 3
@@ -562,19 +566,19 @@ Example:
562566
.RS
563567
genhtml --annotate-script /bin/script.sh
564568
.br
565-
--annotate-script "full" ...
569+
--annotate-script arg0 ...
566570
.br
567571

568572
results in the same callback as
569573

570574
.br
571-
genhtml --annotate-script "/bin/script.sh full" ...
575+
genhtml --annotate-script "/bin/script.sh arg0" ...
572576
.br
573577

574578
or
575579

576580
.br
577-
genhtml --annotate-script /bin/script.sh,full ...
581+
genhtml --annotate-script /bin/script.sh,arg0 ...
578582
.br
579583

580584
Note that the first form is preferred.
@@ -587,7 +591,7 @@ callback executes the command line:
587591
.br
588592

589593
.RS
590-
/bin/script.sh "full"
594+
/bin/script.sh arg0
591595
.I source_file_name
592596
.RE
593597
.br
@@ -598,13 +602,13 @@ Similarly
598602
genhtml --annotate-script
599603
.I /bin/myMoodule.pm
600604
.br
601-
--annotate-script "full" ...
605+
--annotate-script arg0 --annotate-script arg1 ...
602606
.br
603607

604608
or
605609
.br
606610
genhtml --annotate-script
607-
.I /bin/myMoodule.pm,full
611+
.I /bin/myMoodule.pm,arg0,arg1
608612
.br
609613

610614
.br
@@ -616,10 +620,14 @@ executing
616620
.br
617621

618622
.RS
619-
$annotateCallback = myModule->new("full");
623+
$annotateCallback = myModule->new(arg0, arg1);
620624
.RE
621625

622-
to initialize the class object, and then to execute
626+
to initialize the class object -
627+
.I arg0
628+
and
629+
.I arg1
630+
passed as strings - and then to execute
623631

624632
.RS
625633
($status, $arrayRef) = $annotateCallback(
@@ -629,6 +637,35 @@ to initialize the class object, and then to execute
629637

630638
to retrieve the annotation information.
631639

640+
In contrast, the command
641+
.br
642+
.RS
643+
genhtml --annotate-script
644+
.I /bin/myMoodule.pm
645+
.br
646+
--annotate-script arg0,arg1 ...
647+
.RE
648+
would result in
649+
.B genhtml
650+
initializing the callback object via
651+
.br
652+
653+
.RS
654+
$annotateCallback = myModule->new("arg0,arg1");
655+
.RE
656+
where "arg0,arg1" is passed as single comma-separated string.
657+
658+
Similarly, the command
659+
.br
660+
.RS
661+
genhtml --annotate-script
662+
.I /bin/myMoodule.pm,arg0
663+
.br
664+
--annotate-script arg1 ...
665+
.RE
666+
would very likely result in an error when genhtml tries to find
667+
a script called "/bin/mymodule.pm,arg0".
668+
632669

633670
Note that multiple instances of each script may execute simultaneously if the
634671
.B \-\-parallel

0 commit comments

Comments
 (0)