[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#120268: e2recover is defective



e2recover 1.0 is defective when used with debugfs 1.27, which comes with
e2fsprogs 1.27-2. In particular, the output syntax of debugs fs was
changed into a new format. After preparing a patch to use the new
syntax, it was confirmed that e2recover was not fully functional. On top
of that, upstream has not responded at all in reporting this bug.


As a result, Martin and I decided not to package e2recover.

Here is some more info:

<copying in some e-mail thread>

After doing some more testing with md5sums of binary files, I don't see
e2recover working correctly; it seemed to work with text files, but... I
most likely dont' understand enough why it is failing to output the
correct binary files deleted, and I'm guessing that's something the
upstream author should be doing. I did notice a few weird things too,
like this line outputed by debugfs:

BLOCKS:
(0-11):66-77, (IND):78, (12-42):79-109, (DIND):335, (IND):-1202711157

negative value for the number of an indirect block. Hmm...

<end of copying some e-mail thread>


Attached is the patch that was used in preparation of the package,
should that ever be useful
--- e2recover-1.0/e2recover	Tue Oct 22 23:48:20 2002
+++ /usr/bin/e2recover	Tue Oct 22 23:45:51 2002
@@ -332,8 +332,10 @@
     else {
 	s.^\s+..;		# remove leading white space
 	s./\s*. .;		# turn the `N/N blocks' stuff into separate fields
+	my @temp;
+	@temp = split();
 
-	if (scalar(split()) != 11) {
+	if (scalar( @temp ) != 11) {
 	    print "ignoring unrecognised line: $_\n";
 	    next Lsdel;
 	}
@@ -378,14 +380,51 @@
 		elsif (m/^blocks:/i) {
 		    while (defined ($stat = <STAT>)) {
 			last Stat if $stat =~ m/^total:/i;
-			push @blocks, split(/\s+/, $stat);
+
+			# This is a necessary hack due to the change of the
+			# output format by debugfs 1.27. The "BLOCKS" section
+			# now spits out:
+			#
+			# BLOCKS:
+			# (0-2):20-22
+			#
+			# while it used to spit out:
+			# BLOCKS:
+			# 20 21 22
+			#
+			# It may also spit out:
+			# (0-11):633-644, (IND):645, (12-46):646-680
+			#
+
+			foreach my $indmatch ( m/\(IND\):(\d)*,/g ) {
+			  # Account for each indirect block
+			  push @blocks, $1;
+			}
+
+			# Strip down the IND blocks
+			$stat =~ s/\(IND\):(\d)*,//g;
+
+			# Process each block range
+			foreach my $range ( split(/, /, $stat) ) {
+			  # Strip down the number of blocks
+			  $range =~ s/.*://;
+			  my @temp2 = split(/-/, $range);
+			  my @to_be_pushed;
+			  my $counter = $temp2[0];
+
+			  while ( $counter <= $temp2[-1] ) {
+			    push @to_be_pushed, $counter;
+			    $counter++;
+			  }
+			  push @blocks, @to_be_pushed;
+			}
 		    }
 		}
 		else {
 		    print "ignoring inode with unrecognised debugfs stat output: $stat\n";
 		    next Lsdel;
 		}
-	    }
+	      }
 	}
 	close STAT;
 
@@ -393,7 +432,10 @@
 			     . (($device =~ m:^.*/(.*)$:) ? $1 : $device)
 			     . ".$inode");
 
-	if ($block_count < @blocks) {
+	if (!defined($block_count)) {
+	  print "skipping inode $inode -- no blocks found\n";
+	}
+	elsif ($block_count < scalar @blocks) {
 	    print +("skipping inode $inode -- found ", scalar @blocks, " blocks, but ",
 		    "told $block_count!\n");
 	    next Lsdel;

Reply to: