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

On 12/08/2012 03:42 AM, Eli Zaretskii wrote:
> 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.

errno cannot be EINVAL, at least not on a POSIXish host:
all strings are allowed as arguments to putenv.
If Microsoft platforms are different it would
make sense to put in an eassert, in w32.c presumably.

I did see a minor problem in the w32.c implementation of unsetenv:

  /* MS docs says an environment variable cannot be longer than 32K.  */
  if (name_len > 32767)
    {
      errno = ENOMEM;
      return -1;
    }

unsetenv should return 0 in that case, not -1, since
the variable cannot possibly be in the environment.
This bug doesn't affect Emacs so it's not a pressing one.

I committed the patch as trunk bzr 111158 and am marking
this bug as fixed.





  reply	other threads:[~2012-12-08 17:20 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
2012-12-08 17:20       ` Paul Eggert [this message]
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=50C376F9.3000603@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=13070-done@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --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.