-
Notifications
You must be signed in to change notification settings - Fork 346
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
Add MD5 and size checks on remote files #582
Conversation
We need e mechanism to refresh a users cache files when the file on the server changes. Also, we need to be aware if a download failed before completing. This PR is exploring solutions to these problems.
Tried to check it out but could not find the |
Dealing with different modification times on OSX and Linux.
Well, there it is. But a bit premature to play with this - I am debugging it to the point it does not crash. Details of the stat structure on OSX differs from Linux, for example, and possibly on Win32. Does your stat have st_mtime? |
Don't know but it was because of this kind of stuff that I wanted to test if it builds. But, as I said, can't switch to this branch. |
Looks like Apple is the only one without st_mtime as it exists under Windows and Linux. Must instead use st_mtimespec.tc_sec.
I don't know why you don't see it. I don't think I did anything different. I created the branch on my computer, then pushed to origin. Updates showing up on this page. |
@joa-quim Did you run |
Tested the time, hash, and size checks. Need solution for corrupted M5D table itself.
When run with -Vd the whole sequence should print messages.
I think this branch is ready to be tested by others. I have implemented all the steps discussed in #549. I was able to test it in the debugger by doing the following steps.
A few things for discussion:
Please give it a try and give feedback. |
Also print when file is found and age < 1 day.
Now I can see the branch. I deduced from this that the branch name only shows up locally when the tests have finished (they hadn't yesterday when I tested). Also, by doing Anyway, tested this only to the point to see that it builds with no errors. |
Improve checks and add more debug messages.
Because of the way GMT registeres inputs etc the dm5_refresh function could be called twice. Added a variable to prevent wasting time on a repeat call.
Just improve the comments and clean up some of the debug print statements.
I think we need the @GenericMappingTools/core group as well as @abanbj to test this branch out. For it to be a real test I suggest you build and use this branch for a few days. After building, please run
Examine the verbose output. If this is the first time it will simply get the gmt_md5_server.txt and that is the end of the check. Then the file may be downloaded if you don't already have it. I have done this here for testing but would be nice to see this working also under WIndows (@joa-quim) and LInux (@leouieda). |
OK, did;
|
I have make a tiny change to that file and updated the gmt_md5_server.txt file so when your file is > 24 hours and you rerun that command it should be clear from the output that it refreshed the file and found that data table had changed and thus deleted it and downloaded it anew. Let me know your experience. |
|
Looks like a successful test, @abanbj. |
I would like to merge this one into master since it is passing the various tests I have tried. However, I would feel happier if more of the @GenericMappingTools/core could give it a try first. |
Did the gmtinfo step |
OK, I updated the gmt_md5_server.txt file so wait 24 hours then try again. |
I guess this shows it had worked.
|
This PR looks good to me. |
Sorry, I missed this notification. I built the recent branch and tried running
|
The gmt_md5_server.txt should be in ~/.gmt/server directory - nothing there? Curl should return with an error code if Internet is down - perhaps after a suitable timeout - so what happens after those mesages? Do you get a libcurl error reported? Is this Linux command line or via python? |
This is all Linux command line. There is nothing in the server folder. As far as I can tell, the file is not actually being downloaded even when the connection is on. No errors from libcurl. |
OK, I will build on my Ubuntu laptop and see if there is anything that changes for me. |
If user has never used remote files we must check if server directory exists and if not create it first.
OK, please update the branch and try again. I had not added a check to see if you had the server directory or not in the refresh function and since I had used remote files for a while I already had that directory before the new MD5 refresh check. I made the changes and it now runs fine for me on Ubuntu in an account that had no such directory to start with. |
Just tested and seems to working for these scenarios:
The only thing that didn't work as expected was the case when the data file is in |
Just a side note on the last post; is the
|
For some reason I had clear cache remove cache and its content, then create an empty cache dir. But that dir will be created when needed, so makes more sense to remove it like everything else. Addresses #582.
For some reason I had clear cache remove cache and its content, then create an empty cache dir. But that dir will be created when needed, so makes more sense to remove it like everything else. Addresses #582.
I will try to turn off Internet and recreate that situation and see how I can catch the no-connection error. Presumably libcurl returns the correct error code and we can issues a message and suggest if they are working off-line to set GMT_AUTO_DOWNLOAD to off. |
Report all errors when getting the gmt_md5_server.txt file fails.
If we cannot connect, then disable auto-download for the rest of the session.
Now, if the libcurl operation on the md5 file fails we complain and then stop checking for that session. This should catch your last case, @leouieda. |
👍 looks good to me |
Time to merge this puppy. |
GMT 6.1.1 is already released, and the 6.1 branch won't be updated.
We need e mechanism to refresh a users cache files when the file on the server changes. Also, we need to be aware if a download failed before completing. This PR is exploring solutions to these problems, as discussed in #549.