Skip to content
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

Touch files after moving #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Touch files after moving #158

wants to merge 1 commit into from

Conversation

nilbus
Copy link

@nilbus nilbus commented Oct 11, 2019

Problem overview: A project I use on a docker container watches for changes to files. It ignores file added and moved_to events, only listening file modification FS events to trigger the desired behavior (which never happens with Mutagen). Mutegen's staging strategy is a good and correct one; I'm just looking into the possibility of a workaround.

This is a spike to see if I could get something working, not ready to merge.

I'm confident that Chtimes is running in my docker container, but unlike running touch locally, it's not triggering modifications.

I verified that the code in question is running by adding os.Create(filePath = ".synced") adjacent to the Chtimes call, and it does indeed create a .synced-suffixed file for each file that is modified.

I'll continue investigating, including confirming whether Chtimes returns any error, but please let me know if you have any ideas that might put me in the right direction.

@nilbus nilbus changed the title Adjust mtime,atime on files after moving Touch files after moving Oct 11, 2019
@codecov-io
Copy link

codecov-io commented Oct 11, 2019

Codecov Report

Merging #158 into master will increase coverage by 0.16%.
The diff coverage is 65.62%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #158      +/-   ##
=========================================
+ Coverage   57.03%   57.2%   +0.16%     
=========================================
  Files         198     198              
  Lines       13055   13085      +30     
=========================================
+ Hits         7446    7485      +39     
+ Misses       4662    4655       -7     
+ Partials      947     945       -2
Impacted Files Coverage Δ
pkg/filesystem/directory_posix.go 54.49% <60%> (+0.3%) ⬆️
pkg/filesystem/directory_windows.go 55.21% <60%> (+0.25%) ⬆️
pkg/synchronization/core/transition.go 66.47% <85.71%> (+0.33%) ⬆️
...ng/internal/third_party/winfsnotify/winfsnotify.go 63.12% <0%> (-0.8%) ⬇️
pkg/synchronization/controller.go 58.81% <0%> (-0.35%) ⬇️
...ing/internal/third_party/notify/watcher_inotify.go 62.78% <0%> (+1.34%) ⬆️
pkg/filesystem/watching/watch_recursive_windows.go 70.96% <0%> (+1.61%) ⬆️
pkg/synchronization/endpoint/local/endpoint.go 67.83% <0%> (+2.33%) ⬆️
pkg/agent/valve.go 94.73% <0%> (+10.52%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cd6f4e1...155fbe1. Read the comment docs.

@xenoscopic
Copy link
Member

Hey, thanks for sending this and for the feedback regarding the watching behavior. I'm glad to hear that there's a simple solution that's workable. I'm not sure why you're seeing a behavioral difference between os.Chtimes and touch. My best guesses would be:

  1. An error that's not being caught
  2. A slightly different system call ordering or parameter set

The first should be relatively easy to pick up. The latter would probably involve attaching strace to the agent process running in the container and comparing that with the strace on touch.

I can have a look at this later this week.

@xenoscopic
Copy link
Member

This is now tracked by #163.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants