|
|
|
|
|
by jlgreco
4907 days ago
|
|
That's a good question. I had though it worked because the truncate would not actually happen until tac actually wrote something, but now that I look at it more I don't think that is actually the case. `cat > foo` immediately truncates foo before anything is written. Also `tac foo > foo` doesn't work, which discredits my hypothesis that tac's buffering was causing it. Furthermore `cat foo | cat > foo` does not work, but `cat foo | cat | cat > foo` does work. I suspect this behavior is actually a race condition of some sort. Edit: definetly a race condition, shown by larger files: % wc -l foo
1310720 foo
% cat foo | cat | cat > foo
% wc -l foo
16384 1
|
|