-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
go uses lstat instead of stat to test date of files #5830
Labels
Comments
cmd/go will definitely use syscall.Stat to determine the modification time of source files, it uses Lstat just to do filepath.EvalSymlinks. i tried to reproduce the problem like this, but it doesn't reproduce. $ ../bin/go install -v std $ mv pkg/errors/errors.go pkg/errors/errors2.go $ ln -s errors2.go pkg/errors/errors.go $ ../bin/go install -v std $ i even tried to move the source file to another partition, but as long as i perserve the mtime, go won't try to reinstall the packages. are you sure that you have preserved the correct mtime in /usr/share/golang/src/pkg/ directory tree? |
Comment 6 by richard.wm.jones: Attached is the strace output. Attachments:
|
did you pass -f to strace? my output of "strace -f -olog ../bin/go install -v std" clearly show this (this is output of "grep -A2 -B2 errors.go log"): 26033 getdents64(3, /* 6 entries */, 4096) = 200 26033 getdents64(3, /* 0 entries */, 4096) = 0 26033 lstat("/home/minux/s/go/src/pkg/errors/errors_test.go", {st_mode=S_IFREG|0644, st_size=1271, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/errors/errors.go", {st_mode=S_IFREG|0644, st_size=499, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/errors/example_test.go", {st_mode=S_IFREG|0644, st_size=692, ...}) = 0 26033 close(3) = 0 26033 open("/home/minux/s/go/src/pkg/errors/errors.go", O_RDONLY|O_CLOEXEC) = 3 26033 read(3, "// Copyright 2011 The Go Authors"..., 4096) = 499 26033 close(3) = 0 -- 26033 getdents64(3, /* 6 entries */, 4096) = 200 26033 getdents64(3, /* 0 entries */, 4096) = 0 26033 lstat("/home/minux/s/go/src/pkg/errors/errors_test.go", {st_mode=S_IFREG|0644, st_size=1271, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/errors/errors.go", {st_mode=S_IFREG|0644, st_size=499, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/errors/example_test.go", {st_mode=S_IFREG|0644, st_size=692, ...}) = 0 26033 close(3) = 0 -- 26033 getdents64(3, /* 0 entries */, 4096) = 0 26033 lstat("/home/minux/s/go/src/pkg/go/scanner/scanner_test.go", {st_mode=S_IFREG|0644, st_size=18676, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/go/scanner/errors.go", {st_mode=S_IFREG|0644, st_size=3081, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/go/scanner/example_test.go", {st_mode=S_IFREG|0644, st_size=1071, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/go/scanner/scanner.go", {st_mode=S_IFREG|0644, st_size=17022, ...}) = 0 26033 close(3) = 0 26033 open("/home/minux/s/go/src/pkg/go/scanner/errors.go", O_RDONLY|O_CLOEXEC) = 3 26033 read(3, "// Copyright 2009 The Go Authors"..., 4096) = 3081 26033 close(3) = 0 -- 26033 getdents64(3, /* 0 entries */, 4096) = 0 26033 lstat("/home/minux/s/go/src/pkg/go/scanner/scanner_test.go", {st_mode=S_IFREG|0644, st_size=18676, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/go/scanner/errors.go", {st_mode=S_IFREG|0644, st_size=3081, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/go/scanner/example_test.go", {st_mode=S_IFREG|0644, st_size=1071, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/go/scanner/scanner.go", {st_mode=S_IFREG|0644, st_size=17022, ...}) = 0 -- 26033 getdents64(3, /* 6 entries */, 4096) = 200 26033 getdents64(3, /* 0 entries */, 4096) = 0 26033 lstat("/home/minux/s/go/src/pkg/errors/errors_test.go", {st_mode=S_IFREG|0644, st_size=1271, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/errors/errors.go", {st_mode=S_IFREG|0644, st_size=499, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/errors/example_test.go", {st_mode=S_IFREG|0644, st_size=692, ...}) = 0 26033 close(3) = 0 26033 open("/home/minux/s/go/src/pkg/errors/errors.go", O_RDONLY|O_CLOEXEC) = 3 26033 read(3, "// Copyright 2011 The Go Authors"..., 4096) = 499 26033 close(3) = 0 -- 26033 getdents64(3, /* 0 entries */, 4096) = 0 26033 lstat("/home/minux/s/go/src/pkg/go/scanner/scanner_test.go", {st_mode=S_IFREG|0644, st_size=18676, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/go/scanner/errors.go", {st_mode=S_IFREG|0644, st_size=3081, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/go/scanner/example_test.go", {st_mode=S_IFREG|0644, st_size=1071, ...}) = 0 26033 lstat("/home/minux/s/go/src/pkg/go/scanner/scanner.go", {st_mode=S_IFREG|0644, st_size=17022, ...}) = 0 26033 close(3) = 0 26033 open("/home/minux/s/go/src/pkg/go/scanner/errors.go", O_RDONLY|O_CLOEXEC) = 3 26033 read(3, "// Copyright 2009 The Go Authors"..., 4096) = 3081 26033 close(3) = 0 -- 26033 stat("/home/minux/s/go/pkg/linux_amd64/errors.a", {st_mode=S_IFREG|0644, st_size=7100, ...}) = 0 26033 stat("/home/minux/s/go/pkg/linux_amd64/runtime.a", {st_mode=S_IFREG|0644, st_size=1087872, ...}) = 0 26033 stat("/home/minux/s/go/src/pkg/errors/errors.go", {st_mode=S_IFREG|0644, st_size=499, ...}) = 0 26033 stat("/home/minux/s/go/pkg/linux_amd64/sync/atomic.a", {st_mode=S_IFREG|0644, st_size=8530, ...}) = 0 26033 stat("/home/minux/s/go/pkg/linux_amd64/runtime.a", {st_mode=S_IFREG|0644, st_size=1087872, ...}) = 0 -- 26033 stat("/home/minux/s/go/pkg/linux_amd64/unicode.a", {st_mode=S_IFREG|0644, st_size=585092, ...}) = 0 26033 stat("/home/minux/s/go/pkg/linux_amd64/unicode/utf8.a", {st_mode=S_IFREG|0644, st_size=22640, ...}) = 0 26033 stat("/home/minux/s/go/src/pkg/go/scanner/errors.go", {st_mode=S_IFREG|0644, st_size=3081, ...}) = 0 26033 stat("/home/minux/s/go/src/pkg/go/scanner/scanner.go", {st_mode=S_IFREG|0644, st_size=17022, ...}) = 0 26033 stat("/home/minux/s/go/pkg/linux_amd64/go/ast.a", {st_mode=S_IFREG|0644, st_size=945492, ...}) = 0 |
because go programs are multithreaded. $ strace -olog ../bin/go install -v std $ ls -l log -rw-r--r-- 1 minux minux 881546 Jul 3 21:39 log $ strace -f -olog ../bin/go install -v std $ ls -l log -rw-r--r-- 1 minux minux 1952415 Jul 3 21:39 log try it yourself to see the difference. as i've explained, i even moved the source to another partition, and still couldn't reproduce the issue. |
Comment 10 by richard.wm.jones: Here's the strace -f output, but it's still not calling stat on errors.go. Also the stat on various files that appear to be involved: $ stat /usr/lib64/golang/src/pkg/errors/errors.go File: ‘/usr/lib64/golang/src/pkg/errors/errors.go’ -> ‘../../../../../share/golang/src/pkg/errors/errors.go’ Size: 52 Blocks: 0 IO Block: 4096 symbolic link Device: fd02h/64770d Inode: 18588 Links: 1 Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root) Context: system_u:object_r:lib_t:s0 Access: 2013-07-03 15:11:22.042166200 +0100 Modify: 2013-07-03 15:11:09.367183206 +0100 Change: 2013-07-03 15:11:09.368183204 +0100 Birth: - $ stat /usr/share/golang/src/pkg/errors/errors.go File: ‘/usr/share/golang/src/pkg/errors/errors.go’ Size: 499 Blocks: 8 IO Block: 4096 regular file Device: fd02h/64770d Inode: 21386 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Context: system_u:object_r:usr_t:s0 Access: 2013-07-03 15:11:22.042166200 +0100 Modify: 2013-06-13 04:08:08.000000000 +0100 Change: 2013-07-03 15:11:12.155179500 +0100 Birth: - $ stat /usr/lib64/golang/pkg/linux_amd64/errors.a File: ‘/usr/lib64/golang/pkg/linux_amd64/errors.a’ Size: 6940 Blocks: 16 IO Block: 4096 regular file Device: fd02h/64770d Inode: 15567 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Context: system_u:object_r:lib_t:s0 Access: 2013-07-03 15:11:22.095166128 +0100 Modify: 2013-06-19 16:18:50.000000000 +0100 Change: 2013-07-03 15:11:07.938185098 +0100 Birth: - Attachments:
|
the downstream bug report: https://bugzilla.redhat.com/show_bug.cgi?id=973842 i've verified that downstream doesn't apply any patches to cmd/go and its dependencies. |
Comment 13 by richard.wm.jones: File: ‘/usr/lib64/golang/pkg/tool/linux_amd64/6g’ Size: 569731 Blocks: 1120 IO Block: 4096 regular file Device: fd02h/64770d Inode: 16914 Links: 1 Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) Context: system_u:object_r:lib_t:s0 Access: 2013-07-03 15:11:22.071166161 +0100 Modify: 2013-06-19 16:18:49.000000000 +0100 Change: 2013-07-03 15:11:08.712184074 +0100 Birth: - Attachments:
|
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by richard.wm.jones:
The text was updated successfully, but these errors were encountered: