Обсуждение: BUG #6162: initdb : Windows username isn't escaped

Поиск
Список
Период
Сортировка

BUG #6162: initdb : Windows username isn't escaped

От
"Emmanuel Guyot"
Дата:
The following bug has been logged online:

Bug reference:      6162
Logged by:          Emmanuel Guyot
Email address:      emmanuel.guyot@gmail.com
PostgreSQL version: 8.2.3
Operating system:   Windows 7
Description:        initdb : Windows username isn't escaped
Details:

Initdb crashes when I use it with a windows username that has a quote inside
(e.g. : L'élixir)

Here is the error reported :
initialisation des droits sur les objets internes... 2010-05-14 17:01:25.434
FATAL: syntax error at or near "élixir" at character 44
2010-05-14 17:01:25.434 STATEMENT: UPDATE pg_class SET relacl =
E'{"=r/\\"L'élixir\\""}' WHERE relkind IN ('r', 'v', 'S') AND relacl IS
NULL;

If I force the username as an option with the escaped value L\'élixir the
initdb works fine, but I can't start the server. So I can't find a
workaround.

I've watched the newer sources of initdb and I can't see any change for this
bug.

Re: BUG #6162: initdb : Windows username isn't escaped

От
Bruce Momjian
Дата:
On Sun, Aug 14, 2011 at 11:25:22AM +0000, Emmanuel Guyot wrote:
>
> The following bug has been logged online:
>
> Bug reference:      6162
> Logged by:          Emmanuel Guyot
> Email address:      emmanuel.guyot@gmail.com
> PostgreSQL version: 8.2.3
> Operating system:   Windows 7
> Description:        initdb : Windows username isn't escaped
> Details:
>
> Initdb crashes when I use it with a windows username that has a quote inside
> (e.g. : L'élixir)
>
> Here is the error reported :
> initialisation des droits sur les objets internes... 2010-05-14 17:01:25.434
> FATAL: syntax error at or near "élixir" at character 44
> 2010-05-14 17:01:25.434 STATEMENT: UPDATE pg_class SET relacl =
> E'{"=r/\\"L'élixir\\""}' WHERE relkind IN ('r', 'v', 'S') AND relacl IS
> NULL;
>
> If I force the username as an option with the escaped value L\'élixir the
> initdb works fine, but I can't start the server. So I can't find a
> workaround.
>
> I've watched the newer sources of initdb and I can't see any change for this
> bug.

I have fixed the problem with the attached, applied patch, which will
appear in Postgres 9.3.  The problem was that single-quotes in usernames
were not properly escaped by initdb.

Also, I have improved the pg_hba.conf documentation, and added an assert
to catch future breakage.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +

Вложения