Re: Fix for pg_upgrade's forcing pg_controldata into English

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Fix for pg_upgrade's forcing pg_controldata into English
Дата
Msg-id 4298.1283386127@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Fix for pg_upgrade's forcing pg_controldata into English  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: Fix for pg_upgrade's forcing pg_controldata into English  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
Bruce Momjian <bruce@momjian.us> writes:
> Tom Lane wrote:
>> I certainly hope that pg_regress isn't freeing the strings it passes
>> to putenv() ...

> pg_regress does not restore these settings (it says with C/English) so
> the code is different.

That's not what I'm on about.  You're trashing strings that are part of
the live environment.  It might accidentally fail to fail for you, if
your version of free() doesn't immediately clobber the released storage,
but it's still broken.  Read the putenv() man page.

+ #ifndef WIN32
+         char       *envstr = (char *) pg_malloc(ctx, strlen(var) +
+                             strlen(val) + 1);
+ 
+         sprintf(envstr, "%s=%s", var, val);
+         putenv(envstr);
+         pg_free(envstr);               ^^^^^^^^^^^^^^^^
+ #else
+         SetEnvironmentVariableA(var, val);
+ #endif

The fact that there is no such free() in pg_regress is not an oversight
or shortcut.
        regards, tom lane


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Fix for pg_upgrade's forcing pg_controldata into English
Следующее
От: Tom Lane
Дата:
Сообщение: Re: compiling with RELCACHE_FORCE_RELEASE doesn't pass regression