Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

grep me no patterns and I'll tell you no lines.


devel / comp.unix.shell / Re: cd /tmp && tar -cvf - /etc | tar -xvf -

SubjectAuthor
o Re: cd /tmp && tar -cvf - /etc | tar -xvf -joerg

1
Re: cd /tmp && tar -cvf - /etc | tar -xvf -

<s56jeu$ro5$1@news.dns-netz.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3633&group=comp.unix.shell#3633

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!news.dns-netz.com!news.freedyn.net!.POSTED!not-for-mail
From: joe...@schily.net
Newsgroups: comp.unix.shell
Subject: Re: cd /tmp && tar -cvf - /etc | tar -xvf -
Date: Wed, 14 Apr 2021 11:25:18 -0000 (UTC)
Message-ID: <s56jeu$ro5$1@news.dns-netz.com>
References: <983fa996-a084-4948-918e-0ff20c55560dn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: eJxdjcEKAiEURdf1FQ9XBWmjTDCMCBP9QtFaVMxwnjI6RH19tu2sz7kX3aswi4Wiqx9m0iwhp1IDeqqNSStWRZ7JLX4q5hHimzWPyO0mJu9/ktVVKyKGXnAiYdYh0jaSow5YC61JkbW41kz4f0TgCHdnD8B7OOcFRCc4cD6K08gHoF0DdrfrZf8FNd80SQ==
Cancel-Lock: sha1:Qs/uWr1HAXXGf94ZA9Ect2Qioqw=
X-Newsreader: trn 4.0-test76 (Apr 2, 2001)
X-Abuse-Contact: "abuse@dns-netz.com"
 by: joe...@schily.net - Wed, 14 Apr 2021 11:25 UTC

In article <983fa996-a084-4948-918e-0ff20c55560dn@googlegroups.com>,
hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:
>I try to understand the following command sequenc:
>
>$ cd /tmp && tar -cvf - /etc | tar -xvf -

If you are running this command as root using a standard tar implementation,
this destroys the content of the /etc directory.

This is beacause:

1) The first tar archives absulute path names and the second tar
extracts absolute path names.

2) A standard tar extracts files unconditionally, regardless of whether
the current file in the filesystem is newer than the file from
the archive that is going to be extracted.

There are modern tar implementations that avoid this:

Star implements methods since ~35 years to avoid this problem:

star strips off leading slashes while extracting TAR archives unless
the option -P is in use

star by default does only extract files if they are newer than existing
files in the filesystem unless the option -U is used.

Gtar strips off leading slashes while creating archives.

--
EMail:joerg@schily.net Jörg Schilling D-13353 Berlin
Blog: http://schily.blogspot.com/
URL: http://cdrecord.org/private/ http://sourceforge.net/projects/schilytools/files/

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor