Re:Falsehoods programmers believe about build systems (2012)
by sabujp on Saturday July 18, 2020 @03:26PM
(#23884079)
I'm no blaze/bazel expert (hopefully someone will add their own thoughts), but:
[ Parent
| on HN ]
Re:Falsehoods programmers believe about build systems (2012)
by tzs on Saturday July 18, 2020 @05:54PM
(#23885168)
> 2. Compilers will always modify the timestamps on every file they are expected to output : if a write happens why not update mtime? nanosecond precision, what year is it?
It has nanosecond precision, but on most systems it does not have nanosecond resolution.
$ touch a1; sleep .0001; touch a2; stat a1 a2 | grep Modify:
Modify: 2020-07-18 21:37:56.421487075 +0000
Modify: 2020-07-18 21:37:56.421487075 +0000
$ touch a1; sleep .0001; touch a2; stat a1 a2 | grep Modify:
Modify: 2020-07-18 21:37:57.397502229 +0000
Modify: 2020-07-18 21:37:57.397502229 +0000
$ touch a1; sleep .0001; touch a2; stat a1 a2 | grep Modify:
Modify: 2020-07-18 21:37:58.273515840 +0000
Modify: 2020-07-18 21:37:58.277515902 +0000
$ touch a1; sleep .0001; touch a2; stat a1 a2 | grep Modify:
Modify: 2020-07-18 21:41:00.736348218 +0000
Modify: 2020-07-18 21:41:00.736348218 +0000
$ touch a1; sleep .0001; touch a2; stat a1 a2 | grep Modify:
Modify: 2020-07-18 21:41:01.708363288 +0000
Modify: 2020-07-18 21:41:01.708363288 +0000
$ touch a1; sleep .0001; touch a2; stat a1 a2 | grep Modify:
Modify: 2020-07-18 21:41:02.504375653 +0000
Modify: 2020-07-18 21:41:02.508375715 +0000
Note that the difference is either 0 or 0.004000062. This is on a Debian 9 system running on an Amazon Lightsail instance with an ext4 filesystem.Here's a quick and dirty script to play with this:
C=0
R=0
while :
do
R=$((R+1))
touch a1; sleep $1; touch a2
T1=$(stat a1 | grep Modify | sed -e 's/.*://' | sed -e 's/ .*//')
T2=$(stat a2 | grep Modify | sed -e 's/.*://' | sed -e 's/ .*//')
if [ $T1 != $T2 ]; then
dc <<HERE
20k $T2 $T1 - p
HERE
C=$((C+1))
if [ $C -eq 100 ]; then
echo "$R runs"
exit 0
fi
fi
done
Output on the above system: $ bash t.sh 0.001 | sort | uniq -c
4 .004000061
83 .004000062
13 .004000063
1 222 runs
and on a VMWare Fusion VM running Debian 8 on my Mac: $ bash t.sh 0.001 | sort | uniq -c
29 .003999599
44 .003999600
27 .003999601
1 323 runs
Re:Falsehoods programmers believe about build systems (2012)
by sabujp on Sunday July 19, 2020 @07:04AM
(#23888519)
ahh yea thanks for the reminder, i think bazel also hashes all inputs and outputs
Re:Falsehoods programmers believe about build systems (2012)
by CuriousSkeptic on Sunday July 19, 2020 @03:46AM
(#23887738)
> not sure what the alternative to textual expansion (parsing?) is
Just realized they other day that PowerShell does this (parsing instead of expansion). Which means much less worrying about escaping output of arguments.
Re:Falsehoods programmers believe about build systems (2012)
by tzs on Saturday July 18, 2020 @05:31PM
(#23885015)
OT: when did HN start wrapping long lines in indented text?
Re:Falsehoods programmers believe about build systems (2012)
by SilasX on Saturday July 18, 2020 @05:52PM
(#23885151)
It's not because the lines are long but because they're prefixed by four spaces (and for anyone reading, please don't do that unless it's actual code).
Re:Falsehoods programmers believe about build systems (2012)
by tzs on Saturday July 18, 2020 @06:02PM
(#23885218)
It's wrapping lines prefixed with two spaces now. The comment I just posted a couple minutes ago with indented shell input and output definitely used two spaces and it is wrapping on my phone and on my desktop if I narrow the window enough.