Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Sep 2000 04:39:26 +0400
From:      "Andrey A. Chernov" <ache@nagual.pp.ru>
To:        Warner Losh <imp@village.org>
Cc:        current@freebsd.org, marcel@freebsd.org
Subject:   Re: mtree again
Message-ID:  <20000915043925.A83698@nagual.pp.ru>
In-Reply-To: <200009142341.RAA00700@harmony.village.org>; from imp@village.org on Thu, Sep 14, 2000 at 05:41:46PM -0600
References:  <20000915033837.A564@nagual.pp.ru> <200009142341.RAA00700@harmony.village.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Sep 14, 2000 at 05:41:46PM -0600, Warner Losh wrote:
> In message <20000915033837.A564@nagual.pp.ru> "Andrey A. Chernov" writes:
> : Is there any progress in mtree fixing process?
> 
> It hasn't been high on my list.  I'd be happy to review patches,
> however.

Here it is:

--- usr.sbin/mtree/mtree.c.orig	Thu Jul 27 07:36:02 2000
+++ usr.sbin/mtree/mtree.c	Fri Sep 15 04:00:46 2000
@@ -57,7 +57,7 @@
 
 extern long int crc_total;
 
-int ftsoptions = FTS_LOGICAL;
+int ftsoptions = FTS_PHYSICAL;
 int cflag, dflag, eflag, iflag, nflag, qflag, rflag, sflag, uflag, Uflag;
 u_int keys;
 char fullpath[MAXPATHLEN];
@@ -77,7 +77,7 @@
 	keys = KEYDEFAULT;
 	init_excludes();
 
-	while ((ch = getopt(argc, argv, "cdef:iK:k:np:Prs:UuxX:")) != -1)
+	while ((ch = getopt(argc, argv, "cdef:iK:k:Lnp:qrs:UuxX:")) != -1)
 		switch((char)ch) {
 		case 'c':
 			cflag = 1;
@@ -106,6 +106,10 @@
 				if (*p != '\0')
 					keys |= parsekey(p, NULL);
 			break;
+		case 'L':
+			ftsoptions &= ~FTS_PHYSICAL;
+			ftsoptions |= FTS_LOGICAL;
+			break;
 		case 'n':
 			nflag = 1;
 			break;
@@ -115,10 +119,6 @@
 		case 'q':
 			qflag = 1;
 			break;
-		case 'P':
-			ftsoptions ^= FTS_LOGICAL;
-			ftsoptions |= FTS_PHYSICAL;
-			break;
 		case 'r':
 			rflag = 1;
 			break;
@@ -170,7 +170,7 @@
 usage()
 {
 	(void)fprintf(stderr,
-"usage: mtree [-PUcdeinqrux] [-f spec] [-K key] [-k key] [-p path] [-s seed]\n"
+"usage: mtree [-LUcdeinqrux] [-f spec] [-K key] [-k key] [-p path] [-s seed]\n"
 "\t[-X excludes]\n");
 	exit(1);
 }
--- usr.sbin/mtree/mtree.8.orig	Thu Jul 27 07:36:02 2000
+++ usr.sbin/mtree/mtree.8	Fri Sep 15 04:03:07 2000
@@ -40,7 +40,7 @@
 .Nd map a directory hierarchy
 .Sh SYNOPSIS
 .Nm mtree
-.Op Fl PUcdeinqrux
+.Op Fl LUcdeinqrux
 .Bk -words
 .Op Fl f Ar spec
 .Ek
@@ -70,9 +70,10 @@
 .Pp
 The options are as follows:
 .Bl -tag -width flag
-.It Fl P
-Don't follow symbolic links in the file hierarchy, instead consider
-the symbolic link itself in any comparisons.
+.It Fl L
+Follow all symbolic links in the file hierarchy (by default
+.Nm
+considers the symbolic link itself).
 .It Fl U
 Modify the owner, group and permissions of existing files to match
 the specification and create any missing directories or symbolic links.
--- etc/defaults/make.conf.orig	Fri Sep 15 03:14:55 2000
+++ etc/defaults/make.conf	Fri Sep 15 04:09:40 2000
@@ -43,6 +43,9 @@
 # Compare before install
 #INSTALL=install -C
 #
+# Mtree will follow symlinks
+MTREE_FOLLOW_SYMLINKS= -L
+#
 # To enable building enstalling suidperl with the setuid bit turned on
 #ENABLE_SUIDPERL=	true
 #
--- etc/Makefile.orig	Sat Sep  9 02:56:53 2000
+++ etc/Makefile	Fri Sep 15 04:06:36 2000
@@ -148,12 +148,12 @@
 .endif
 
 distrib-dirs:
-	mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
-	mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
-	mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
-	mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
+	mtree -deU ${MTREE_FOLLOW_SYMLINKS} -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
+	mtree -deU ${MTREE_FOLLOW_SYMLINKS} -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
+	mtree -deU ${MTREE_FOLLOW_SYMLINKS} -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
+	mtree -deU ${MTREE_FOLLOW_SYMLINKS} -f ${.CURDIR}/mtree/BSD.include.dist \
 		-p ${DESTDIR}/usr/include
-	mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
+	mtree -deU ${MTREE_FOLLOW_SYMLINKS} -f ${.CURDIR}/mtree/BSD.include.dist \
 		-p ${DESTDIR}/usr/libdata/perl/5.6.0/mach
 	cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys
 	cd ${DESTDIR}/usr/share/locale; \
--- include/Makefile.orig	Fri Sep 15 03:18:34 2000
+++ include/Makefile	Fri Sep 15 04:12:10 2000
@@ -103,7 +103,7 @@
 		rm -f ${DESTDIR}/usr/include/$i; \
 	fi
 .endfor
-	mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
+	mtree -deU ${MTREE_FOLLOW_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
 		-p ${DESTDIR}/usr/include
 .for i in ${LDIRS} ${LSUBDIRS}
 	cd ${.CURDIR}/../sys; \

-- 
Andrey A. Chernov
<ache@nagual.pp.ru>
http://ache.pp.ru/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000915043925.A83698>