Bug 96252 - [patch] sysutils/cpdup can not handle snapshot files
Summary: [patch] sysutils/cpdup can not handle snapshot files
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-24 10:50 UTC by Dmitry Morozovsky
Modified: 2006-04-25 16:52 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Morozovsky freebsd_committer freebsd_triage 2006-04-24 10:50:15 UTC
sysutils/cpdup, while being great utility for file systems copy, can not
properly handle files with holes, hence is never able to copy snapshot files
(wee, on a comparable file systems).

The following patch sould fix this by simply skipping inodes with snapshot flag
set.

Fix: #/bin/sh
echo c - files
mkdir -p files > /dev/null 2>&1
echo x - files/patch-cpdup.c
sed 's/^X//' >files/patch-cpdup.c << 'END-of-files/patch-cpdup.c'
X
X$FreeBSD$
X
X--- cpdup.c.orig
X+++ cpdup.c
X@@ -321,6 +321,11 @@
X 
X     if (lstat(spath, &st1) != 0)
X 	return(0);
X+#ifdef SF_SNAPSHOT
X+    /* skip snapshot files: we cannot handle files larger than file system */
X+    if (st1.st_flags & SF_SNAPSHOT)
X+	 return(0);
X+#endif
X     st2.st_mode = 0;	/* in case lstat fails */
X     st2.st_flags = 0;	/* in case lstat fails */
X     if (dpath && lstat(dpath, &st2) == 0)
END-of-files/patch-cpdup.c

patch << 'END-of-Makefile-Patch'


exit--Haxyeg2yImPmY8IwKPLSaRLnUrLoNAaIgTHxOeV8st0mkmF7
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/sysutils/cpdup/Makefile,v
retrieving revision 1.11
diff -u -u -r1.11 Makefile
--- Makefile	11 Dec 2004 17:49:48 -0000	1.11
+++ Makefile	24 Apr 2006 09:26:34 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	cpdup
 PORTVERSION=	1.05
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	http://apollo.backplane.com/FreeBSDPorts/
 #MASTER_SITE_SUBDIR=	cp
END-of-Makefile-Patch
Comment 1 Volker Stolz freebsd_committer freebsd_triage 2006-04-25 16:52:20 UTC
State Changed
From-To: open->closed

Committed, thanks!