maxmind / geoipupdate

GeoIP update client code
Apache License 2.0
726 stars 142 forks source link

LocalFileWriter Close needs to release lock file #59

Open amzhughe opened 4 years ago

amzhughe commented 4 years ago

The LocalFileDatabaseWriter's Close() method releases the lock file when finished, but doesn't erase it. This lead to an issue where if a different user tries to run the updater, they don't have permission to access the lock file.

https://github.com/maxmind/geoipupdate/blob/master/pkg/geoipupdate/database/local_file_writer.go#L96

horgh commented 4 years ago

Yeah, it'd be ideal to delete the file. It's that way currently to avoid race conditions. It might be possible to do it, but we'll have to be careful to consider races.

oschwald commented 4 years ago

Could you expand a bit more on your use case? The lock file uses the database directory by default. Both users would need to be able to write to that directory for the database downloads to work.

Perhaps it would make sense for us to have a configuration option to set the access permissions on the files created by geoipupdate.