From ea4b1a1a962349ada733d963523de835b01cfc0a Mon Sep 17 00:00:00 2001 From: millert Date: Sun, 6 Apr 1997 06:11:10 +0000 Subject: [PATCH] Allow creation of archives with block sizes up to 64512 bytes but complain about non-portability if > 32256 bytes. Brought up by George Robbins --- bin/pax/buf_subs.c | 9 +++++++-- bin/pax/cpio.1 | 8 ++++---- bin/pax/pax.1 | 7 +++++-- bin/pax/pax.h | 7 ++++--- bin/pax/tar.1 | 7 +++++-- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/bin/pax/buf_subs.c b/bin/pax/buf_subs.c index c4bbe04c51c..77061273412 100644 --- a/bin/pax/buf_subs.c +++ b/bin/pax/buf_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf_subs.c,v 1.3 1996/06/23 14:20:30 deraadt Exp $ */ +/* $OpenBSD: buf_subs.c,v 1.4 1997/04/06 06:11:10 millert Exp $ */ /* $NetBSD: buf_subs.c,v 1.5 1995/03/21 09:07:08 cgd Exp $ */ /*- @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)buf_subs.c 8.2 (Berkeley) 4/18/94"; #else -static char rcsid[] = "$OpenBSD: buf_subs.c,v 1.3 1996/06/23 14:20:30 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: buf_subs.c,v 1.4 1997/04/06 06:11:10 millert Exp $"; #endif #endif /* not lint */ @@ -117,6 +117,11 @@ wr_start() wrblksz, BLKMULT); return(-1); } + if (wrblksz > MAXBLK_POSIX) { + paxwarn(0, "Write block size of %d larger than POSIX max %d, archive may not be portable", + wrblksz, MAXBLK_POSIX); + return(-1); + } /* * we only allow wrblksz to be used with all archive operations diff --git a/bin/pax/cpio.1 b/bin/pax/cpio.1 index 75ca1ce6f7d..639bc07e67c 100644 --- a/bin/pax/cpio.1 +++ b/bin/pax/cpio.1 @@ -27,7 +27,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $OpenBSD: cpio.1,v 1.2 1997/03/02 09:46:40 tholo Exp $ +.\" $OpenBSD: cpio.1,v 1.3 1997/04/06 06:11:11 millert Exp $ .\" .Dd February 16, 1997 .Dt CPIO 1 @@ -36,7 +36,7 @@ .Nm cpio .Nd copy file archives in and out .Sh SYNOPSIS -.Nm cpio +.Nm .Fl o .Op Fl aABcLvzZ .Op Fl C Ar bytes @@ -45,7 +45,7 @@ .Op Fl O Ar archive .Ar "< name-list" .Op Ar "> archive" -.Nm cpio +.Nm .Fl i .Op Fl bBcdfmrsStuvzZ6 .Op Fl C Ar bytes @@ -55,7 +55,7 @@ .Op Fl I Ar archive .Op Ar "pattern ..." .Op Ar "< archive" -.Nm cpio +.Nm .Fl p .Op Fl adlLmuv .Ar destination-directory diff --git a/bin/pax/pax.1 b/bin/pax/pax.1 index 38fc183f1b2..590c9dfdd7a 100644 --- a/bin/pax/pax.1 +++ b/bin/pax/pax.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pax.1,v 1.4 1997/02/20 06:54:35 tholo Exp $ +.\" $OpenBSD: pax.1,v 1.5 1997/04/06 06:11:13 millert Exp $ .\" $NetBSD: pax.1,v 1.3 1995/03/21 09:07:37 cgd Exp $ .\" .\" Copyright (c) 1992 Keith Muller. @@ -405,7 +405,10 @@ block the output at a positive decimal integer number of bytes per write to the archive file. The .Ar blocksize -must be a multiple of 512 bytes with a maximum of 32256 bytes. +must be a multiple of 512 bytes with a maximum of 64512 bytes. +Archives larger than 32256 bytes violate the +.Tn POSIX +standard and will not be portable to all systems. A .Ar blocksize can end with diff --git a/bin/pax/pax.h b/bin/pax/pax.h index 1930aa6d3cf..6406407ca82 100644 --- a/bin/pax/pax.h +++ b/bin/pax/pax.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pax.h,v 1.7 1997/02/27 23:32:59 michaels Exp $ */ +/* $OpenBSD: pax.h,v 1.8 1997/04/06 06:11:14 millert Exp $ */ /* $NetBSD: pax.h,v 1.3 1995/03/21 09:07:41 cgd Exp $ */ /*- @@ -44,9 +44,10 @@ * BSD PAX global data structures and constants. */ -#define MAXBLK 32256 /* MAX blocksize supported (posix SPEC) */ +#define MAXBLK 64512 /* MAX blocksize supported (posix SPEC) */ /* WARNING: increasing MAXBLK past 32256 */ /* will violate posix spec. */ +#define MAXBLK_POSIX 32256 /* MAX blocksize supported as per POSIX */ #define BLKMULT 512 /* blocksize must be even mult of 512 bytes */ /* Don't even think of changing this */ #define DEVBLK 8192 /* default read blksize for devices */ @@ -89,7 +90,7 @@ typedef struct { int bsz; /* default block size. used when the user */ /* does not specify a blocksize for writing */ /* Appends continue to with the blocksize */ - /* the archive is currently using.*/ + /* the archive is currently using. */ int hsz; /* Header size in bytes. this is the size of */ /* the smallest header this format supports. */ /* Headers are assumed to fit in a BLKMULT. */ diff --git a/bin/pax/tar.1 b/bin/pax/tar.1 index 1010e49f5e6..d00827d2322 100644 --- a/bin/pax/tar.1 +++ b/bin/pax/tar.1 @@ -27,7 +27,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $OpenBSD: tar.1,v 1.8 1997/04/05 22:36:18 millert Exp $ +.\" $OpenBSD: tar.1,v 1.9 1997/04/06 06:11:16 millert Exp $ .\" .Dd June 11, 1996 .Dt TAR 1 @@ -86,7 +86,10 @@ flags may be used: .It Fl b Ar "blocking factor" Set blocking factor to use for the archive, .Nm -uses 512 byte blocks. The default is 20, the maximum is 63. +uses 512 byte blocks. The default is 20, the maximum is 126. +Archives with a blocking factor larger 63 violate the +.Tn POSIX +standard and will not be portable to all systems. .It Fl e Stop after first error. .It Fl f Ar archive -- 2.20.1