[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
POSIX gettext() and chdir()
From: |
Bruno Haible |
Subject: |
POSIX gettext() and chdir() |
Date: |
Tue, 04 May 2021 01:31:01 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-206-generic; KDE/5.18.0; x86_64; ; ) |
https://posix.rhansen.org/p/gettext_split
says (line 273):
"The bindtextdomain() function shall not perform pathname resolution
on dirname (that is done by the gettext family of functions)."
This is indeed how GNU gettext and GNU libc behave. However, this is
not optimal:
1) If the dirname is not absolute, the application cannot use chdir()
at various points and still expect gettext() to work.
2) Storing a dirname over a long time and using it only later during
the gettext() call opens the door to file system races.
A more modern approach would be to
* have bindtextdomain() open() the given directory and store the
resulting file descriptor,
* have gettext() use openat() instead of open() for locating and opening
the message catalogs.
Such changes have not been implemented in GNU gettext and glibc so far.
But it would be good to not preclude such an improved implementation.
Suggested wording:
"It is unspecified whether the bindtextdomain() function performs
pathname resolution on dirname, or whether that is done by the
gettext family of functions."
Bruno
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- POSIX gettext() and chdir(),
Bruno Haible <=