[Top][All Lists]

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

[Bug-tar] Tar cheats when directed to /dev/null

From: Phillip Susi
Subject: [Bug-tar] Tar cheats when directed to /dev/null
Date: Wed, 24 Mar 2010 11:57:26 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20100317 Thunderbird/3.0.4

After spending a day going out of my mind trying to figure out very
strange results from some performance comparisons I was doing, I finally
figured out that tar was cheating.  I was directing the output of
various backup utilities to /dev/null to make sure the output did not
interfere with the reading since I didn't actually have a backup disk to
write to.  It seems that tar specifically tests if its output fd is
connected to /dev/null and if it is, it doesn't bother reading the files
and writing to output at all, instead it just seems to stat all of the
files, then exit.

This reminds me of an old "optimization" that I heard some compiler once
did to cheat a benchmark by short circuiting all of the busy work the
benchmark did when the compiler detected the name of the input file was
whetstone.c.  Renaming the file and recompiling got correct results.
This is very bad behavior.

reply via email to

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