Index | Thread | Search

From:
Caspar Schutijser <caspar@schutijser.com>
Subject:
Re: Switch tar(1) to use pax as default write format (Was: Re: tar(1) write format selection)
To:
Jeremie Courreges-Anglas <jca@wxcvbn.org>
Cc:
tech@openbsd.org, millert@openbsd.org
Date:
Tue, 16 Apr 2024 18:31:11 +0200

Download raw body.

Thread
On Tue, Apr 16, 2024 at 02:00:01PM +0200, Jeremie Courreges-Anglas wrote:
> On Tue, Apr 16, 2024 at 01:43:47PM +0200, Caspar Schutijser wrote:
> > On Tue, Apr 16, 2024 at 01:16:17PM +0200, Jeremie Courreges-Anglas wrote:
> > > On Mon, Apr 15, 2024 at 07:48:22PM +0200, Jeremie Courreges-Anglas wrote:
> > > > 
> > > > One drawback of switching tar(1) to use 'pax' write format by default
> > > > is that tar(1) doesn't give the user a generic way to specify a format
> > > > (-o and -O suck).  So the diff below uses -F for that.  GNU tar uses
> > > > -H (already used) and FreeBSD/NetBSD tar use --format and we don't
> > > > want long options.
> > > 
> > > I'd like to move fast and switch the default in tar(1) as soon as
> > > tar(1) provides the user with an option to go back to ustar if really
> > > needed.  I hope people are fine with that.
> > > 
> > > The diff below is stacked on the previous.  Reviews and oks welcome
> > > for both.
> > > 
> > > 
> > > Index: options.c
> > > ===================================================================
> > > --- options.c.orig	2024-04-16 00:22:04.099000958 +0100
> > > +++ options.c	2024-04-16 00:22:52.969076981 +0100
> > > @@ -237,11 +237,10 @@
> > >  #define	F_ACPIO	1	/* format when called as cpio -c */
> > >  #define	F_CPIO	3	/* format when called as cpio */
> > >  #define F_OTAR	4	/* format when called as tar -o */
> > > -#define F_TAR	5	/* format when called as tar */
> > >  #ifdef SMALL
> > > -# define DEFLT	5	/* default write format when called as pax: ustar */
> > > +# define F_TAR	5	/* format when called as tar: ustar */
> > 
> > Can we make the comment start with "default write ..." again? :)
> 
> Sigh, I messed up the refresh after your commit to this file.
> Here's a much better diff, sorry for the back and forth.

OK caspar@ for the diff to make pax the default and for the bigger
diff that adds the -F flag. But also for this, let's wait for millert@.

During testing, I identified a bug in the code that *reads*
extended headers but I don't think that's a showstopper for this
(see "Subject: pax/tar: reading extended headers of > 512 bytes fails"
on bugs@).

Caspar

> 
> 
> Index: options.c
> ===================================================================
> --- options.c.orig	2024-04-16 12:01:43.129000265 +0100
> +++ options.c	2024-04-16 12:54:33.309170247 +0100
> @@ -237,10 +237,11 @@
>  #define	F_ACPIO	1	/* format when called as cpio -c */
>  #define	F_CPIO	3	/* format when called as cpio */
>  #define F_OTAR	4	/* format when called as tar -o */
> -#define F_TAR	5	/* format when called as tar */
>  #ifdef SMALL
> +# define F_TAR	5	/* default write format when called as tar: ustar */
>  # define DEFLT	5	/* default write format when called as pax: ustar */
>  #else
> +# define F_TAR	10	/* default write format when called as tar: ustar */
>  # define DEFLT	10	/* default write format when called as pax: pax */
>  #endif
>  
> Index: tar.1
> ===================================================================
> --- tar.1.orig	2024-04-16 12:01:43.129000265 +0100
> +++ tar.1	2024-04-16 12:01:43.669000008 +0100
> @@ -144,7 +144,7 @@
>  Stop after the first error.
>  .It Fl F Ar format
>  Specify the output archive format, with the default format being
> -.Cm ustar .
> +.Cm pax .
>  .Nm
>  currently supports the following formats:
>  .Bl -tag -width "sv4cpio"
> 
> -- 
> jca
>