bug-tar
[Top][All Lists]
Advanced

[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 23:34:10 +0200
User-agent: nail 11.2 8/15/04

Jim Meyering <address@hidden> wrote:

> > It needs to be "head -39c x.tar"...
>
> Oh, I see.  `head -c39' works fine with GNU head, so you must be
> using some other version.  I agree that using -39c is more portable.

If your head program accepts -c39, I would call this a bug.


> The bug is that tar assumed open/creat would never return 2.
> The patch I supplied shows that this bug in GNU tar can be fixed
> with minimal effort.

I see nothing in your patch that could change the behavior.

But the problem not is that a program incorrectly asumes that open()
would never return 2.

The "problem" is that the program correctly asumes that stderr is an
open fd at program startup. There was a related discussion some time
before on the POSIX mailing list.

With star in (default mode with FIFO) you get even other problems.
The libschily error output rutines check the write(2) return code
and abort star because of the write problem when fd#2 is not open.

If I recall the POSIX discussion correctly, if POSIX would explicitly 
allow this, the correct fix would be to enhance the startup code before 
main() is called to make sure that things are as expected.....

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




reply via email to

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