Bug 189618 - net/GeoIP: geoipupdate.sh don't update file atomically
Summary: net/GeoIP: geoipupdate.sh don't update file atomically
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Adam Weinberger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-10 18:10 UTC by Yasuhito FUTATSUKI
Modified: 2014-07-22 12:31 UTC (History)
2 users (show)

See Also:


Attachments
file.diff (753 bytes, patch)
2014-05-10 18:10 UTC, Yasuhito FUTATSUKI
no flags Details | Diff
Updated patch to fix problem (1.12 KB, patch)
2014-06-04 04:06 UTC, Yasuhito FUTATSUKI
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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!