-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
pkg/archive: ignore mtime changes on directories #11422
Conversation
omg cool!!!! |
That condition looks awful :E |
@LK4D4 so it goes |
imma try it on overlay |
this fixes TestDiffEnsureOnlyKmsgAndPtmx and TestSaveDirectoryPermissions for me |
/me looking |
ah, TestChangesDirsMutated |
@@ -221,7 +221,7 @@ func (info *FileInfo) addChanges(oldInfo *FileInfo, changes *[]Change) { | |||
oldStat.Rdev() != newStat.Rdev() || | |||
// Don't look at size for dirs, its not a good measure of change | |||
(oldStat.Size() != newStat.Size() && oldStat.Mode()&syscall.S_IFDIR != syscall.S_IFDIR) || | |||
!sameFsTimeSpec(oldStat.Mtim(), newStat.Mtim()) || | |||
(!sameFsTimeSpec(oldStat.Mtim(), newStat.Mtim()) && oldStat.Mode()&syscall.S_IFDIR != syscall.S_IFDIR) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rewrite it pls?
Like
oldStat.Mode()&syscall.S_IFDIR != 0 &&
(
oldStat.Size() != newStat.Size() ||
!sameFsTimeSpec(oldStat.Mtim(), newStat.Mtim())
)
52d30b3
to
3c96c65
Compare
yayyy this fixed integration tests :D |
3c96c65
to
7e23793
Compare
@LK4D4 updated PTAL |
@@ -220,8 +220,8 @@ func (info *FileInfo) addChanges(oldInfo *FileInfo, changes *[]Change) { | |||
oldStat.Gid() != newStat.Gid() || | |||
oldStat.Rdev() != newStat.Rdev() || | |||
// Don't look at size for dirs, its not a good measure of change | |||
(oldStat.Size() != newStat.Size() && oldStat.Mode()&syscall.S_IFDIR != syscall.S_IFDIR) || | |||
!sameFsTimeSpec(oldStat.Mtim(), newStat.Mtim()) || | |||
(oldStat.Mode()&syscall.S_IFDIR != syscall.S_IFDIR && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we comparing not with 0
? Everywhere in other code we comparing with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, because the line above wasnt comparing to zero... :-)
On Mar 16, 2015 4:55 PM, "Alexander Morozov" notifications@github.com
wrote:
In pkg/archive/changes.go
#11422 (comment):@@ -220,8 +220,8 @@ func (info *FileInfo) addChanges(oldInfo *FileInfo, changes *[]Change) {
oldStat.Gid() != newStat.Gid() ||
oldStat.Rdev() != newStat.Rdev() ||
// Don't look at size for dirs, its not a good measure of change
(oldStat.Size() != newStat.Size() && oldStat.Mode()&syscall.S_IFDIR != syscall.S_IFDIR) ||
!sameFsTimeSpec(oldStat.Mtim(), newStat.Mtim()) ||
(oldStat.Mode()&syscall.S_IFDIR != syscall.S_IFDIR &&
Why we comparing not with 0? Everywhere in other code we comparing with
it.—
Reply to this email directly or view it on GitHub
https://github.com/docker/docker/pull/11422/files#r26526731.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look, your tests already failing because of this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh?
On Mar 16, 2015 5:04 PM, "Alexander Morozov" notifications@github.com
wrote:
In pkg/archive/changes.go
#11422 (comment):@@ -220,8 +220,8 @@ func (info *FileInfo) addChanges(oldInfo *FileInfo, changes *[]Change) {
oldStat.Gid() != newStat.Gid() ||
oldStat.Rdev() != newStat.Rdev() ||
// Don't look at size for dirs, its not a good measure of change
(oldStat.Size() != newStat.Size() && oldStat.Mode()&syscall.S_IFDIR != syscall.S_IFDIR) ||
!sameFsTimeSpec(oldStat.Mtim(), newStat.Mtim()) ||
(oldStat.Mode()&syscall.S_IFDIR != syscall.S_IFDIR &&
Look, your tests already failing because of this!
—
Reply to this email directly or view it on GitHub
https://github.com/docker/docker/pull/11422/files#r26527502.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was joke :) But I still don't like it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:-) well the parens weren't accepted on new lines, and splitting the next seemed even more confusing
you can change to closes #9874 so it actually closes it too :D |
This change needs to be checked with push and import on other graph drivers like aufs. We had some problems a while ago and I'm not sure this won't cause problems there again. |
hmmm good call i can run it across the matrix |
seems not to fail on aufs or btrfs for me |
LGTM but @unclejack is the archive master here :) |
I can confirm that the test for the previously fixed issue with permissions is still there and it's still passing. I'll test this on all graph drivers and comment again to confirm it's OK for the merge as far as I'm concerned. @jfrazelle Thank you! |
on overlay fs, the mtime of directories changes in a container where new files are added in an upper layer (e.g. '/etc'). This flags the directory as a change where there was none. Closes moby#9874 Signed-off-by: Vincent Batts <vbatts@redhat.com>
7e23793
to
2ce37f6
Compare
also, i just updated the commit message to "closes ..", instead of "related ..." |
@unclejack results? On Tue, Mar 17, 2015 at 8:49 AM, unclejack notifications@github.com wrote:
|
I think we should get this in for 1.6 |
Overlay is working properly now. Thanks, @vbatts! LGTM |
pkg/archive: ignore mtime changes on directories
@jfrazelle I see this is merged now, should the milestone be moved back to 1.6? |
move it thanks @thaJeztah |
Signed-off-by: John Howard <jhoward@microsoft.com> If fixes an error in sameFsTime which was using `==` to compare two times. The correct way is to use go's built-in timea.Equals(timeb). In changes_windows, it uses sameFsTime to compare mTim of a `system.StatT` to allow TestChangesDirsMutated to operate correctly now. Note there is slight different between the Linux and Windows implementations of detecting changes. Due to moby#9874, and the fix at moby#11422, Linux does not consider a change to the directory time as a change. Windows on NTFS does. See moby#37982 for more information. The result in `TestChangesDirsMutated`, `dir3` is NOT considered a change in Linux, but IS considered a change on Windows. The test mutates dir3 to have a mtime of +1 second. With a handful of tests still outstanding, this change ports most of the unit tests under pkg/archive to Windows. It provides an implementation of `copyDir` in tests for Windows. To make a copy similar to Linux's `cp -a` while preserving timestamps and links to both valid and invalid targets, xcopy isn't sufficient. So I used robocopy, but had to circumvent certain exit codes that robocopy exits with which are warnings. Link to article describing this is in the code.
Signed-off-by: John Howard <jhoward@microsoft.com> If fixes an error in sameFsTime which was using `==` to compare two times. The correct way is to use go's built-in timea.Equals(timeb). In changes_windows, it uses sameFsTime to compare mTim of a `system.StatT` to allow TestChangesDirsMutated to operate correctly now. Note there is slight different between the Linux and Windows implementations of detecting changes. Due to moby#9874, and the fix at moby#11422, Linux does not consider a change to the directory time as a change. Windows on NTFS does. See moby#37982 for more information. The result in `TestChangesDirsMutated`, `dir3` is NOT considered a change in Linux, but IS considered a change on Windows. The test mutates dir3 to have a mtime of +1 second. With a handful of tests still outstanding, this change ports most of the unit tests under pkg/archive to Windows. It provides an implementation of `copyDir` in tests for Windows. To make a copy similar to Linux's `cp -a` while preserving timestamps and links to both valid and invalid targets, xcopy isn't sufficient. So I used robocopy, but had to circumvent certain exit codes that robocopy exits with which are warnings. Link to article describing this is in the code.
Signed-off-by: John Howard <jhoward@microsoft.com> If fixes an error in sameFsTime which was using `==` to compare two times. The correct way is to use go's built-in timea.Equals(timeb). In changes_windows, it uses sameFsTime to compare mTim of a `system.StatT` to allow TestChangesDirsMutated to operate correctly now. Note there is slight different between the Linux and Windows implementations of detecting changes. Due to moby/moby#9874, and the fix at moby/moby#11422, Linux does not consider a change to the directory time as a change. Windows on NTFS does. See moby/moby#37982 for more information. The result in `TestChangesDirsMutated`, `dir3` is NOT considered a change in Linux, but IS considered a change on Windows. The test mutates dir3 to have a mtime of +1 second. With a handful of tests still outstanding, this change ports most of the unit tests under pkg/archive to Windows. It provides an implementation of `copyDir` in tests for Windows. To make a copy similar to Linux's `cp -a` while preserving timestamps and links to both valid and invalid targets, xcopy isn't sufficient. So I used robocopy, but had to circumvent certain exit codes that robocopy exits with which are warnings. Link to article describing this is in the code. Upstream-commit: 56b732058e4d55aa5559996cce03fe11e6ff3baa Component: engine
Signed-off-by: John Howard <jhoward@microsoft.com> If fixes an error in sameFsTime which was using `==` to compare two times. The correct way is to use go's built-in timea.Equals(timeb). In changes_windows, it uses sameFsTime to compare mTim of a `system.StatT` to allow TestChangesDirsMutated to operate correctly now. Note there is slight different between the Linux and Windows implementations of detecting changes. Due to moby#9874, and the fix at moby#11422, Linux does not consider a change to the directory time as a change. Windows on NTFS does. See moby#37982 for more information. The result in `TestChangesDirsMutated`, `dir3` is NOT considered a change in Linux, but IS considered a change on Windows. The test mutates dir3 to have a mtime of +1 second. With a handful of tests still outstanding, this change ports most of the unit tests under pkg/archive to Windows. It provides an implementation of `copyDir` in tests for Windows. To make a copy similar to Linux's `cp -a` while preserving timestamps and links to both valid and invalid targets, xcopy isn't sufficient. So I used robocopy, but had to circumvent certain exit codes that robocopy exits with which are warnings. Link to article describing this is in the code.
on overlay fs, the mtime of directories changes in a container where new
files are added in an upper layer (e.g. '/etc'). This flags the
directory as a change where there was none.
Related #9874
Ping @jfrazelle
Signed-off-by: Vincent Batts vbatts@redhat.com