Skip to content

fix(LOC): preserve thousandths of arcseconds in coordinates - #5035

Merged
TomOnTime merged 2 commits into
DNSControl:mainfrom
spicysharkco:fix/loc-seconds-precision
Oct 25, 2026
Merged

TomOnTime merged 2 commits into
DNSControl:mainfrom
spicysharkco:fix/loc-seconds-precision

Conversation

@spicysharkco

Copy link
Copy Markdown
Contributor

LOC() rounds the seconds of latitude and longitude to two decimals, although a LOC record holds thousandths of a second of arc and RFC 1876 writes them up to 59.999.

D("foo.com", "none",
  LOC("a", 42, 21, 43.952, "N", 71, 5, 6.344, "W", -24.01, 1, 200, 10));

dnscontrol push stores 42 21 43.950 N 71 05 6.340 W -24.01m 1m 200m 10m instead of 42 21 43.952 N 71 05 6.344 W -24.01m 1m 200m 10m, about 6 cm off. When the provider already holds the precise record, dnscontrol preview proposes to replace it with the rounded one.

Cause: MakeLOC formats both seconds with %.2f before it parses the record. This came in with the dnsv2 refactor.

Fix: use %.3f for both seconds. The nine 045-loc golden records go back to the values they had before that refactor.

Test: the existing 045-loc.js case fails without the fix and passes with it. go test -p 1 -count=1 ./pkg/js/ ./models/ passes.

LOC records lose the third decimal place in latitude and longitude
seconds. Format both seconds with three decimals before parsing so
stored coordinates match the input. Restore the existing golden records.
@TomOnTime

Copy link
Copy Markdown
Collaborator

Thanks for fixing that!

@TomOnTime
TomOnTime merged commit d0901a6 into DNSControl:main Oct 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants