From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp41.i.mail.ru (smtp41.i.mail.ru [94.100.177.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 8B374469719 for ; Thu, 20 Feb 2020 01:44:35 +0300 (MSK) References: <20200219214245.GD40100@tarantool.org> From: Vladislav Shpilevoy Message-ID: <51dab8b1-f1e2-c025-2277-2d517b2f4de3@tarantool.org> Date: Wed, 19 Feb 2020 23:44:32 +0100 MIME-Version: 1.0 In-Reply-To: <20200219214245.GD40100@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 1/1] app: os.setenv() affects os.environ() List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikita Pettik Cc: tarantool-patches@dev.tarantool.org Hi! Thanks all for the reviews! Pushed to master, 2.3, 2.2 and 1.10. Also added a changelog record to the releases draft. And here too, since I forgot to add it to the cover letter (or that rule was added after my patch, don't remember). @ChangeLog - os.environ() was not changed when os.setenv() was called (gh-4733). On 19/02/2020 22:42, Nikita Pettik wrote: > On 06 Feb 23:47, Vladislav Shpilevoy wrote: >> os.setenv() and os.environ() are Lua API for >> >> extern char **environ; >> int setenv(); >> >> The Open Group standardized access points for environment >> variables. But there is no a word about that environ never >> changes. Programs can't relay on that. For example, addition of >> a new variable may cause realloc of the whole environ array, and >> therefore change of its pointer value. That was exactly the case >> in os.environ() - it was using value of environ array remembered >> when Tarantool started. >> >> And os.setenv() could realloc the array and turn the saved pointer >> into garbage. >> >> Closes #4733 >> --- > > LGTM >