bug-coreutils
[Top][All Lists]
Advanced

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

bug#17423: bug with 'tee' command


From: Pádraig Brady
Subject: bug#17423: bug with 'tee' command
Date: Tue, 06 May 2014 18:30:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

tag 17423 notabug
close 17423
stop

On 05/06/2014 11:15 AM, Pawel Jagla wrote:
> 
> Hello
> 
> I discovered a bug with 'tee' command when I sort items in file, and try to
> overwrite output to the same file, like that :
> sort filename |tee filename
> 
> Sometimes it sorts and overwrites file with sorted items, and sometimes it
> clears the file completely (so the file is empty).
> Of course I know that I can do that by adding operator '-o' to sort.
> BTW I am working under RedHat 6 Enterprise, and bash shell.

tee doesn't buffer everything and then write filename,
it does so in parallel, thus giving rise to the "random"
behavior depending on when the sort and tee processes are scheduled.

sort -o is a good way to achieve the required buffer,
since sort needs to buffer all input anyway before
outputting anything.

thanks,
Pádraig.





reply via email to

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