Package: lcov
Version: 1.9-2
Severity: important
Tags: patch
User: them...@users.sourceforge.net

Dear Alastair,

Using lcov on gcc-4.7 generated code fails. That particular has already
been fixed in Fedora [1], along with another bug concerning the creation
of files containing the characters < and > in their name [2].

The attached debdiff contains the patches as applied to the Fedora
packages [3].


  * Apply Fedora patches by Daniel Berrange:
    - gcc-compat-4.7.patch: Fix compat with gcc 4.7
    - three-arg-open.patch: Replace 2 argument open with 3 argument open
  * Standards-Version: 3.9.3


Thanks for considering the patch.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=787502
[2] https://bugzilla.redhat.com/show_bug.cgi?id=706040
[3] 
http://pkgs.fedoraproject.org/gitweb/?p=lcov.git;a=commitdiff;h=25a274d9dbd6813b160e8c8c6ab12791dff8733e

-- System Information:
Debian Release: wheezy/sid
  APT prefers precise-updates
  APT policy: (500, 'precise-updates'), (500, 'precise-security'), (500, 
'precise'), (100, 'precise-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-24-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru lcov-1.9/debian/changelog lcov-1.9/debian/changelog
diff -Nru lcov-1.9/debian/control lcov-1.9/debian/control
--- lcov-1.9/debian/control	2010-10-08 15:25:21.000000000 +0200
+++ lcov-1.9/debian/control	2012-05-14 11:23:14.000000000 +0200
@@ -4,7 +4,7 @@
 Build-Depends: debhelper (>=7.0.50~)
 Maintainer: Alastair McKinstry <mckins...@debian.org>
 Homepage: http://ltp.sourceforge.net/coverage/lcov.php
-Standards-Version: 3.9.1
+Standards-Version: 3.9.3
 
 Package: lcov
 Architecture: all
diff -Nru lcov-1.9/debian/patches/gcc-compat-4.7.patch lcov-1.9/debian/patches/gcc-compat-4.7.patch
--- lcov-1.9/debian/patches/gcc-compat-4.7.patch	1970-01-01 01:00:00.000000000 +0100
+++ lcov-1.9/debian/patches/gcc-compat-4.7.patch	2012-05-14 11:16:30.000000000 +0200
@@ -0,0 +1,27 @@
+Subject: Fix compat with gcc 4.7
+Origin: vendor, http://pkgs.fedoraproject.org/gitweb/?p=lcov.git;a=blob_plain;f=lcov-1.9-gcc-compat-4.7.patch;hb=25a274d9dbd6813b160e8c8c6ab12791dff8733e
+Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=787502
+Author: Daniel Berrange <berra...@redhat.com>
+
+diff -rup lcov-1.9.orig/bin/geninfo lcov-1.9.new/bin/geninfo
+--- lcov-1.9.orig/bin/geninfo	2010-08-06 12:05:17.000000000 +0100
++++ lcov-1.9.new/bin/geninfo	2012-03-12 10:59:11.253999711 +0000
+@@ -63,6 +63,7 @@ our $lcov_url		= "http://ltp.sourceforge
+ our $gcov_tool		= "gcov";
+ our $tool_name		= basename($0);
+ 
++our $GCOV_VERSION_4_7_0	= 0x40700;
+ our $GCOV_VERSION_3_4_0	= 0x30400;
+ our $GCOV_VERSION_3_3_0	= 0x30300;
+ our $GCNO_FUNCTION_TAG	= 0x01000000;
+@@ -2903,6 +2904,10 @@ sub read_gcno_function_record(*$$$$)
+ 	graph_expect("function record");
+ 	# Skip ident and checksum
+ 	graph_skip($handle, 8, "function ident and checksum") or return undef;
++	if ($gcov_version >= $GCOV_VERSION_4_7_0) {
++	    # Skip extra word added by android 4.4.0 / gcc >= 4.7 toolchains.
++	    graph_skip($handle, 4, "android_4_4_0 extra word");
++	}
+ 	# Read function name
+ 	graph_expect("function name");
+ 	$function = read_gcno_string($handle, $big_endian);
diff -Nru lcov-1.9/debian/patches/series lcov-1.9/debian/patches/series
--- lcov-1.9/debian/patches/series	2010-10-13 01:14:21.000000000 +0200
+++ lcov-1.9/debian/patches/series	2012-05-14 11:03:58.000000000 +0200
@@ -4,3 +4,5 @@
 utf8-output.patch
 perl-nocaps.patch
 debian-changes-1.9-2
+gcc-compat-4.7.patch
+three-arg-open.patch
diff -Nru lcov-1.9/debian/patches/three-arg-open.patch lcov-1.9/debian/patches/three-arg-open.patch
--- lcov-1.9/debian/patches/three-arg-open.patch	1970-01-01 01:00:00.000000000 +0100
+++ lcov-1.9/debian/patches/three-arg-open.patch	2012-05-14 11:19:54.000000000 +0200
@@ -0,0 +1,162 @@
+Subject: Replace 2 argument open with 3 argument open
+Origin: vendor, http://pkgs.fedoraproject.org/gitweb/?p=lcov.git;a=blob_plain;f=lcov-1.9-three-arg-open.patch;hb=25a274d9dbd6813b160e8c8c6ab12791dff8733e
+Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=706040
+Author: Daniel Berrange <berra...@redhat.com>
+
+diff -rup lcov-1.9.orig/bin/geninfo lcov-1.9.new/bin/geninfo
+--- lcov-1.9.orig/bin/geninfo	2012-03-12 11:11:31.837992625 +0000
++++ lcov-1.9.new/bin/geninfo	2012-03-12 11:11:00.721000276 +0000
+@@ -424,7 +424,7 @@ if (defined($output_filename) && ($outpu
+ 	# Initially create output filename, data is appended
+ 	# for each data file processed
+ 	local *DUMMY_HANDLE;
+-	open(DUMMY_HANDLE, ">$output_filename")
++	open(DUMMY_HANDLE, ">", $output_filename)
+ 		or die("ERROR: cannot create $output_filename!\n");
+ 	close(DUMMY_HANDLE);
+ 
+@@ -906,7 +906,7 @@ sub process_dafile($$)
+ 		else
+ 		{
+ 			# Append to output file
+-			open(INFO_HANDLE, ">>$output_filename")
++			open(INFO_HANDLE, ">>", $output_filename)
+ 				or die("ERROR: cannot write to ".
+ 				       "$output_filename!\n");
+ 		}
+@@ -914,7 +914,7 @@ sub process_dafile($$)
+ 	else
+ 	{
+ 		# Open .info file for output
+-		open(INFO_HANDLE, ">$da_filename.info")
++		open(INFO_HANDLE, ">", "$da_filename.info")
+ 			or die("ERROR: cannot create $da_filename.info!\n");
+ 	}
+ 
+@@ -1267,7 +1267,7 @@ sub solve_ambiguous_match($$$)
+ 	{
+ 
+ 		# Compare file contents
+-		open(SOURCE, $filename)
++		open(SOURCE, "<", $filename)
+ 			or die("ERROR: cannot read $filename!\n");
+ 
+ 		$no_match = 0;
+@@ -1337,7 +1337,7 @@ sub read_gcov_header($)
+ 	my $object;
+ 	local *INPUT;
+ 
+-	if (!open(INPUT, $_[0]))
++	if (!open(INPUT, "<", $_[0]))
+ 	{
+ 		if ($ignore_errors[$ERROR_GCOV])
+ 		{
+@@ -1489,7 +1489,7 @@ sub read_gcov_file($)
+ 	my $last_line = 0;
+ 	local *INPUT;
+ 
+-	if (!open(INPUT, $filename)) {
++	if (!open(INPUT, "<", $filename)) {
+ 		if ($ignore_errors[$ERROR_GCOV])
+ 		{
+ 			warn("WARNING: cannot read $filename!\n");
+@@ -1669,7 +1669,7 @@ sub get_gcov_version()
+ 	my $version_string;
+ 	my $result;
+ 
+-	open(GCOV_PIPE, "$gcov_tool -v |")
++	open(GCOV_PIPE, "-|", "$gcov_tool -v")
+ 		or die("ERROR: cannot retrieve gcov version!\n");
+ 	$version_string = <GCOV_PIPE>;
+ 	close(GCOV_PIPE);
+@@ -1757,12 +1757,12 @@ sub system_no_output($@)
+ 	local *OLD_STDOUT;
+ 
+ 	# Save old stdout and stderr handles
+-	($mode & 1) && open(OLD_STDOUT, ">>&STDOUT");
+-	($mode & 2) && open(OLD_STDERR, ">>&STDERR");
++	($mode & 1) && open(OLD_STDOUT, ">>&", "STDOUT");
++	($mode & 2) && open(OLD_STDERR, ">>&", "STDERR");
+ 
+ 	# Redirect to /dev/null
+-	($mode & 1) && open(STDOUT, ">/dev/null");
+-	($mode & 2) && open(STDERR, ">/dev/null");
++	($mode & 1) && open(STDOUT, ">", "/dev/null");
++	($mode & 2) && open(STDERR, ">", "/dev/null");
+  
+ 	system(@_);
+ 	$result = $?;
+@@ -1772,8 +1772,8 @@ sub system_no_output($@)
+ 	($mode & 2) && close(STDERR);
+ 
+ 	# Restore old handles
+-	($mode & 1) && open(STDOUT, ">>&OLD_STDOUT");
+-	($mode & 2) && open(STDERR, ">>&OLD_STDERR");
++	($mode & 1) && open(STDOUT, ">>&", "OLD_STDOUT");
++	($mode & 2) && open(STDERR, ">>&", "OLD_STDERR");
+  
+ 	return $result;
+ }
+@@ -1794,7 +1794,7 @@ sub read_config($)
+ 	my $value;
+ 	local *HANDLE;
+ 
+-	if (!open(HANDLE, "<$filename"))
++	if (!open(HANDLE, "<", $filename))
+ 	{
+ 		warn("WARNING: cannot read configuration file $filename\n");
+ 		return undef;
+@@ -1866,7 +1866,7 @@ sub get_exclusion_data($)
+ 	my $flag = 0;
+ 	local *HANDLE;
+ 
+-	if (!open(HANDLE, "<$filename")) {
++	if (!open(HANDLE, "<", $filename)) {
+ 		warn("WARNING: could not open $filename\n");
+ 		return undef;
+ 	}
+@@ -2072,7 +2072,7 @@ sub process_graphfile($$)
+ 		else
+ 		{
+ 			# Append to output file
+-			open(INFO_HANDLE, ">>$output_filename")
++			open(INFO_HANDLE, ">>", $output_filename)
+ 				or die("ERROR: cannot write to ".
+ 				       "$output_filename!\n");
+ 		}
+@@ -2080,7 +2080,7 @@ sub process_graphfile($$)
+ 	else
+ 	{
+ 		# Open .info file for output
+-		open(INFO_HANDLE, ">$graph_filename.info")
++		open(INFO_HANDLE, ">", "$graph_filename.info")
+ 			or die("ERROR: cannot create $graph_filename.info!\n");
+ 	}
+ 
+@@ -2544,7 +2544,7 @@ sub read_bb($$)
+ 	my $graph;
+ 	local *HANDLE;
+ 
+-	open(HANDLE, "<$bb_filename") or goto open_error;
++	open(HANDLE, "<", $bb_filename) or goto open_error;
+ 	binmode(HANDLE);
+ 	while (!eof(HANDLE)) {
+ 		$value = read_bb_value(*HANDLE, "data word");
+@@ -2721,7 +2721,7 @@ sub read_bbg($$)
+ 	my $graph;
+ 	local *HANDLE;
+ 
+-	open(HANDLE, "<$bbg_filename") or goto open_error;
++	open(HANDLE, "<", $bbg_filename) or goto open_error;
+ 	binmode(HANDLE);
+ 	# Read magic
+ 	$word = read_bbg_value(*HANDLE, "file magic");
+@@ -2959,7 +2959,7 @@ sub read_gcno($$)
+ 	my $graph;
+ 	local *HANDLE;
+ 
+-	open(HANDLE, "<$gcno_filename") or goto open_error;
++	open(HANDLE, "<", $gcno_filename) or goto open_error;
+ 	binmode(HANDLE);
+ 	# Read magic
+ 	$word = read_gcno_word(*HANDLE, "file magic");

Reply via email to