Package: ntfsprogs
Version: 1.13.1-3
Severity: normal
Tags: patch

Hi David,

Package mondo, which I maintain, uses ntfsclone to backup NTFS partitions. It
does so via outputting the file to a FIFO where another thread waits to chop
it up into chunks. The FIFO is created in /tmp. This works generally fine.

However, ntfsclone checks the space in /tmp where the FIFO is created to find
out whether there is enough free space to accomodate the output file created,
which can lead to the following error:

aurich64:/tmp# ntfsclone --save-image --overwrite fifo /dev/hda1
ntfsclone v1.13.1 (libntfs 9:0:0)
NTFS volume version: 3.0
Cluster size       : 4096 bytes
Current volume size: 3142021120 bytes (3143 MB)
Current device size: 3142024704 bytes (3143 MB)
Scanning volume ...
100.00 percent completed
Accounting clusters ...
Space in use       : 2213 MB (70.4%)
ERROR: Destination doesn't have enough free space: 400 MB < 2213 MB

The attached patch makes it so that ntfsclone will not check for free space in
case the output file is a FIFO. I have tried to make things as unobtrusive as
possible and hope you find the patch acceptable. In case you would like me to
change anything, please let me know and I will happily amend and resend.

Thanks a lot & best regards,
Andree

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-amd64
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)

Versions of packages ntfsprogs depends on:
ii  fuse-utils                   2.5.3-3     Filesystem in USErspace (utilities
ii  libc6                        2.3.6.ds1-4 GNU C Library: Shared libraries
ii  libfuse2                     2.5.3-3     Filesystem in USErspace library
ii  libntfs9                     1.13.1-3    library that provides common NTFS 

ntfsprogs recommends no packages.

-- no debconf information
--- ntfsclone.c.orig	2006-06-21 17:59:19.000000000 +1000
+++ ntfsclone.c	2006-08-28 07:39:19.000000000 +1000
@@ -1608,6 +1608,7 @@
 {
 	u64 dest_bytes;
 	struct statvfs stvfs;
+	struct stat stat;
 
 	if (opt.metadata || opt.blkdev_out || opt.std_out)
 		return;
@@ -1620,6 +1621,14 @@
 		       strerror(errno));
 		return;
 	}
+	/* if file is a FIFO there is no point in checking the size */
+	if (!fstat(fd_out, &stat)) {
+		if (S_ISFIFO(stat.st_mode))
+			return;
+	} else {
+		Printf("WARNING: Couldn't get file info because of the following error: %s\n",
+		       strerror(errno));
+	}
 
 	dest_bytes = (u64)stvfs.f_frsize * stvfs.f_bfree;
 	if (!dest_bytes)

Reply via email to