Re: Linux 2.6 nanosecond time stamp weirdness breaks GCC build

From: Alexandre Oliva
Date: Fri Apr 02 2004 - 12:31:20 EST


On Apr 1, 2004, Ulrich Weigand <weigand@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

> - STAMP = echo timestamp >
> + STAMP = sleep 1 >

I don't think this will fix the problem, at least not portably.

sleep 1 > filename

will truncate filename before sleep starts, modifying its timestamp at
that point, and leave it unchanged afterwards. Some systems might
update the timestamp again when the file truncated&opened for writing
is closed, but I don't think this is required. Worse yet: some
systems don't support empty files, and will error out because sleep 1
produced no output. Also, since some filesystems don't have 1-second
granularity, you should probably use `sleep 2' instead.

A more portable way to spell it would be:

STAMP = sleep 2; echo timestamp >

or, in order to make $(STAMP) usable in the middle of &&/|| sequences:

STAMP = { sleep 2; echo timestamp; } >

--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/