[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'tar --delete' destroys an archive

From: Dominique Martinet
Subject: Re: 'tar --delete' destroys an archive
Date: Tue, 2 Aug 2022 06:27:10 +0900

Ingo Br├╝ckl wrote on Mon, Apr 18, 2022 at 09:31:51PM +0200:
> Get bash-5.1.16.tar.gz from https://ftp.gnu.org/gnu/bash/.
> Gunzip it.
> Extract the original: tar xf bash-5.1.16.tar && mv bash-5.1.16 bash-org.
> Remove lib/glob from bash-org: rm -r bash-org/lib/glob.
> Now delete lib/glob from the tar file using: tar --delete --no-recursion 
> --no-wildcards -f 'bash-5.1.16.tar' -- 'bash-5.1.16/lib/glob/sm_loop.c' 
> 'bash-5.1.16/lib/glob/glob.h' 'bash-5.1.16/lib/glob/xmbsrtowcs.c' 
> 'bash-5.1.16/lib/glob/glob.c' 'bash-5.1.16/lib/glob/smatch.c' 
> 'bash-5.1.16/lib/glob/doc/glob.texi' 'bash-5.1.16/lib/glob/doc/Makefile' 
> 'bash-5.1.16/lib/glob/doc/' 'bash-5.1.16/lib/glob/gm_loop.c' 
> 'bash-5.1.16/lib/glob/Makefile.in' 'bash-5.1.16/lib/glob/gmisc.c' 
> 'bash-5.1.16/lib/glob/collsyms.h' 'bash-5.1.16/lib/glob/glob_loop.c' 
> 'bash-5.1.16/lib/glob/strmatch.c' 'bash-5.1.16/lib/glob/ndir.h' 
> 'bash-5.1.16/lib/glob/strmatch.h' 'bash-5.1.16/lib/glob/'.
> Extract the changed tar file: tar xf bash-5.1.16.tar && mv bash-5.1.16 
> bash-del.
> Now compare: diff -Nur bash-org bash-del.
> You'll find lib/readline/doc/hstech.texi changed and 
> lib/readline/doc/rluserman.texi deleted!
> This happens with tar 1.30 (debian/buster) as well as with tar 1.34 
> (self-compiled).

Just so Ingo doesn't think the list is broken I could also reproduce
this on fedora's 1.34; part of hstech.texi is cut off in the middle and
rluserman.texi is embedded with its tar header at the end of
Interesting how tar'd get that wrong like this.

I wouldn't recommend any workflow based on tar --delete anyway but
corrupting data is never good; afraid I don't have the time to really
look into it but there's no obvious memory corruption (valgrind/asan) at


reply via email to

[Prev in Thread] Current Thread [Next in Thread]