[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] closed stderr can make tar corrupt its output archive
From: |
Joerg Schilling |
Subject: |
Re: [Bug-tar] closed stderr can make tar corrupt its output archive |
Date: |
Sat, 27 Aug 2005 22:52:32 +0200 |
User-agent: |
nail 11.2 8/15/04 |
Jim Meyering <address@hidden> wrote:
> If tar is run in the following manner:
> - in --create mode, with a named target (i.e., not stdout),
> - with stderr closed, and
> - in a way that provokes tar to write a diagnostic,
> then tar corrupts the named output archive by writing the diagnostic it.
>
> Here's a demo:
>
> $ rm -rf a; mkdir -p a/b; chmod 0 a/b; tar cf x.tar a 2>&-; \
> head -c39 x.tar|grep tar: ; chmod -R 700 a; rm -rf a
> tar: a: Cannot open: Permission denied
>
> That shows that the first line of the created archive, x.tar,
> is tar's own diagnostic.
Besides the fact that "head -c39 x.tar" is illegal ans will cause this
error message: head: Ungültige Option -- c
It needs to be "head -39c x.tar"...
What you see is definitely not a GNU tar bug - it happens with every tar
implementation (except star in default mode that forks, creates a FIFO
and a pipe that will get fd#2 and close it in the tar process... with
star -no-fifo .... you get the same).
What you describe is not a bug in GNU tar (or any tar) but it is a result
of "what you see is what you told sh...".
Jörg
--
EMail:address@hidden (home) Jörg Schilling D-13353 Berlin
address@hidden (uni)
address@hidden (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
Re: [Bug-tar] closed stderr can make tar corrupt its output archive, Sergey Poznyakoff, 2005/08/28