Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Rename GeoLite2-City.mmdb.test to GeoLite2-City.mmdb failed #82

Closed
jonathan-kosgei opened this issue Nov 10, 2017 · 1 comment
Closed

Comments

@jonathan-kosgei
Copy link

I have a cron running as root that's supposed to check for updates everyday however all the new downloads are available but the actual renaming fails with the error

geoipupdate 2.5.0
Opened License file /tmp/GeoIP.conf
AccountID 0
LicenseKey 000000000000
Insert edition_id GeoLite2-City
Insert edition_id GeoLite2-ASN
Read in license key /tmp/GeoIP.conf
Number of edition IDs 2
Uncompress file /data/GeoLite2-City.mmdb.gz to /data/GeoLite2-City.mmdb.test
Rename /data/GeoLite2-City.mmdb.test to /data/GeoLite2-City.mmdb
Rename /data/GeoLite2-City.mmdb.test to /data/GeoLite2-City.mmdb failed

@horgh
Copy link
Contributor

horgh commented Nov 10, 2017

Interesting. This means the rename() call failed. Unfortunately we are not printing out what the underlying error is so it's hard to say what is going on.

Are you able to run geoipupdate with strace to capture what the return value from the rename() is? e.g., strace geoipupdate. There will be a lot of output, but we only really need to see rename() lines.

Another way to figure this out would be to alter the code to print the error and rebuild geoipupdate. Something like this:

diff --git a/bin/geoipupdate.c b/bin/geoipupdate.c
index ce347f8..c5133f5 100644
--- a/bin/geoipupdate.c
+++ b/bin/geoipupdate.c
@@ -915,7 +915,7 @@ static int gunzip_and_replace(geoipupdate_s const *const gu,
 
     say_if(gu->verbose, "Rename %s to %s\n", file_path_test, geoip_filename);
     int err = rename(file_path_test, geoip_filename);
-    exit_if(err, "Rename %s to %s failed\n", file_path_test, geoip_filename);
+    exit_if(err, "Rename %s to %s failed: %s\n", file_path_test, geoip_filename, strerror(errno));
 
     if (gu->preserve_file_times && filetime > 0) {
         struct utimbuf utb;

oschwald added a commit that referenced this issue Nov 21, 2017
Also, fixed some incorrect error checking. There are likely many other
places where the error checking needs to be improved. I only fixed
issues that I noticed when trying to improve the existing messages.

Closes #82.
@horgh horgh closed this as completed in #84 Nov 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants