Bug#921840: metar: Parsing metar record fails due to changes in NOAA API

2019-02-27 Thread Peter Palfrader
Kees, ping!

On Sat, 09 Feb 2019, Sven Paulus wrote:

> * What led up to the situation?
> 
> On February 4th the "metar" tool stopped working.
> At this point NOAA switched responding on their HTTP URL with metar data
> to returning a redirect to the HTTPS variante of the URL.


weasel@orinoco:~$ metar lows
METAR pattern not found in NOAA data.
weasel@orinoco:~$ 
METARURL=https://tgftp.nws.noaa.gov/data/observations/metar/stations/ metar lows
LOWS 271220Z VRB03KT CAVOK 15/M00 Q1027 NOSIG

Cheers,
-- 
|  .''`.   ** Debian **
  Peter Palfrader   | : :' :  The  universal
 https://www.palfrader.org/ | `. `'  Operating System
|   `-https://www.debian.org/



Bug#921840: metar: Parsing metar record fails due to changes in NOAA API

2019-02-09 Thread Sven Paulus
Package: metar
Version: 20061030.1-2.2+b1
Severity: important
Tags: patch

Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

* What led up to the situation?

On February 4th the "metar" tool stopped working.
At this point NOAA switched responding on their HTTP URL with metar data
to returning a redirect to the HTTPS variante of the URL.

This can be seen when stracing the command:

sendto(3, "GET /data/observations/metar/stations/EDDH.TXT HTTP/1.1\r\nHost: 
tgftp.nws.noaa.gov\r\nAccept: */*\r\n\r\n", 98, MSG_NOSIGNAL, NULL, 0) = 98
poll([{fd=3, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=3, events=POLLIN}], 1, 103)   = 1 ([{fd=3, revents=POLLIN}])
poll([{fd=3, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 1 ([{fd=3, 
revents=POLLIN|POLLRDNORM}])
recvfrom(3, "HTTP/1.1 302 Object Moved\r\nLocation: 
https://tgftp.nws.noaa.gov/data/observations/metar/stations/EDDH.TXT\r\nContent-Type:
 text/html\r\nCache-Control: private\r\nConnection: close\r\n\r\n 
This object may be found https://tgftp.nws.noaa.gov/data/observations/metar/stations/EDDH.TXT\;>here
 ", 16384, 0, NULL, NULL) = 310

The resulting output is currently - independent of the given ICAO code:

$ metar KJFK
METAR pattern not found in NOAA data.

Since metar is already using the HTTPS capable curl library, a fix is
easy:

--- src/metar.h.orig2019-02-09 11:42:21.266330785 +0100
+++ src/metar.h 2019-02-09 11:39:30.051454153 +0100
@@ -24,7 +24,7 @@
 #define  METAR_MAXSIZE 512

 /* where to fetch reports */
-#define  METARURL "http://tgftp.nws.noaa.gov/data/observations/metar/stations;
+#define  METARURL "https://tgftp.nws.noaa.gov/data/observations/metar/stations;

 /* clouds */
 typedef struct {

Or - for the debian package - by patching the patch:

--- debian/patches/fix-metarurl.orig2019-02-09 11:44:46.832712464 +0100
+++ debian/patches/fix-metarurl 2019-02-09 11:44:59.796579902 +0100
@@ -18,7 +18,7 @@

  /* where to fetch reports */
 -#define  METARURL 
"http://weather.noaa.gov/pub/data/observations/metar/stations;
-+#define  METARURL "http://tgftp.nws.noaa.gov/data/observations/metar/stations;
++#define  METARURL 
"https://tgftp.nws.noaa.gov/data/observations/metar/stations;

  /* clouds */
  typedef struct {

In debian/control the library dependencies have to be upgraded (at least
for Debian testing):

--- debian/control.orig 2019-02-09 11:47:43.335228481 +0100
+++ debian/control  2019-02-09 11:47:55.223124936 +0100
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Kees Leune 
 Standards-Version: 3.9.8
-Build-Depends: libcurl3-gnutls-dev, dh-autoreconf, debhelper (>= 9)
+Build-Depends: libcurl4-openssl-dev, dh-autoreconf, debhelper (>= 9)

 Package: metar
 Architecture: any


Regards,

Sven


*** End of the template - remove these template lines ***


-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (650, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.18.0-3-amd64 (SMP w/12 CPU cores)
Locale: LANG=C, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages metar depends on:
ii  libc62.28-5
ii  libcurl3-gnutls  7.63.0-1

metar recommends no packages.

metar suggests no packages.

-- debconf-show failed