[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freewrt-commits
Subject:    [FreeWRT-commits] r3897 -
From:       tg () freewrt ! org
Date:       2009-10-27 18:58:01
Message-ID: 20091027185801.3A6471C005 () frozenfish ! freewrt ! org
[Download RAW message or body]

Author: tg
Date: 2009-10-27 19:57:59 +0100 (Tue, 27 Oct 2009)
New Revision: 3897

Modified:
   branches/freewrt_1_0/tools/paxmirabilis/src/cpio.1
   branches/freewrt_1_0/tools/paxmirabilis/src/file_subs.c
   branches/freewrt_1_0/tools/paxmirabilis/src/options.c
   branches/freewrt_1_0/tools/paxmirabilis/src/options.h
   branches/freewrt_1_0/tools/paxmirabilis/src/pax.1
   branches/freewrt_1_0/tools/paxmirabilis/src/tar.1
   trunk/freewrt/tools/paxmirabilis/src/cpio.1
   trunk/freewrt/tools/paxmirabilis/src/file_subs.c
   trunk/freewrt/tools/paxmirabilis/src/options.c
   trunk/freewrt/tools/paxmirabilis/src/options.h
   trunk/freewrt/tools/paxmirabilis/src/pax.1
   trunk/freewrt/tools/paxmirabilis/src/tar.1
Log:
sync with upstream: paxmirabilis-20091027.cpio.gz
(still unmodified source)


Modified: branches/freewrt_1_0/tools/paxmirabilis/src/cpio.1
===================================================================
--- branches/freewrt_1_0/tools/paxmirabilis/src/cpio.1	2009-10-24 20:30:46 UTC (rev 3896)
+++ branches/freewrt_1_0/tools/paxmirabilis/src/cpio.1	2009-10-27 18:57:59 UTC (rev 3897)
@@ -1,4 +1,4 @@
-.\"	$MirOS: src/bin/pax/cpio.1,v 1.18 2008/11/08 23:03:35 tg Exp $
+.\"	$MirOS: src/bin/pax/cpio.1,v 1.19 2009/10/27 18:47:25 tg Exp $
 .\"	$OpenBSD: cpio.1,v 1.26 2007/05/31 19:19:15 jmc Exp $
 .\"
 .\" Copyright (c) 2005 Thorsten Glaser <tg@mirbsd.org>
@@ -61,7 +61,7 @@
 .\" .Dd must come before definition of .Mx, because when called
 .\" with -mandoc, it might implement .Mx itself, but we want to
 .\" use our own definition. And .Dd must come *first*, always.
-.Dd $Mdocdate: November 8 2008 $
+.Dd $Mdocdate: October 27 2009 $
 .\"
 .\" Implement .Mx (MirBSD)
 .de Mx
@@ -223,6 +223,8 @@
 0x0010: Debug this option.
 .It Ar debug
 0x0020: Debug file header storage.
+.It Ar lncp
+0x0040: Extract hard links by copying if linking fails.
 .El
 .Pp
 This option is only implemented for the cpio, sv4cpio,
@@ -395,6 +397,9 @@
 In the case where
 .Nm
 cannot create a link to a file,
+unless
+.Fl M Ar lncp
+is given,
 .Nm
 will not create a second copy of the file.
 .Pp

Modified: branches/freewrt_1_0/tools/paxmirabilis/src/file_subs.c
===================================================================
--- branches/freewrt_1_0/tools/paxmirabilis/src/file_subs.c	2009-10-24 20:30:46 UTC (rev 3896)
+++ branches/freewrt_1_0/tools/paxmirabilis/src/file_subs.c	2009-10-27 18:57:59 UTC (rev 3897)
@@ -1,10 +1,10 @@
-/**	$MirOS: src/bin/pax/file_subs.c,v 1.13 2008/10/29 17:34:48 tg Exp $ */
+/**	$MirOS: src/bin/pax/file_subs.c,v 1.14 2009/10/27 18:47:26 tg Exp $ */
 /*	$OpenBSD: file_subs.c,v 1.30 2005/11/09 19:59:06 otto Exp $	*/
 /*	$NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $	*/
 
 /*-
- * Copyright (c) 2007, 2008
- *	Thorsten Glaser <tg@mirbsd.de>
+ * Copyright (c) 2007, 2008, 2009
+ *	Thorsten Glaser <tg@mirbsd.org>
  * Copyright (c) 1992 Keith Muller.
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -56,7 +56,7 @@
 #include "extern.h"
 
 __SCCSID("@(#)file_subs.c	8.1 (Berkeley) 5/31/93");
-__RCSID("$MirOS: src/bin/pax/file_subs.c,v 1.13 2008/10/29 17:34:48 tg Exp $");
+__RCSID("$MirOS: src/bin/pax/file_subs.c,v 1.14 2009/10/27 18:47:26 tg Exp $");
 
 #ifndef __GLIBC_PREREQ
 #define __GLIBC_PREREQ(maj,min)	0
@@ -349,7 +349,40 @@
 		oerrno = errno;
 		if (!nodirs && chk_path(from, to_sb->st_uid, to_sb->st_gid) == 0)
 			continue;
+		/*-
+		 * non-standard (via -M lncp) cross-device link handling:
+		 * copy if hard link fails (but what if there are several
+		 * links for the same file mixed between several devices?
+		 * this code copies for all non-original devices, instead
+		 * of tracking them and linking between them on their re-
+		 * spective target device)
+		 */
+		if (oerrno == EXDEV && (anonarch & ANON_LNCP)) {
+			int fdsrc, fddest;
+			ARCHD tarcn;
+
+			if ((fdsrc = open(to, O_RDONLY, 0)) < 0) {
+				if (!ign)
+					syswarn(1, errno,
+					    "Unable to open %s to read", to);
+				goto lncp_failed;
+			}
+			strlcpy(tarcn.name, from, sizeof(tarcn.name));
+			memcpy(&tarcn.sb, to_sb, sizeof(struct stat));
+			tarcn.type = PAX_REG;	/* XXX */
+			tarcn.org_name = to;
+			if ((fddest = file_creat(&tarcn)) < 0) {
+				rdfile_close(&tarcn, &fdsrc);
+				goto lncp_failed;
+			}
+			cp_file(&tarcn, fdsrc, fddest);
+			file_close(&tarcn, fddest);
+			rdfile_close(&tarcn, &fdsrc);
+			/* file copied successfully, continue on */
+			break;
+		}
 		if (!ign) {
+ lncp_failed:
 			syswarn(1, oerrno, "Could not link to %s from %s", to,
 			    from);
 			return(-1);

Modified: branches/freewrt_1_0/tools/paxmirabilis/src/options.c
===================================================================
--- branches/freewrt_1_0/tools/paxmirabilis/src/options.c	2009-10-24 20:30:46 UTC (rev 3896)
+++ branches/freewrt_1_0/tools/paxmirabilis/src/options.c	2009-10-27 18:57:59 UTC (rev 3897)
@@ -57,7 +57,7 @@
 #endif
 
 __SCCSID("@(#)options.c	8.2 (Berkeley) 4/18/94");
-__RCSID("$MirOS: src/bin/pax/options.c,v 1.30 2009/10/04 14:51:06 tg Exp $");
+__RCSID("$MirOS: src/bin/pax/options.c,v 1.31 2009/10/27 18:47:26 tg Exp $");
 
 #ifdef __GLIBC__
 char *fgetln(FILE *, size_t *);
@@ -1748,6 +1748,8 @@
 		k = ANON_VERBOSE;
 	} else if (!strncmp(arg, "debug", 5)) {
 		k = ANON_DEBUG;
+	} else if (!strncmp(arg, "lncp", 4)) {
+		k = ANON_LNCP;
 	} else
 		call_usage();
 	if (j)

Modified: branches/freewrt_1_0/tools/paxmirabilis/src/options.h
===================================================================
--- branches/freewrt_1_0/tools/paxmirabilis/src/options.h	2009-10-24 20:30:46 UTC (rev 3896)
+++ branches/freewrt_1_0/tools/paxmirabilis/src/options.h	2009-10-27 18:57:59 UTC (rev 3897)
@@ -1,4 +1,4 @@
-/**	$MirOS: src/bin/pax/options.h,v 1.3 2006/07/16 16:14:50 tg Exp $ */
+/**	$MirOS: src/bin/pax/options.h,v 1.4 2009/10/27 18:47:26 tg Exp $ */
 /*	$OpenBSD: options.h,v 1.4 2003/06/13 17:51:14 millert Exp $	*/
 /*	$NetBSD: options.h,v 1.3 1995/03/21 09:07:32 cgd Exp $	*/
 
@@ -123,7 +123,8 @@
 #define	ANON_UIDGID	0x0008
 #define	ANON_VERBOSE	0x0010
 #define	ANON_DEBUG	0x0020
-#define	ANON_MAXVAL	0x003F
+#define	ANON_LNCP	0x0040
+#define	ANON_MAXVAL	0x007F
 extern int anonarch;
 void anonarch_init(void);
 

Modified: branches/freewrt_1_0/tools/paxmirabilis/src/pax.1
===================================================================
--- branches/freewrt_1_0/tools/paxmirabilis/src/pax.1	2009-10-24 20:30:46 UTC (rev 3896)
+++ branches/freewrt_1_0/tools/paxmirabilis/src/pax.1	2009-10-27 18:57:59 UTC (rev 3897)
@@ -1,4 +1,4 @@
-.\"	$MirOS: src/bin/pax/pax.1,v 1.9 2008/03/14 17:05:06 tg Exp $
+.\"	$MirOS: src/bin/pax/pax.1,v 1.10 2009/10/27 18:47:26 tg Exp $
 .\"	$OpenBSD: pax.1,v 1.52 2007/05/31 19:19:15 jmc Exp $
 .\"	$NetBSD: pax.1,v 1.3 1995/03/21 09:07:37 cgd Exp $
 .\"
@@ -70,7 +70,7 @@
 .\" .Dd must come before definition of .Mx, because when called
 .\" with -mandoc, it might implement .Mx itself, but we want to
 .\" use our own definition. And .Dd must come *first*, always.
-.Dd $Mdocdate: March 14 2008 $
+.Dd $Mdocdate: October 27 2009 $
 .\"
 .\" Implement .Mx (MirBSD)
 .de Mx
@@ -538,6 +538,8 @@
 0x0004: Zero out the file modification time.
 .It Ar uidgid
 0x0008: Set owner to 0:0 (root:wheel).
+.It Ar lncp
+0x0040: Extract hard links by copying if linking fails.
 .El
 .Pp
 This option is only implemented for the cpio, sv4cpio,
@@ -1202,6 +1204,9 @@
 In the case where
 .Nm
 cannot create a link to a file,
+unless
+.Fl M Ar lncp
+is given,
 .Nm
 will not create a second copy of the file.
 .Pp

Modified: branches/freewrt_1_0/tools/paxmirabilis/src/tar.1
===================================================================
--- branches/freewrt_1_0/tools/paxmirabilis/src/tar.1	2009-10-24 20:30:46 UTC (rev 3896)
+++ branches/freewrt_1_0/tools/paxmirabilis/src/tar.1	2009-10-27 18:57:59 UTC (rev 3897)
@@ -1,4 +1,4 @@
-.\"	$MirOS: src/bin/pax/tar.1,v 1.10 2008/03/14 17:05:06 tg Exp $
+.\"	$MirOS: src/bin/pax/tar.1,v 1.11 2009/10/27 18:47:27 tg Exp $
 .\"	$OpenBSD: tar.1,v 1.48 2007/05/31 19:19:15 jmc Exp $
 .\"
 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
@@ -60,7 +60,7 @@
 .\" .Dd must come before definition of .Mx, because when called
 .\" with -mandoc, it might implement .Mx itself, but we want to
 .\" use our own definition. And .Dd must come *first*, always.
-.Dd $Mdocdate: March 14 2008 $
+.Dd $Mdocdate: October 27 2009 $
 .\"
 .\" Implement .Mx (MirBSD)
 .de Mx
@@ -243,6 +243,8 @@
 0x0004: Zero out the file modification time.
 .It Ar uidgid
 0x0008: Set owner to 0:0 (root:wheel).
+.It Ar lncp
+0x0040: Extract hard links by copying if linking fails.
 .El
 .Pp
 This option is only implemented for the cpio, sv4cpio,
@@ -449,6 +451,9 @@
 In the case where
 .Nm
 cannot create a link to a file,
+unless
+.Fl M Ar lncp
+is given,
 .Nm
 will not create a second copy of the file.
 .Pp

Modified: trunk/freewrt/tools/paxmirabilis/src/cpio.1
===================================================================
--- trunk/freewrt/tools/paxmirabilis/src/cpio.1	2009-10-24 20:30:46 UTC (rev 3896)
+++ trunk/freewrt/tools/paxmirabilis/src/cpio.1	2009-10-27 18:57:59 UTC (rev 3897)
@@ -1,4 +1,4 @@
-.\"	$MirOS: src/bin/pax/cpio.1,v 1.18 2008/11/08 23:03:35 tg Exp $
+.\"	$MirOS: src/bin/pax/cpio.1,v 1.19 2009/10/27 18:47:25 tg Exp $
 .\"	$OpenBSD: cpio.1,v 1.26 2007/05/31 19:19:15 jmc Exp $
 .\"
 .\" Copyright (c) 2005 Thorsten Glaser <tg@mirbsd.org>
@@ -61,7 +61,7 @@
 .\" .Dd must come before definition of .Mx, because when called
 .\" with -mandoc, it might implement .Mx itself, but we want to
 .\" use our own definition. And .Dd must come *first*, always.
-.Dd $Mdocdate: November 8 2008 $
+.Dd $Mdocdate: October 27 2009 $
 .\"
 .\" Implement .Mx (MirBSD)
 .de Mx
@@ -223,6 +223,8 @@
 0x0010: Debug this option.
 .It Ar debug
 0x0020: Debug file header storage.
+.It Ar lncp
+0x0040: Extract hard links by copying if linking fails.
 .El
 .Pp
 This option is only implemented for the cpio, sv4cpio,
@@ -395,6 +397,9 @@
 In the case where
 .Nm
 cannot create a link to a file,
+unless
+.Fl M Ar lncp
+is given,
 .Nm
 will not create a second copy of the file.
 .Pp

Modified: trunk/freewrt/tools/paxmirabilis/src/file_subs.c
===================================================================
--- trunk/freewrt/tools/paxmirabilis/src/file_subs.c	2009-10-24 20:30:46 UTC (rev 3896)
+++ trunk/freewrt/tools/paxmirabilis/src/file_subs.c	2009-10-27 18:57:59 UTC (rev 3897)
@@ -1,10 +1,10 @@
-/**	$MirOS: src/bin/pax/file_subs.c,v 1.13 2008/10/29 17:34:48 tg Exp $ */
+/**	$MirOS: src/bin/pax/file_subs.c,v 1.14 2009/10/27 18:47:26 tg Exp $ */
 /*	$OpenBSD: file_subs.c,v 1.30 2005/11/09 19:59:06 otto Exp $	*/
 /*	$NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $	*/
 
 /*-
- * Copyright (c) 2007, 2008
- *	Thorsten Glaser <tg@mirbsd.de>
+ * Copyright (c) 2007, 2008, 2009
+ *	Thorsten Glaser <tg@mirbsd.org>
  * Copyright (c) 1992 Keith Muller.
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -56,7 +56,7 @@
 #include "extern.h"
 
 __SCCSID("@(#)file_subs.c	8.1 (Berkeley) 5/31/93");
-__RCSID("$MirOS: src/bin/pax/file_subs.c,v 1.13 2008/10/29 17:34:48 tg Exp $");
+__RCSID("$MirOS: src/bin/pax/file_subs.c,v 1.14 2009/10/27 18:47:26 tg Exp $");
 
 #ifndef __GLIBC_PREREQ
 #define __GLIBC_PREREQ(maj,min)	0
@@ -349,7 +349,40 @@
 		oerrno = errno;
 		if (!nodirs && chk_path(from, to_sb->st_uid, to_sb->st_gid) == 0)
 			continue;
+		/*-
+		 * non-standard (via -M lncp) cross-device link handling:
+		 * copy if hard link fails (but what if there are several
+		 * links for the same file mixed between several devices?
+		 * this code copies for all non-original devices, instead
+		 * of tracking them and linking between them on their re-
+		 * spective target device)
+		 */
+		if (oerrno == EXDEV && (anonarch & ANON_LNCP)) {
+			int fdsrc, fddest;
+			ARCHD tarcn;
+
+			if ((fdsrc = open(to, O_RDONLY, 0)) < 0) {
+				if (!ign)
+					syswarn(1, errno,
+					    "Unable to open %s to read", to);
+				goto lncp_failed;
+			}
+			strlcpy(tarcn.name, from, sizeof(tarcn.name));
+			memcpy(&tarcn.sb, to_sb, sizeof(struct stat));
+			tarcn.type = PAX_REG;	/* XXX */
+			tarcn.org_name = to;
+			if ((fddest = file_creat(&tarcn)) < 0) {
+				rdfile_close(&tarcn, &fdsrc);
+				goto lncp_failed;
+			}
+			cp_file(&tarcn, fdsrc, fddest);
+			file_close(&tarcn, fddest);
+			rdfile_close(&tarcn, &fdsrc);
+			/* file copied successfully, continue on */
+			break;
+		}
 		if (!ign) {
+ lncp_failed:
 			syswarn(1, oerrno, "Could not link to %s from %s", to,
 			    from);
 			return(-1);

Modified: trunk/freewrt/tools/paxmirabilis/src/options.c
===================================================================
--- trunk/freewrt/tools/paxmirabilis/src/options.c	2009-10-24 20:30:46 UTC (rev 3896)
+++ trunk/freewrt/tools/paxmirabilis/src/options.c	2009-10-27 18:57:59 UTC (rev 3897)
@@ -57,7 +57,7 @@
 #endif
 
 __SCCSID("@(#)options.c	8.2 (Berkeley) 4/18/94");
-__RCSID("$MirOS: src/bin/pax/options.c,v 1.30 2009/10/04 14:51:06 tg Exp $");
+__RCSID("$MirOS: src/bin/pax/options.c,v 1.31 2009/10/27 18:47:26 tg Exp $");
 
 #ifdef __GLIBC__
 char *fgetln(FILE *, size_t *);
@@ -1748,6 +1748,8 @@
 		k = ANON_VERBOSE;
 	} else if (!strncmp(arg, "debug", 5)) {
 		k = ANON_DEBUG;
+	} else if (!strncmp(arg, "lncp", 4)) {
+		k = ANON_LNCP;
 	} else
 		call_usage();
 	if (j)

Modified: trunk/freewrt/tools/paxmirabilis/src/options.h
===================================================================
--- trunk/freewrt/tools/paxmirabilis/src/options.h	2009-10-24 20:30:46 UTC (rev 3896)
+++ trunk/freewrt/tools/paxmirabilis/src/options.h	2009-10-27 18:57:59 UTC (rev 3897)
@@ -1,4 +1,4 @@
-/**	$MirOS: src/bin/pax/options.h,v 1.3 2006/07/16 16:14:50 tg Exp $ */
+/**	$MirOS: src/bin/pax/options.h,v 1.4 2009/10/27 18:47:26 tg Exp $ */
 /*	$OpenBSD: options.h,v 1.4 2003/06/13 17:51:14 millert Exp $	*/
 /*	$NetBSD: options.h,v 1.3 1995/03/21 09:07:32 cgd Exp $	*/
 
@@ -123,7 +123,8 @@
 #define	ANON_UIDGID	0x0008
 #define	ANON_VERBOSE	0x0010
 #define	ANON_DEBUG	0x0020
-#define	ANON_MAXVAL	0x003F
+#define	ANON_LNCP	0x0040
+#define	ANON_MAXVAL	0x007F
 extern int anonarch;
 void anonarch_init(void);
 

Modified: trunk/freewrt/tools/paxmirabilis/src/pax.1
===================================================================
--- trunk/freewrt/tools/paxmirabilis/src/pax.1	2009-10-24 20:30:46 UTC (rev 3896)
+++ trunk/freewrt/tools/paxmirabilis/src/pax.1	2009-10-27 18:57:59 UTC (rev 3897)
@@ -1,4 +1,4 @@
-.\"	$MirOS: src/bin/pax/pax.1,v 1.9 2008/03/14 17:05:06 tg Exp $
+.\"	$MirOS: src/bin/pax/pax.1,v 1.10 2009/10/27 18:47:26 tg Exp $
 .\"	$OpenBSD: pax.1,v 1.52 2007/05/31 19:19:15 jmc Exp $
 .\"	$NetBSD: pax.1,v 1.3 1995/03/21 09:07:37 cgd Exp $
 .\"
@@ -70,7 +70,7 @@
 .\" .Dd must come before definition of .Mx, because when called
 .\" with -mandoc, it might implement .Mx itself, but we want to
 .\" use our own definition. And .Dd must come *first*, always.
-.Dd $Mdocdate: March 14 2008 $
+.Dd $Mdocdate: October 27 2009 $
 .\"
 .\" Implement .Mx (MirBSD)
 .de Mx
@@ -538,6 +538,8 @@
 0x0004: Zero out the file modification time.
 .It Ar uidgid
 0x0008: Set owner to 0:0 (root:wheel).
+.It Ar lncp
+0x0040: Extract hard links by copying if linking fails.
 .El
 .Pp
 This option is only implemented for the cpio, sv4cpio,
@@ -1202,6 +1204,9 @@
 In the case where
 .Nm
 cannot create a link to a file,
+unless
+.Fl M Ar lncp
+is given,
 .Nm
 will not create a second copy of the file.
 .Pp

Modified: trunk/freewrt/tools/paxmirabilis/src/tar.1
===================================================================
--- trunk/freewrt/tools/paxmirabilis/src/tar.1	2009-10-24 20:30:46 UTC (rev 3896)
+++ trunk/freewrt/tools/paxmirabilis/src/tar.1	2009-10-27 18:57:59 UTC (rev 3897)
@@ -1,4 +1,4 @@
-.\"	$MirOS: src/bin/pax/tar.1,v 1.10 2008/03/14 17:05:06 tg Exp $
+.\"	$MirOS: src/bin/pax/tar.1,v 1.11 2009/10/27 18:47:27 tg Exp $
 .\"	$OpenBSD: tar.1,v 1.48 2007/05/31 19:19:15 jmc Exp $
 .\"
 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
@@ -60,7 +60,7 @@
 .\" .Dd must come before definition of .Mx, because when called
 .\" with -mandoc, it might implement .Mx itself, but we want to
 .\" use our own definition. And .Dd must come *first*, always.
-.Dd $Mdocdate: March 14 2008 $
+.Dd $Mdocdate: October 27 2009 $
 .\"
 .\" Implement .Mx (MirBSD)
 .de Mx
@@ -243,6 +243,8 @@
 0x0004: Zero out the file modification time.
 .It Ar uidgid
 0x0008: Set owner to 0:0 (root:wheel).
+.It Ar lncp
+0x0040: Extract hard links by copying if linking fails.
 .El
 .Pp
 This option is only implemented for the cpio, sv4cpio,
@@ -449,6 +451,9 @@
 In the case where
 .Nm
 cannot create a link to a file,
+unless
+.Fl M Ar lncp
+is given,
 .Nm
 will not create a second copy of the file.
 .Pp

_______________________________________________
freewrt-commits mailing list
freewrt-commits@freewrt.org
https://www.freewrt.org/lists/listinfo/freewrt-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic