all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 13070@debbugs.gnu.org, fabrice.popineau@gmail.com
Subject: bug#13070: Use putenv+unsetenv instead of modifying environ directly
Date: Sat, 08 Dec 2012 13:42:43 +0200	[thread overview]
Message-ID: <83zk1olqh8.fsf@gnu.org> (raw)
In-Reply-To: <50C2BBD9.8060401@cs.ucla.edu>

> Date: Fri, 07 Dec 2012 20:02:33 -0800
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: 13070@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
> 
> On 12/04/2012 05:51 AM, Fabrice Popineau wrote:
> > Provided I added some unsetenv() function for w32.
> 
> Can you just add $(BLD)/unsetenv.$(O) to GNULIBOBJS
> in lib/makefile.w32-in, or something like that?  No point in
> having two implementations of unsetenv.

I suspect the gnulib implementation won't work for Windows, for the
same reasons the original code you are replacing didn't: it messes
with the environ block, which is allocated on a heap that is different
from the heap used by Emacs.  Even if we don't use the gnulib putenv
implementation, moving pointers in the environ block that belongs to
the Windows runtime library is something I'd like to avoid if
possible.

However, I have just installed in trunk revision 111156 changes that
add to w32.c an implementation of unsetenv, and a wrapper for putenv
that makes it more Posix-compliant.  So you can now commit your
changes, and I believe they will work.

> I've attached a revised patch (sans any change to makefile.w32-in),
> relative to trunk bzr 111151.

Thanks.

> +void
> +xputenv (char const *string)
> +{
> +  if (putenv ((char *) string) != 0)
> +    memory_full (0);
> +}

Shouldn't we refrain from signaling memory_full when errno is EINVAL?
I'd suggest an eassert in that case.  memory_full will emit a
misleading diagnostic.





  reply	other threads:[~2012-12-08 11:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-03 20:32 bug#13070: Use putenv+unsetenv instead of modifying environ directly Paul Eggert
2012-12-04 13:51 ` Fabrice Popineau
2012-12-04 17:48   ` Eli Zaretskii
2012-12-08  4:02   ` Paul Eggert
2012-12-08 11:42     ` Eli Zaretskii [this message]
2012-12-08 17:20       ` Paul Eggert
2012-12-08 18:31         ` Eli Zaretskii
2012-12-08 19:58           ` Paul Eggert

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

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

  git send-email \
    --in-reply-to=83zk1olqh8.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=13070@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=fabrice.popineau@gmail.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.