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
Better check for a file change on disk by also monitoring the file size. #1175
Better check for a file change on disk by also monitoring the file size. #1175
Conversation
Can you explain how it's better? |
I don't see it adds much, you have to absolutely know that the newly generated file is a different length. And generating files and touching their mod time is going to break much more than just Geany's detection. What could be sensible though is to check mtime as not equals rather than less than, the file is different if its moved back in time as well as forward in time. |
With the current mtime checking you have to absolutly know that the newly generated file has a greater modification time.
To get deterministic release tar balls, it is necessary for me to touch the files with an explicit time stamp before "tarring" them.
That's why I added the file size check - to get a better geany.
I agree - but I didn't wanted change the existing mtime check behavior. So the technical facts are: |
What if the contents change but the size remains the same, will Geany still notify of the change or just silently clobber the file on disk next save? |
If the file size and mtime are unchanged, Geany silently clobber the file on disk next save. |
What if the file size is unchanged but the mtime is changed? |
Same behavior as in current Geany.
I recognized this but I didn't want to change this check as I thought someone explicit designed it that way. |
I am not sure I understand your use-case, if you change mtime backward geany won't trigger, but if the file size is changed the tarball won't be consistent anyway, so there is not reason to set mtime backward, so geany will trigger. But as you say the change is minimal for local filesystems. I would want to know this works for all sorts of funny file systems, for GIO and non-GIO situations etc since we have always had issues with annoying unneccessary notifications and with missed notifications. We seem to have just got that calmed down a bit and I wouldn't want to stir it up again. |
I don't want discuss and analyse my use-case.
I only added code to get also the file size from the ( already used ) functions g_stat() and g_file_query_info(). |
Ok, but as I pointed out, this needs testing in uncommon configurations, that means effort by somebody, and the relative urgency is informed by the assessment of the use-case. We were wondering why you didn't use
Which is what needs testing, we thought they worked as expected previously, but they didn't, and hence the issues we had. It would be nice if its all ok as expected, but past experience leads to caution. |
OK - I ll give up - I close the pull request!
I thought I start submitting a really small and reasonable patch of my patchset and try to get a better public Geany. |
Agreed, and its great that you offered a pull request. The discussion is not about that, but the benefits. As I said there have been problems in the past with change detection, with things like the failure of notification based detection, the need to separate GIO operations and Clib operations, and having to not mix their code paths. So I have some concern that the change should be tested in more than the local disk case, which always worked, all the time, as expected. This essentially means in various networked environments (SSHFS anybody), and in Windows and SMB shares. None of these are the normal environment for Geany devs, so it costs them time and effort to set up and test it, or to find other contributors to do so. It is perfectly understandable that you would not count that cost when you initially raised the "simple" PR, but it is something project contributors need to consider and weigh against the risks and benefits of the change. So it is perfectly reasonable to enquire how much of a benefit the change brings and if there is an easy workaround if its not applied. That allows people to see how many others might benefit, to see how much effort needs to be applied and how urgently, especially as there is not (that I could find) an existing issue that indicates a need for the change. I'm sorry that you made your first contribution in a sensitive area and found unexpected questioning of the need for it, but I hope the extended explanation helps you to understand the other side. |
If you actually want this merged, why close the pull request? |
Geany only checks if the modification time is newer than the previous fetched.
Having a script generating files and touching those files with an explicit time stamp, geany does not notify the file has changed.
So it's a better check to monitor modification time AND file size.