git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: David Michael <fedora.dm0@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [BUG/PATCH] setup: Copy an environment variable to avoid overwrites
Date: Fri, 4 Jan 2013 21:15:55 -0500	[thread overview]
Message-ID: <CAEvUa7mbs7rfGdfzbGb9p889K7GUbXFg9TUcFWFYKt8+8AKCiQ@mail.gmail.com> (raw)
In-Reply-To: <7vsj6gqvhc.fsf@alter.siamese.dyndns.org>

Hi,

On Fri, Jan 4, 2013 at 8:17 PM, Junio C Hamano <gitster@pobox.com> wrote:
> In fact,
>
>     http://pubs.opengroup.org/onlinepubs/9699919799/functions/getenv.html
>
> says that only setenv(), unsetenv() and putenv() may invalidate
> previous return values.  Note that getenv() is not listed as a
> function that is allowed to break return values from a previous call
> to getenv().

Before I sent the e-mail, I checked that very page to be sure I wasn't
entirely insane.  Specifically, the second paragraph begins with:

> The string pointed to may be overwritten by a subsequent call to getenv(), [...]

I read that line as confirmation that this is indeed acceptably
standard behavior.  Even the getenv man page on my Fedora workstation
says:

> The string pointed to by the return value of getenv() may be statically allocated, and can be modified by a subsequent call to getenv(), putenv(3), setenv(3), or unsetenv(3).

Am I misinterpreting these statements?

Thanks.

David

  reply	other threads:[~2013-01-05  2:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-05  0:35 [BUG/PATCH] setup: Copy an environment variable to avoid overwrites David Michael
2013-01-05  1:17 ` Junio C Hamano
2013-01-05  2:15   ` David Michael [this message]
2013-01-05  4:32   ` Junio C Hamano
2013-01-05  2:45 ` Duy Nguyen
2013-01-05  4:38   ` Junio C Hamano
2013-01-05  6:24     ` Duy Nguyen
2013-01-05  6:47       ` Junio C Hamano
2013-01-05  8:55 ` [PATCH] Add getenv.so for catching invalid getenv() use via LD_PRELOAD Nguyễn Thái Ngọc Duy
2013-01-05 10:39   ` Matt Kraai
2013-01-05 11:37     ` Duy Nguyen
2013-01-05 22:53   ` Jonathan Nieder
2013-01-07 15:45   ` David Michael
2013-01-07 15:28 ` [BUG/PATCH] setup: Copy an environment variable to avoid overwrites Erik Faye-Lund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEvUa7mbs7rfGdfzbGb9p889K7GUbXFg9TUcFWFYKt8+8AKCiQ@mail.gmail.com \
    --to=fedora.dm0@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).