monitoring-plugins / monitoring-plugins

Monitoring Plugins
https://www.monitoring-plugins.org
GNU General Public License v3.0
482 stars 283 forks source link

Wrong character encoding with German language in help pages #1994

Open ngoeddel-openi opened 8 months ago

ngoeddel-openi commented 8 months ago

I just cloned this repository and installed it in my user directory:

./tools/setup
./configure --prefix=/home/nicolas/bin/monitoring-plugins
make
make install

If I now run /home/nicolas/bin/monitoring-plugins/libexec/check_http --help it looks like so:

check_http v2.3.5.107.g0488 (monitoring-plugins 2.3git)
<...>
Notizen:
 Diese Erweiterung wird versuchen, eine HTTP-Verbindung zum Rechner zu öffnen.
 Erfolgreiche Verbindungen geben STATE_OK zurück, Zurückweisungen oder Zeitüberschreitungen STATE_CRITICAL
 other errors return STATE_UNKNOWN.  Successful connects, but incorrect response
 Nachrichten vom Rechner resultieren in STATE_WARNING-Rückgabewerten. Wenn Sie
 einen virtuellen Server prüfen, der »host headers« verwendet, müssen Sie den FQDN
 (voll qualifizierten Domain-Namen) als [host_name]-Argument liefern.
<...>

Especially in the long description texts you can see that a lot of characters a wrong. It looks like it encodes it with latin1 or ISO-8859-1 instead of utf-8.

Either there is anything I missed during compilation or this is a bug.

Additional information: In my environment there is only LANG=de_DE.UTF-8 set.

RincewindsHat commented 8 months ago

This is arguably a bug since we removed most of the gettext (translation) stuff some time ago due to the heavy maintenance load. So it should not translate at all.

RincewindsHat commented 8 months ago

Amusingly the string you see there is not even in the repo, it is auto translated it seems to me.

ngoeddel-openi commented 8 months ago

It auto-translates? I didn't know such stuff is possible, haha. For me it would be fine if everything is just plain English instead of seeing wrong character encodings.

RincewindsHat commented 8 months ago

surprises me too :-)

RincewindsHat commented 8 months ago

I really don't know where the text comes from :-) There I am not really sure what do to about it.

RincewindsHat commented 7 months ago

@ngoeddel-openi Did you, by any chance, find out how this works? And how we could possible improve the situation?

ngoeddel-openi commented 7 months ago

@ngoeddel-openi Did you, by any chance, find out how this works? And how we could possible improve the situation?

Sorry, I did not look further into this.

cschug commented 6 months ago

Translations where removed, see #1947. As virtually any output by plugins nevertheless still gets processed by gettext's _(...) function, most likely the German translations you see are still found somewhere on your system from an older installation.

In your case I would try to run

$ strace /home/nicolas/bin/monitoring-plugins/libexec/check_http --help 2>&1 | grep locale

to narrow down the list of potential candidates.

ngoeddel-openi commented 6 months ago

This is what I get:

$ strace /home/nicolas/bin/monitoring-plugins/libexec/check_http --help 2>&1 | grep locale
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/nicolas/bin/monitoring-plugins/share/locale/de_DE.UTF-8/LC_MESSAGES/monitoring-plugins.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/home/nicolas/bin/monitoring-plugins/share/locale/de_DE.utf8/LC_MESSAGES/monitoring-plugins.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/home/nicolas/bin/monitoring-plugins/share/locale/de_DE/LC_MESSAGES/monitoring-plugins.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/home/nicolas/bin/monitoring-plugins/share/locale/de.UTF-8/LC_MESSAGES/monitoring-plugins.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/home/nicolas/bin/monitoring-plugins/share/locale/de.utf8/LC_MESSAGES/monitoring-plugins.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/home/nicolas/bin/monitoring-plugins/share/locale/de/LC_MESSAGES/monitoring-plugins.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/share/locale-langpack/de_DE.UTF-8/LC_MESSAGES/monitoring-plugins.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/share/locale-langpack/de_DE.utf8/LC_MESSAGES/monitoring-plugins.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/share/locale-langpack/de_DE/LC_MESSAGES/monitoring-plugins.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/share/locale-langpack/de.UTF-8/LC_MESSAGES/monitoring-plugins.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/share/locale-langpack/de.utf8/LC_MESSAGES/monitoring-plugins.mo", O_RDONLY) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/share/locale-langpack/de/LC_MESSAGES/monitoring-plugins.mo", O_RDONLY) = 3

So there are 3 files here:

I was mostly interested in the last one and a quick apt-file search reveals:

language-pack-de-base: /usr/share/locale-langpack/de/LC_MESSAGES/monitoring-plugins.mo

I don't think I want to remove that package. :thinking: