Index | Thread | Search

From:
Jeremie Courreges-Anglas <jca@wxcvbn.org>
Subject:
pax format options
To:
tech@openbsd.org
Cc:
millert@openbsd.org
Date:
Wed, 17 Apr 2024 12:57:34 +0200

Download raw body.

Thread
pax -o write_opt=no_dir and tar -o were designed for the old tar
format, and zhuk@ extended it to also cover the ustar format.  IMO it
makes no sense to keep on supporting it for the pax format.

Also, the pax format ought to support a lot more bells and whistles,
so let's have an option handler specific for it, even if currently
empty.

ok?


Index: extern.h
===================================================================
--- extern.h.orig	2024-04-16 22:29:42.549086788 +0100
+++ extern.h	2024-04-17 11:30:39.659087002 +0100
@@ -285,6 +285,7 @@
 int ustar_rd(ARCHD *, char *);
 int ustar_wr(ARCHD *);
 int pax_id(char *, int);
+int pax_opt(void);
 int pax_wr(ARCHD *);
 
 /*
Index: options.c
===================================================================
--- options.c.orig	2024-04-17 11:19:21.739090424 +0100
+++ options.c	2024-04-17 11:30:39.659087002 +0100
@@ -230,7 +230,7 @@
 /* 10: POSIX PAX */
 	{"pax", 5120, BLKMULT, 0, 1, BLKMULT, 0, pax_id, no_op,
 	ustar_rd, tar_endrd, no_op, pax_wr, tar_endwr, tar_trail,
-	tar_opt},
+	pax_opt},
 #endif
 };
 #define	F_OCPIO	0	/* format when called as cpio -6 */
Index: tar.c
===================================================================
--- tar.c.orig	2024-04-16 23:58:10.000000000 +0100
+++ tar.c	2024-04-17 11:30:39.659087002 +0100
@@ -1448,6 +1448,29 @@
 #endif
 
 /*
+ * pax_opt()
+ *	handle pax format specific -o options
+ * Return:
+ *	0 if ok -1 otherwise
+ */
+#ifndef SMALL
+int
+pax_opt(void)
+{
+	OPLIST *opt;
+
+	while ((opt = opt_next()) != NULL) {
+		if (1) {
+			paxwarn(1, "Unknown pax format -o option/value pair %s=%s",
+			    opt->name, opt->value);
+			return(-1);
+		}
+	}
+	return 0;
+}
+#endif
+
+/*
  * name_split()
  *	see if the name has to be split for storage in a ustar header. We try
  *	to fit the entire name in the name field without splitting if we can.


-- 
jca