Your message dated Thu, 25 Jun 2015 19:50:26 +0000
with message-id <e1z8dai-0004wc...@franck.debian.org>
and subject line Bug#690802: fixed in scrounge-ntfs 0.9-7
has caused the Debian Bug report #690802,
regarding scrounge-ntfs size bug on 2T drive
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
690802: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=690802
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: scrounge-ntfs
Version: 0.9-6 all

When attempting to set an end sector greater than an unsigned int, the program exits with an error saying end must be greater than start.

Attached is a simple patch for this. I have also added another patch that allows the program to restart. This is not necessarily a bug per se, but it is a royal pain if your data set is very large and you have to restart - the program creates duplicates.

In the second patch, I attempted to clean up the code a bit. There were two different invocations depending on which OS (Win32 or others) was built. I also added a -i option that will ignore a file that already exists on the output.

I've already filed with Ubuntu:
https://bugs.launchpad.net/ubuntu/+source/scrounge-ntfs/+bug/1067817
https://bugs.launchpad.net/ubuntu/+source/scrounge-ntfs/+bug/1067814

I have tested both of these patches with the drive that Windows borked.

Perhaps you want them submitted separately.

Cheers.
-Doug



diff -ru scrounge-ntfs-0.9/src/main.c scrounge-ntfs-0.9.sizefix/src/main.c
--- scrounge-ntfs-0.9/src/main.c	2007-05-26 19:00:05.000000000 -0600
+++ scrounge-ntfs-0.9.sizefix/src/main.c	2012-10-17 10:30:34.000000000 -0600
@@ -77,7 +77,7 @@
 int main(int argc, char* argv[])
 {
   int ch = 0;
-  int temp = 0;
+  unsigned long temp = 0;
   int mode = 0;
   int raw = 0;
   partitioninfo pi;
@@ -103,7 +103,7 @@
     /* cluster size */
     case 'c':
       {
-        temp = atoi(optarg);
+        temp = atol(optarg);
         
         /* TODO: Check this range */
         if(temp <= 0 || temp > 128)
@@ -118,7 +118,7 @@
     /* drive number */
     case 'd':
       {
-        temp = atoi(optarg);
+        temp = atol(optarg);
 
         /* TODO: Check this range */
         if(temp < 0 || temp > 128)
@@ -142,7 +142,7 @@
     /* mft offset */
     case 'm':
       {
-        temp = atoi(optarg);
+        temp = atol(optarg);
 
         /* TODO: Check this range */
         if(temp < 0)
@@ -217,14 +217,14 @@
     if(argc > 2)
       warnx("ignoring extra arguments");
 
-    temp = atoi(argv[0]);
+    temp = atol(argv[0]);
     if(temp < 0)
       errx(2, "invalid start sector (must be positive)");
 
     pi.first = temp;
 
-    temp = atoi(argv[1]);
-    if(temp < 0 || ((unsigned int)temp) <= pi.first)
+    temp = atol(argv[1]);
+    if(temp < 0 || temp <= pi.first)
       errx(2, "invalid end sector (must be positive and greater than first)");
 
     pi.end = temp;
diff -ru scrounge-ntfs-0.9/src/compat.h scrounge-ntfs-0.9.patched/src/compat.h
--- scrounge-ntfs-0.9/src/compat.h	2007-05-26 18:59:43.000000000 -0600
+++ scrounge-ntfs-0.9.patched/src/compat.h	2012-10-17 10:25:25.000000000 -0600
@@ -160,6 +160,10 @@
 #endif
   
 
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
diff -ru scrounge-ntfs-0.9/src/drive.h scrounge-ntfs-0.9.patched/src/drive.h
--- scrounge-ntfs-0.9/src/drive.h	2007-05-26 18:59:50.000000000 -0600
+++ scrounge-ntfs-0.9.patched/src/drive.h	2012-10-17 10:25:25.000000000 -0600
@@ -34,6 +34,7 @@
 struct _ntfsx_mftmap;
 struct _drivelocks;
 
+#define OP_FLAG_IGNORE 0x0001  /**Do not copy files that already exist in output.  */
 typedef struct _partitioninfo
 {
 	uint32 first;		/* The first sector (in sectors) */
@@ -41,6 +42,9 @@
 	uint32 mft;			/* Offset into the MFT (in sectors) */
 	byte cluster;		/* Cluster size (in sectors) */
   int device;     /* A handle to an open device */
+	uint32 flags;		/**flags for operation. Ignore, for one  */
+	char *logfile;	/**Log file for err_set_file */
+	void *fp;       /**FILE * for filename, above  */
 
   /* Some other context stuff about the drive */
   struct _drivelocks* locks;
diff -ru scrounge-ntfs-0.9/src/main.c scrounge-ntfs-0.9.patched/src/main.c
--- scrounge-ntfs-0.9/src/main.c	2007-05-26 19:00:05.000000000 -0600
+++ scrounge-ntfs-0.9.patched/src/main.c	2012-10-17 10:25:25.000000000 -0600
@@ -21,48 +21,6 @@
 #include "scrounge.h"
 #include "compat.h"
 
-#ifdef _WIN32
-
-const char kPrintHelp[]       = "\
-usage: scrounge -l                                                   \n\
-  List all drive partition information.                              \n\
-                                                                     \n\
-usage: scrounge [-d drive] -s                                        \n\
-  Search drive for NTFS partitions.                                  \n\
-                                                                     \n\
-usage: scrounge [-d drive] [-m mftoffset] [-c clustersize] [-o outdir] start end  \n\
-  Scrounge data from a partition                                     \n\
-  -d         Drive number                                            \n\
-  -m         Offset to mft (in sectors)                              \n\
-  -c         Cluster size (in sectors, default of 8)                 \n\
-  -o         Directory to put scrounged files in                     \n\
-  start      First sector of partition                               \n\
-  end        Last sector of partition                                \n\
-                                                                     \n\
-";
-
-#else /* Not WIN32 */
-
-const char kPrintHelp[]       = "\
-usage: scrounge -l disk                                              \n\
-  List all drive partition information.                              \n\
-                                                                     \n\
-usage: scrounge -s disk                                              \n\
-  Search drive for NTFS partitions.                                  \n\
-                                                                     \n\
-usage: scrounge [-m mftoffset] [-c clustersize] [-o outdir] disk start end  \n\
-  Scrounge data from a partition                                     \n\
-  -m         Offset to mft (in sectors)                              \n\
-  -c         Cluster size (in sectors, default of 8)                 \n\
-  -o         Directory to put scrounged files in                     \n\
-  disk       The raw disk partitios (ie: /dev/hda)                   \n\
-  start      First sector of partition                               \n\
-  end        Last sector of partition                                \n\
-                                                                     \n\
-";
-
-#endif
-
 #define MODE_SCROUNGE 1
 #define MODE_LIST     2
 #define MODE_SEARCH   3 
@@ -77,11 +35,12 @@
 int main(int argc, char* argv[])
 {
   int ch = 0;
-  int temp = 0;
+  unsigned long temp = 0;
   int mode = 0;
   int raw = 0;
   partitioninfo pi;
   char driveName[MAX_PATH + 1];
+	FILE *f=NULL;
 #ifdef _WIN32
   int drive = 0;
 #endif
@@ -91,11 +50,7 @@
   /* TODO: We need to be able to autodetect the cluster size */
   pi.cluster = 8;
 
-#ifdef _WIN32
-  while((ch = getopt(argc, argv, "c:d:hlm:o:sv")) != -1)
-#else
-  while((ch = getopt(argc, argv, "c:hlm:o:sv")) != -1)
-#endif
+  while((ch = getopt(argc, argv, "c:d:e:hilm:o:sv")) != -1)
   {
     switch(ch)
     {
@@ -103,7 +58,7 @@
     /* cluster size */
     case 'c':
       {
-        temp = atoi(optarg);
+        temp = atol(optarg);
         
         /* TODO: Check this range */
         if(temp <= 0 || temp > 128)
@@ -114,11 +69,12 @@
       }
       break;
 
-#ifdef _WIN32
+
     /* drive number */
     case 'd':
+#ifdef _WIN32
       {
-        temp = atoi(optarg);
+        temp = atol(optarg);
 
         /* TODO: Check this range */
         if(temp < 0 || temp > 128)
@@ -126,8 +82,21 @@
 
         drive = temp;
       }
-      break;
-#endif
+#else
+			strncpy(driveName, optarg, MAX_PATH);
+  		driveName[MAX_PATH] = 0;
+#endif
+      break;
+    /* Log file  */
+		case 'e':
+			pi.logfile=strdup(optarg);
+			/** pi.fp=fopen(optarg,"a+");
+			err_set_file((void *)pi.fp);*/
+			break;
+		/* ignore files that already exist in output  */
+		case 'i':
+			pi.flags|=OP_FLAG_IGNORE;
+			break;
 
     /* list mode */
     case 'l':
@@ -142,7 +111,7 @@
     /* mft offset */
     case 'm':
       {
-        temp = atoi(optarg);
+        temp = atol(optarg);
 
         /* TODO: Check this range */
         if(temp < 0)
@@ -193,17 +162,6 @@
 #ifdef _WIN32
   /* Under windows we format the drive number */
   makeDriveName(driveName, drive);
-
-#else
-  /* Now when not under Windows, it's the drive name */
-  if(argc < 1)
-    errx(2, "must specify drive name");
-
-  strncpy(driveName, argv[0], MAX_PATH);
-  driveName[MAX_PATH] = 0;
-
-  argv++;
-  argc--;
 #endif
 
 
@@ -217,14 +175,14 @@
     if(argc > 2)
       warnx("ignoring extra arguments");
 
-    temp = atoi(argv[0]);
+    temp = atol(argv[0]);
     if(temp < 0)
       errx(2, "invalid start sector (must be positive)");
 
     pi.first = temp;
 
-    temp = atoi(argv[1]);
-    if(temp < 0 || ((unsigned int)temp) <= pi.first)
+    temp = atol(argv[1]);
+    if(temp < 0 || temp <= pi.first)
       errx(2, "invalid end sector (must be positive and greater than first)");
 
     pi.end = temp;
@@ -271,6 +229,38 @@
 
 void usage()
 {
-  fprintf(stderr, "%s", kPrintHelp);
+#ifdef _WIN32
+#define D_OPT "drive"
+#define D_DESC "Drive number"
+	fprintf(stderr,"\
+usage: scrounge -l                                                   \n\
+  List all drive partition information.                              \n\
+                                                                     \n\
+usage: scrounge [-d drive] -s                                        \n\
+  Search drive for NTFS partitions.                                  \n"
+#else /* Not WIN32 */
+#define D_OPT "disk"
+#define D_DESC "The raw disk partitios (ie: /dev/hda)"
+		fprintf(stderr,"\
+usage: scrounge -l -d disk                                           \n\
+  List all drive partition information.                              \n\
+                                                                     \n\
+usage: scrounge -s -d disk                                           \n\
+  Search drive for NTFS partitions.                                  \n"
+#endif
+"usage: scrounge [-d %s] [-m mftoffset] [-c clustersize] [-o outdir] [-e errfile] [-i]  start end  \n\
+Scrounge data from a partition                                       \n\
+  -d         %s                                                      \n\
+  -m         Offset to mft (in sectors)                              \n\
+  -c         Cluster size (in sectors, default of 8)                 \n\
+  -l         List sectors/MFT                                        \n\	
+  -o         Directory to put scrounged files in                     \n\
+  -i         Ignore files that exist in output                       \n\
+  start      First sector of partition                               \n\
+  end        Last sector of partition                                \n\
+                                                                     \n\
+",D_OPT,D_DESC);
   exit(2);
 }
+/*  -e         File name for log                                       \n\ */
+
diff -ru scrounge-ntfs-0.9/src/scrounge.c scrounge-ntfs-0.9.patched/src/scrounge.c
--- scrounge-ntfs-0.9/src/scrounge.c	2007-05-26 18:58:31.000000000 -0600
+++ scrounge-ntfs-0.9.patched/src/scrounge.c	2012-10-17 10:25:25.000000000 -0600
@@ -202,8 +202,9 @@
       }
     }
 
-    printf(flags & PROCESS_MFT_FLAG_SUB ? 
-            "\\" FC_PRINTF : "\\" FC_PRINTF "\n", basics.filename);
+    /* printf(flags & PROCESS_MFT_FLAG_SUB ? 
+            "\\" FC_PRINTF : "\\" FC_PRINTF "\n", basics.filename);*/
+	  printf("\\" FC_PRINTF,basics.filename);
 
     /* Directory handling: */
     if(header->flags & kNTFS_RecFlagDir)
@@ -251,6 +252,13 @@
     else
 #endif
     {
+			if(pi->flags & OP_FLAG_IGNORE){ 
+				struct stat buf; 
+				if(stat(basics.filename,&buf) == 0) {/* if the file exists, just ignore it  */
+					printf(" - Already exists, Not duplicating.\n");
+					goto cleanup;
+				}	else printf("\n");
+		  }
       ofile = fc_open(basics.filename, O_BINARY | O_CREAT | O_EXCL | O_WRONLY, DEF_FILE_MODE);
   
       fcsncpy(filename2, basics.filename, MAX_PATH);
Only in scrounge-ntfs-0.9.patched/src: scrounge.c.orig

--- End Message ---
--- Begin Message ---
Source: scrounge-ntfs
Source-Version: 0.9-7

We believe that the bug you reported is fixed in the latest version of
scrounge-ntfs, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 690...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Joao Eriberto Mota Filho <eribe...@debian.org> (supplier of updated 
scrounge-ntfs package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Wed, 24 Jun 2015 12:14:17 -0300
Source: scrounge-ntfs
Binary: scrounge-ntfs
Architecture: source amd64
Version: 0.9-7
Distribution: unstable
Urgency: medium
Maintainer: Debian Forensics <forensics-devel@lists.alioth.debian.org>
Changed-By: Joao Eriberto Mota Filho <eribe...@debian.org>
Description:
 scrounge-ntfs - Data recovery program for NTFS filesystems
Closes: 566622 650649 690802 690923
Changes:
 scrounge-ntfs (0.9-7) unstable; urgency=medium
 .
   * Team upload.
   * Some data imported from Git:
      [ Christophe Monniez ] (2010)
        * Adding a build depend on quilt.
        * Adding patch to fix url in man page.
        * Bumping Standards-Version to 3.8.3.
      [ Daniel Baumann ] (2009)
        * Adding stuff in rules that doesn't get done by dh automatically.
        * Minimizing rules file.
   * Migrations:
       - debian/copyright to 1.0 format.
       - DebSrc to 3.0 format.
       - DH level to 9.
       - Using dh-autoreconf.
   * New upstream homepage.
   * debian/control:
       - Bumped Standards-Version to 3.9.6.
       - Removed quilt from Build-Depends field.
       - Rewrote the long description.
       - Updated the Vcs-* fields.
   * debian/copyright: full updated.
   * debian/patches/:
       - 01-man-page-link.patch:
           ~ Added a header.
           ~ Added a new fix. Now for a spelling error. (Closes: #690923)
           ~ Renamed to 01-fix-manpage.
           ~ Updated again the upstream homepage. (Closes: #566622)
           ~ Updated the upstream e-mail address.
       - 02-fix-help-message: added to fix the program name in its help. Thanks
         to Nelson A. de Oliveira <nao...@debian.org>. (Closes: #650649)
       - 03-fix-max-size: added to allow disks grather than 2TB. Thanks to
         doug Springer <g...@rickyrockrat.net> (Closes: #690802, LP: #1067814)
       - 04-clean-code-add-option: added but disabled. With this patch, the
         program didn't work fine.
   * debian/scrounge-ntfs.docs: renamed to docs.
   * debian/source.lintian-overrides: removed. Using 'Team upload' now.
   * debian/rules:
       - Added DEB_BUILD_MAINT_OPTIONS variable to improve the GCC hardening.
       - Removed unnecessary targets.
   * debian/watch: updated and improved.
Checksums-Sha1:
 ff713e5489c08d2c16643293750ebff97c251d77 1956 scrounge-ntfs_0.9-7.dsc
 9bb9e0beadf732f05b8fe1268ef8fbb28010cf34 6844 scrounge-ntfs_0.9-7.debian.tar.xz
 1ca07e60beab073cac12eed8e12f7058a0d06d0e 17674 scrounge-ntfs_0.9-7_amd64.deb
Checksums-Sha256:
 561ec24e4711494f5f6588d0d331ab8420de4d5bf34c74e7b0ec29936aaf195a 1956 
scrounge-ntfs_0.9-7.dsc
 f3a648397bd747f6507dfffc4b0e8c83f7f8fe69df60b88a241f0f744afae369 6844 
scrounge-ntfs_0.9-7.debian.tar.xz
 33681ed662b28707818181f676cf72968acd31de561622318274b58295734507 17674 
scrounge-ntfs_0.9-7_amd64.deb
Files:
 8a51b0ea7cf63ea1e06eb9c02b88fdd8 1956 admin optional scrounge-ntfs_0.9-7.dsc
 2ce0783518c65727acde1952428237a6 6844 admin optional 
scrounge-ntfs_0.9-7.debian.tar.xz
 23895f0dc20a642aca97bab8c1127230 17674 admin optional 
scrounge-ntfs_0.9-7_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJViwWiAAoJEN5juccE6+nvu9kP/1RXnCFYlHle2wDzPjDQd72d
tnAM2pzIFueS0LZJruZyYW15gICLNjqQP8oPuObWyzOnjz0QitRwdBBngrwOV2UO
Bpk+F+BMpu2Z5yzjRyt0hu4pFoMzYVb9RNOa/lh+Tt2QPpOIrugnmd3LEKJMar0E
FLPjkMUm7hHauXPypNYy30ISaaPvwphgoGYju1ZgQKz467UObUBRqShQyxGXsOJJ
oxIeWEML7surh/0L108DCUdR3X4d66EgbfKiFM+01/xkrF8GP+RKAMxfGkx35ywL
D/2laLuvjHtkk4rXqgjKWae6YhaaXeQ+vATEBBeroKh1L0zGkO03tcjVOI10sYZJ
GY/9Po3Z8QsA4VYQxeBmDgaaXNDZQBsSRpEqFDjtEoobtvbOQNVszkSMfN0FEEJF
V9Cp25pyghIK4F0eKKF0QvWtmi2zJpZHp8u+0q5EMxm85jeESft86CrQQy7GBJd8
OdKkFFYKzHWv332QhFPzCyzD/0+c9mQjTorkNxFfxElmu0AhfFej0hpNxqxh94/t
zwV6RA81t+T6B7RgJSnKLGxeIcxzp5Doe4moPEN1jcdGbffAI1LRNKXoV0VbG3xR
w/snejr13SQZeB6EnWOcwxoHmixkIjeAnx2vMrQayv8DikdV3yGEhqagRZx9uzXQ
wr3Z4c6W4x1EBhCKOZMd
=XKOB
-----END PGP SIGNATURE-----

--- End Message ---
_______________________________________________
forensics-devel mailing list
forensics-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/forensics-devel

Reply via email to