-
Notifications
You must be signed in to change notification settings - Fork 18k
misc/cgo/testshared fails on fast enough machines that don't have fine-grained file timestamps #10724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Per #10571, let's not add 4 more seconds of sleep here. Death by a thousand cuts, straw camel back, etc. I'd prefer to move this into Go code in src/cmd/dist/test.go and then it would be much easier to do things like sleep up to 1 second (measuring how long the previous commands took), and do things like check the inode for other changes, if applicable first. It's also easier to parallelize things in Go. |
Most machines are fast enough to do all these steps in a second, I guess most people are using ext4 or something by now. I agree with @bradfitz that sleeps are not the answer. Maybe use https://godoc.org/os#Chtimes to push the times into the past? |
I think and agree that in general moving file times backwards is the best guaranteed reliable way of doing this. You get full control without delays and without worrying about timestamp precision or the speed of operations. |
But it turns out you can't push them too far into the past because then they are older than the compilers and everything gets rebuilt anyway :) Can you try the change at https://golang.org/cl/9768? |
CL https://golang.org/cl/9768 mentions this issue. |
This change works for me. However, 'date -d ...' is not portable; it's a GNU date extension and is missing on (for example) FreeBSD, where 'date -d' means something completely different. (You may already know this and just be trying out the approach to make sure it works.) |
Can we please just move this to Go code in src/cmd/dist/test.go and not worry about portability of shell code? We already have a portable language. |
@bradfitz wins, I rewrote it in Go. |
And fix to work on filesystems with only 1s resolution. Fixes golang#10724 Change-Id: Ia07463f090b4290fc27f5953fa94186463d7afc7
And fix to work on filesystems with only 1s resolution. Fixes golang#10724 Change-Id: Ia07463f090b4290fc27f5953fa94186463d7afc7
And fix to work on filesystems with only 1s resolution. Fixes golang#10724 Change-Id: Ia07463f090b4290fc27f5953fa94186463d7afc7
Ever since it was introduced, one of my machines fails in misc/cgo/testshared when building git master. The failure message:
The ultimate cause is that this machine is fast enough to build (or finish building by writing the files out), touch a file, copy files, and rebuild, all in the same second, and my copy of the git repo is on a filesystem that only has timestamps with a one second granularity. In this situation you need to insert artificial delays of at least a second both before and after the touch-and-copy code in testshared:
The machine that this fails on is a 64-bit Fedora 21 machine using an ext3 filesystem (mounted with relatime, but I don't believe that makes any difference). On Linux, ext3 does not support nanosecond timestamps but ext4 and various other filesystems do to some extent.
The text was updated successfully, but these errors were encountered: