Subject: Re: FYI: upgrading GNU tar
To: NetBSD Userlevel Technical Discussion List <tech-userlevel@NetBSD.ORG>
From: Christos Zoulas <christos@zoulas.com>
List: tech-userlevel
Date: 10/11/2002 16:09:57
On Oct 11,  3:49pm, woods@weird.com (Greg A. Woods) wrote:
-- Subject: Re: FYI: upgrading GNU tar


This is a NOOP right now since MAXBLK == MAXBLK_POSIX on NetBSD;
will not change.

| --- buf_subs.c-ORIG	Fri Oct 11 09:06:22 2002
| +++ buf_subs.c	Fri Oct 11 14:29:52 2002
| @@ -113,6 +113,12 @@
|  		    wrblksz, BLKMULT);
|  		return(-1);
|  	}
| +	if (wrblksz > MAXBLK_POSIX) {
| +		tty_warn(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

ok, patched.

| --- options.c-ORIG	Fri Oct 11 14:18:40 2002
| +++ options.c	Fri Oct 11 15:01:49 2002
| @@ -894,9 +894,11 @@
|  			break;
|  		case 'x':
|  			/*
| -			 * write an archive
| +			 * extract an archive, preserving mode,
| +			 * and mtime if possible.
|  			 */
|  			act = EXTRACT;
| +			pmtime = 1;
|  			break;
|  		case 'z':
|  			/*

Noop - will not patch.

| --- pax.h-ORIG	Fri Oct 11 10:34:19 2002
| +++ pax.h	Fri Oct 11 15:29:40 2002
| @@ -55,6 +55,7 @@
|  #define	MAXBLK		32256	/* 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 */

mktime(3) is responsible for those checks, will not patch.

| --- sel_subs.c-ORIG	Fri Oct 11 09:06:24 2002
| +++ sel_subs.c	Fri Oct 11 15:12:19 2002
| @@ -591,17 +591,21 @@
|  		}
|  		/* FALLTHROUGH */
|  	case 8:
| -		lt->tm_mon = ATOI2(p);
| +		if ((lt->tm_mon = ATOI2(p)) > 12)
| +			return(-1);
|  		--lt->tm_mon;
|  		/* FALLTHROUGH */
|  	case 6:
| -		lt->tm_mday = ATOI2(p);
| +		if ((lt->tm_mday = ATOI2(p)) > 31)
| +			return(-1);
|  		/* FALLTHROUGH */
|  	case 4:
| -		lt->tm_hour = ATOI2(p);
| +		if ((lt->tm_hour = ATOI2(p)) > 23)
| +			return(-1);
|  		/* FALLTHROUGH */
|  	case 2:
| -		lt->tm_min = ATOI2(p);
| +		if ((lt->tm_min = ATOI2(p)) > 59)
| +			return(-1);
|  		break;
|  	default:
|  		return(-1);

ok, patched,

| --- tar.c-ORIG	Fri Oct 11 09:07:36 2002
| +++ tar.c	Fri Oct 11 15:38:24 2002
| @@ -1030,7 +1030,11 @@
|  	 */
|  	if (ul_oct(tar_chksm(hdblk, sizeof(HD_USTAR)), hd->chksum,
|  	   sizeof(hd->chksum), 3))
| -		goto out;
| +		goto out;			/* XXX Something's wrong here
| +						 * because a zero-byte file can
| +						 * cause this to be done and
| +						 * yet the resulting warning
| +						 * seems incorrect */
|  	if (wr_rdbuf(hdblk, sizeof(HD_USTAR)) < 0)
|  		return(-1);
|  	if (wr_skip((off_t)(BLKMULT - sizeof(HD_USTAR))) < 0)

ok, patched

| --- tar.h-ORIG	Fri Oct 11 09:06:25 2002
| +++ tar.h	Fri Oct 11 15:26:50 2002
| @@ -119,12 +119,12 @@
|  /*
|   * default device names
|   */
| -#define	DEV_0		"/dev/rmt0"
| -#define	DEV_1		"/dev/rmt1"
| -#define	DEV_4		"/dev/rmt4"
| -#define	DEV_5		"/dev/rmt5"
| -#define	DEV_7		"/dev/rmt7"
| -#define	DEV_8		"/dev/rmt8"
| +#define	DEV_0		"/dev/rst0"
| +#define	DEV_1		"/dev/rst1"
| +#define	DEV_4		"/dev/rst4"
| +#define	DEV_5		"/dev/rst5"
| +#define	DEV_7		"/dev/rst7"
| +#define	DEV_8		"/dev/rst8"
|  #endif /* _PAX_ */
|  

ok, patched

| --- /dev/null	Fri Oct 11 15:38:41 2002
| +++ cpio.1	Fri Oct 11 15:32:48 2002

Thanks a lot for your changes,

christos