Re: BUG #8532: postgres fails to start with timezone-data >=2013e

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: BUG #8532: postgres fails to start with timezone-data >=2013e
Дата
Msg-id 52652C9C.1080306@vmware.com
обсуждение исходный текст
Ответ на BUG #8532: postgres fails to start with timezone-data >=2013e  (timo.gurr@gmail.com)
Ответы Re: BUG #8532: postgres fails to start with timezone-data >=2013e  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On 16.10.2013 13:09, timo.gurr@gmail.com wrote:
> The following bug has been logged on the website:
>
> Bug reference:      8532
> Logged by:          Timo Gurr
> Email address:      timo.gurr@gmail.com
> PostgreSQL version: 9.1.10
> Operating system:   Gentoo Linux (64bit, kernel 3.11.0, glibc 2.17)
> Description:
>
>> From the timezone-data NEWS:
>
>
> Release 2013e - 2013-09-19 23:50:04 -0700
>    Changes affecting the build procedure
>      When building the 'posix' or 'right' subdirectories, if the
>      subdirectory would be a copy of the default subdirectory, it is
>      now made a symbolic link if that is supported.  This saves about
>      2 MB of file system space.
>
>
> This change breaks postgres, so then having a recent enough timezone-data
> package installed on the system postgres fails to start:
>
>
> /var/lib/postgresql/9.1/data/postmaster.log
> FATAL:  exceeded maxAllocatedDescs (16) while trying to open directory
> "/usr/share/zoneinfo"
>
>
> # ls -la /usr/share/zoneinfo/
> lrwxrwxrwx  1 root root     1 Oct 16 12:06 posix ->  .
>
>
> Gentoo has a downstream bugreport about it stating the problem should be
> fixed on the postgres side:
> https://bugs.gentoo.org/show_bug.cgi?id=486556

When you download the vanilla timezone sources and install, the
directory layout looks different:

~/tz ((2013e))$ make -s install DESTDIR=foo TZDIR=/usr/share/zoneinfo
ar: creating foo/usr/local/lib/libtz.a
mkdir: cannot create directory 'foo/usr/local': File exists
mkdir: cannot create directory 'foo/usr/local': File exists
~/tz ((2013e))$ ls -l foo/usr/share/
total 8
drwxr-xr-x 19 heikki heikki 4096 Oct 21 12:48 zoneinfo
drwxr-xr-x 19 heikki heikki 4096 Oct 21 12:48 zoneinfo-leaps
lrwxrwxrwx  1 heikki heikki    8 Oct 21 12:48 zoneinfo-posix -> zoneinfo

There is no 'posix' symlink inside 'zoneinfo'. The zoneinfo git
repository says that this layout was adopted in the upstream library a
long time ago:

> commit 77e3dfe1a7b7e14e9f252fc628a5d405c35b6444
> Author: Arthur David Olson <ado@elsie>
> Date:   Mon May 25 13:04:43 1998 -0400
>
>     Eggert mod
>
>     SCCS-file: Makefile
>     SCCS-SID: 7.66
>
> diff --git a/Makefile b/Makefile
> index a8d8067..ae414b4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -293,10 +293,19 @@ posix_only:    zic $(TDATA)
>  right_only:    zic leapseconds $(TDATA)
>          $(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L leapseconds $(TDATA)
>
> +# In earlier versions of this makefile, the other two directories were
> +# subdirectories of $(TZDIR).  However, this led to configuration errors.
> +# For example, with posix_right under the earlier scheme,
> +# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
> +# but gmtime without leap seconds, which led to problems with applications
> +# like sendmail that subtract gmtime from localtime.
> +# Therefore, the other two directories are now siblings of $(TZDIR).
> +# You must replace all of $(TZDIR) to switch from not using leap seconds
> +# to using them, or vice versa.
>  other_two:    zic leapseconds $(TDATA)
> -        $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)/posix -L /dev/null $(TDATA)
> +        $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)-posix -L /dev/null $(TDATA)
>          $(ZIC) -y $(YEARISTYPE) \
> -            -d $(TZDIR)/right -L leapseconds $(TDATA)
> +            -d $(TZDIR)-right -L leapseconds $(TDATA)
>
>  posix_right:    posix_only other_two
>

However, Gentoo seems to carry a patch that reverts that commit:


http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-libs/timezone-data/files/timezone-data-2013f-makefile.patch?revision=1.1&view=markup

That patch conflicts with the upstream Makefile change to create the
"other" directory as a symlink. With the vanilla zoneinfo sources, the
symlink is fine, but by putting 'posix' inside 'zoneinfo' directory, the
Gentoo-specific patch creates that infinite recursion situation.

Gentoo isn't alone in doing this: my Debian system has a similar layout,
with 'posix' directory inside /usr/share/zoneinfo, rather than as a
sibling. I'm not sure if Debian will have this problem, though. If I'm
reading the debian rules file correctly, they're not relying on the
upstream "make install" to create the 'posix' and 'right' directories,
but calls zic directly.

In summary, I'd call this a packaging bug.

That said, the error message you get from PostgreSQL isn't very
user-friendly. There is a check on recursion depth in the timezone
traversing code, but apparently it trips on another limit first, on the
number of directory handles that can be open at a time.

Also, I don't understand how this is preventing PostgreSQL from starting
up. AFAICS the traversal of the timezones is only done when you query
the pg_timezone_names system view. Not at startup.

- Heikki

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tomonari Katsumata
Дата:
Сообщение: Re: BUG #8542: Materialized View with another column_name does not work?
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: random() generates collisions too early