From 4e571746c155568599ecd6987998ba2c06ef332b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 28 May 2010 12:58:50 +0000 Subject: [PATCH] * 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 --- .../tools/analysis/lcov/default.nix | 5 +- .../tools/analysis/lcov/unexpected-eof.patch | 57 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/tools/analysis/lcov/unexpected-eof.patch diff --git a/pkgs/development/tools/analysis/lcov/default.nix b/pkgs/development/tools/analysis/lcov/default.nix index 14f5519c3a81..2e01a3a0784f 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 000000000000..c263f621808c --- /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($)