Bug 189618

Summary: net/GeoIP: geoipupdate.sh don't update file atomically
Product: Ports & Packages Reporter: Yasuhito FUTATSUKI <futatuki>
Component: Individual Port(s)Assignee: Adam Weinberger <adamw>
Status: Closed FIXED    
Severity: Affects Only Me CC: adamw, freebsd-bug-report-yf
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
Updated patch to fix problem none

Description Yasuhito FUTATSUKI 2014-05-10 18:10:00 UTC
geoipupdate.sh provided from net/GeoIP, produced from files/geoipupdate.sh.in,
don't update GeoIP.dat atomically. It clears original file by using shell
redirect (>), then download and gunzip to it.
So, if other process try to use it while updating, the process will see broken data.

Fix: fetch GeoIP.dat.gz and gunzip it as filename other than GeoIP.dat in the same file system, then rename(2) to GeoIP.dat.


Patch attached with submission follows:
How-To-Repeat: run /usr/local/bin/geoipupdate.sh as root
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-05-10 18:10:04 UTC
Responsible Changed
From-To: freebsd-ports-bugs->dhn

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Yasuhito FUTATSUKI 2014-06-04 04:06:47 UTC
Created attachment 143349 [details]
Updated patch to fix problem

Update previous patch to merge with Bug 187906.
Comment 3 Adam Weinberger freebsd_committer freebsd_triage 2014-07-22 12:01:36 UTC
I had no idea this PR was out there! I maintain GeoIP now, so I'm taking this PR and I'll get that patch committed very soon.
Comment 4 Adam Weinberger freebsd_committer freebsd_triage 2014-07-22 12:31:58 UTC
Committed with small modifications in r362534. Thank you for submitting this!