unofficial mirror of bug-gnu-emacs@gnu.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 20:31:18 +0200	[thread overview]
Message-ID: <83vccccs5l.fsf@gnu.org> (raw)
In-Reply-To: <50C376F9.3000603@cs.ucla.edu>

> Date: Sat, 08 Dec 2012 09:20:57 -0800
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: fabrice.popineau@gmail.com, 13070-done@debbugs.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.

What about NULL pointers?  Or strings without a '='?  IMO, it's silly
to rely on unspecified behavior, but suit yourself.

> 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.

Right, I fixed that.





  reply	other threads:[~2012-12-08 18:31 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
2012-12-08 18:31         ` Eli Zaretskii [this message]
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83vccccs5l.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).