about summary refs log tree commit diff
path: root/pkgs/development/tools/analysis
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2010-05-28 12:58:50 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2010-05-28 12:58:50 +0000
commit4e571746c155568599ecd6987998ba2c06ef332b (patch)
tree9506d80d0bc05827cc8a51ed31f212f2e6c4feb2 /pkgs/development/tools/analysis
parent1ba3165b4e95fccbb9d46429b5557966a05c3420 (diff)
* Apply an upstream patch to fix the "reached unexpected end of file"
  errors processing gcno files (e.g. http://hydra.nixos.org/build/410894).

svn path=/nixpkgs/trunk/; revision=22047
Diffstat (limited to 'pkgs/development/tools/analysis')
-rw-r--r--pkgs/development/tools/analysis/lcov/default.nix5
-rw-r--r--pkgs/development/tools/analysis/lcov/unexpected-eof.patch57
2 files changed, 61 insertions, 1 deletions
diff --git a/pkgs/development/tools/analysis/lcov/default.nix b/pkgs/development/tools/analysis/lcov/default.nix
index 14f5519c3a81b..2e01a3a0784f4 100644
--- a/pkgs/development/tools/analysis/lcov/default.nix
+++ b/pkgs/development/tools/analysis/lcov/default.nix
@@ -8,7 +8,10 @@ stdenv.mkDerivation rec {
     sha256 = "1xrd9abh1gyki9ln9v772dq7jinvyrvx39s3kxbpiila68mbpa7j";
   };
 
-  patches = [ ./find-source.patch ];
+  patches =
+    [ ./unexpected-eof.patch
+      ./find-source.patch
+    ];
 
   preBuild = ''
     makeFlagsArray=(PREFIX=$out BIN_DIR=$out/bin MAN_DIR=$out/share/man)
diff --git a/pkgs/development/tools/analysis/lcov/unexpected-eof.patch b/pkgs/development/tools/analysis/lcov/unexpected-eof.patch
new file mode 100644
index 0000000000000..c263f621808c2
--- /dev/null
+++ b/pkgs/development/tools/analysis/lcov/unexpected-eof.patch
@@ -0,0 +1,57 @@
+From http://ltp.cvs.sourceforge.net/viewvc/ltp/utils/analysis/lcov/bin/geninfo?revision=1.72&view=markup
+
+Fixes "reached unexpected end of file" errors processing gcno files.
+
+
+--- a/bin/geninfo	2010/01/29 11:07:25	1.71
++++ b/bin/geninfo	2010/02/21 14:56:46	1.72
+@@ -2857,6 +2857,9 @@
+ 	# Skip version and stamp
+ 	graph_skip(*HANDLE, 8, "version and stamp") or goto incomplete;
+ 	while (!eof(HANDLE)) {
++		my $next_pos;
++		my $curr_pos;
++
+ 		# Read record tag
+ 		$tag = read_gcno_value(*HANDLE, $big_endian, "record tag");
+ 		goto incomplete if (!defined($tag));
+@@ -2866,6 +2869,11 @@
+ 		goto incomplete if (!defined($length));
+ 		# Convert length to bytes
+ 		$length *= 4;
++		# Calculate start of next record
++		$next_pos = tell(HANDLE);
++		goto tell_error if ($next_pos == -1);
++		$next_pos += $length;
++		# Process record
+ 		if ($tag == $tag_function) {
+ 			($filename, $function) = read_gcno_function_record(
+ 				*HANDLE, $bb, $fileorder, $base, $big_endian);
+@@ -2882,6 +2890,14 @@
+ 			graph_skip(*HANDLE, $length, "unhandled record")
+ 				or goto incomplete;
+ 		}
++		# Ensure that we are at the start of the next record
++		$curr_pos = tell(HANDLE);
++		goto tell_error if ($curr_pos == -1);
++		next if ($curr_pos == $next_pos);
++		goto record_error if ($curr_pos > $next_pos);
++		graph_skip(*HANDLE, $next_pos - $curr_pos,
++			   "unhandled record content")
++			or goto incomplete;
+ 	}
+ 	close(HANDLE);
+ 	($instr, $graph) = graph_from_bb($bb, $fileorder, $gcno_filename);
+@@ -2898,6 +2914,12 @@
+ magic_error:
+ 	graph_error($gcno_filename, "found unrecognized gcno file magic");
+ 	return undef;
++tell_error:
++	graph_error($gcno_filename, "could not determine file position");
++	return undef;
++record_error:
++	graph_error($gcno_filename, "found unrecognized record format");
++	return undef;
+ }
+ 
+ sub debug($)