irrdnet / irrd-legacy

the Internet Routing Registry daemon
http://irrd.net/
Other
36 stars 26 forks source link

Fix Db download when wget honors LC_MESSAGES not set to C #39

Closed lytboris closed 6 years ago

lytboris commented 7 years ago

…using different quote symbols.

job commented 6 years ago

can you help me understand this one better?

lytboris commented 6 years ago

script parses wget's output: if ($outm !~ /${locfile}\'\s+saved/) { if LC_ALL is set to ru_RU.UTF-8 for instance, single quote will be replaced by unicode character « or ̏ depending on configuration. More, "saved" will be written in russian:

LC_ALL=ru_RU.UTF-8 wget ftp://ftp.ripe.net/ripe/dbase/RIPE.CURRENTSERIAL --2018-02-23 19:27:32-- ftp://ftp.ripe.net/ripe/dbase/RIPE.CURRENTSERIAL => «RIPE.CURRENTSERIAL.1» Распознаётся ftp.ripe.net (ftp.ripe.net)… 193.0.6.140, 2001:67c:2e8:22::c100:68c Подключение к ftp.ripe.net (ftp.ripe.net)|193.0.6.140|:21... соединение установлено. Выполняется вход под именем anonymous … Выполнен вход в систему! ==> SYST ... готово. ==> PWD ... готово. ==> TYPE I ... готово. ==> CWD (1) /ripe/dbase ... готово. ==> SIZE RIPE.CURRENTSERIAL ... 8 ==> PASV ... готово. ==> RETR RIPE.CURRENTSERIAL ... готово. Размер (байт): 8 (не достоверно)

RIPE.CURRENTSERIAL.1 100%[===================================================================>] 8 --.-KB/s за 0s

2018-02-23 19:27:33 (1,62 MB/s) - «RIPE.CURRENTSERIAL.1» сохранён [8]

Strictly speaking, parsing wget's output is a bad thing and better to deal with exit codes. But setting LC_CTYPE was the quickest path. :)

lytboris commented 6 years ago

Anyway, I've pushed a better solution for that - now irrdcacher checks exit status of wget and wget stores it's logs in a separate files keeping stdout/err clean.

job commented 6 years ago

oh yuck - parsing wget output...