Two code sets are currently guarded with #ifdef SMALL in pax(1) and tar(1): reading 'pax' format extended headers, and identifying various compressed formats for user-friendliness. As noted by Caspar, the SMALL path isn't currently used on the install media. I've been confused by this twice already...
Here's a proposal: 1. always compile in read support for the 'pax' format extended headers. The ustar format is limited and being able to restore archives using the pax format in any situation would be nice. Especially if we switch to writing out pax format archives by default one day. We're definitely not there yet. 2. actually use -DSMALL to save a bit of storage on the install media. The behavior is still sane, tar(1) warns that it doesn't recognize a compressed archive, seeks through it trying to look a tar header, and eventually gives up. Here's the tiny size change on amd64: shannon /usr/src/distrib/special/pax$ size tar.o options.o pax obj/tar.o obj/options.o obj/pax text data bss dec hex 6821 0 40 6861 1acd tar.o 7195 1084 32 8311 2077 options.o 390495 19024 85392 494911 78d3f pax 6821 0 40 6861 1acd obj/tar.o 6878 1084 32 7994 1f3a obj/options.o 390175 19024 85392 494591 78bff obj/pax I don't expect any regression on the ramdisks but a make release is running just in case. ok? Index: bin/pax/tar.c =================================================================== RCS file: /home/cvs/src/bin/pax/tar.c,v retrieving revision 1.72 diff -u -p -r1.72 tar.c --- bin/pax/tar.c 19 Aug 2023 04:21:05 -0000 1.72 +++ bin/pax/tar.c 4 Sep 2023 12:19:39 -0000 @@ -59,9 +59,7 @@ static u_long tar_chksm(char *, int); static char *name_split(char *, int); static int ul_oct(u_long, char *, int, int); static int ull_oct(unsigned long long, char *, int, int); -#ifndef SMALL static int rd_xheader(ARCHD *arcn, int, off_t); -#endif static uid_t uid_nobody; static uid_t uid_warn; @@ -721,14 +719,11 @@ ustar_rd(ARCHD *arcn, char *buf) if (ustar_id(buf, BLKMULT) < 0) return(-1); -#ifndef SMALL reset: -#endif memset(arcn, 0, sizeof(*arcn)); arcn->org_name = arcn->name; arcn->sb.st_nlink = 1; -#ifndef SMALL /* Process Extended headers. */ if (hd->typeflag == XHDRTYPE || hd->typeflag == GHDRTYPE) { if (rd_xheader(arcn, hd->typeflag == GHDRTYPE, @@ -745,7 +740,6 @@ reset: if (hd->typeflag == XHDRTYPE || hd->typeflag == GHDRTYPE) goto reset; } -#endif if (!arcn->nlen) { /* @@ -1190,8 +1184,6 @@ expandname(char *buf, size_t len, char * return(nlen); } -#ifndef SMALL - /* shortest possible extended record: "5 a=\n" */ #define MINXHDRSZ 5 @@ -1331,4 +1323,3 @@ rd_xheader(ARCHD *arcn, int global, off_ return (-1); return (ret); } -#endif Index: distrib/special/pax/Makefile =================================================================== RCS file: /home/cvs/src/distrib/special/pax/Makefile,v retrieving revision 1.2 diff -u -p -r1.2 Makefile --- distrib/special/pax/Makefile 13 Sep 2018 16:34:33 -0000 1.2 +++ distrib/special/pax/Makefile 3 Sep 2023 10:38:17 -0000 @@ -1,7 +1,7 @@ # $OpenBSD: Makefile,v 1.2 2018/09/13 16:34:33 sthen Exp $ .PATH: ${.CURDIR}/../../../bin/pax -CFLAGS+=-DNOCPIO -I${.CURDIR}/../../../bin/pax +CFLAGS+=-DNOCPIO -DSMALL -I${.CURDIR}/../../../bin/pax PROG= pax SRCS= ar_io.c ar_subs.c buf_subs.c file_subs.c ftree.c\ -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE