mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jean-Marc Pigeon <jmp@safe.ca>
To: musl@lists.openwall.com
Subject: Re: setenv if value=NULL, what say standard? Bug?
Date: Thu, 23 Apr 2015 09:58:28 -0400	[thread overview]
Message-ID: <5538FA84.2060807@safe.ca> (raw)
In-Reply-To: <20150423132259.GS2875@port70.net>

[-- Attachment #1: Type: text/plain, Size: 1910 bytes --]

On 04/23/2015 09:22 AM, Szabolcs Nagy wrote:
> * Jean-Marc Pigeon <jmp@safe.ca> [2015-04-23 08:58:50 -0400]:
>>> 
>>>> so the library (glibc and old libc) used for linux over the
>>>> years defined an expected behavior to this "UB".
>>> 
>>> No, that was merely a bug in glibc, not a feature.
>> 
>> Hmmm... glibc-2.21, setenv.c explicitly check the value NULL 
>> condition, so situation is checked, you could object about the
>> way program handle it, but it is not a bug (situation expected
>> and addressed).
>> 
> 
> you are wrong, glibc actually corrupted then environ on NULL 
> argument and this was fixed recently
> 
> http://sourceware.org/git/?p=glibc.git;a=commit;h=03c1e456b079929a8290aeb4aadb05c0df73bfd2
>
>  stop mixing runtime failure with ub, that leads to nonsense 
> discussions.
> 
glibc-2.12-1.132.el6_5.2.x86_64
I do not confirm env corruption, try:

#include        <stdio.h>

main()

{
#define ENVNAME "BIGRE"

(void) setenv(ENVNAME,getenv("MISSING_FROM_ENV"),1);
(void) fprintf(stdout,"1 env %s=<%s>\n",ENVNAME,getenv(ENVNAME));
(void) setenv(ENVNAME,"",1);
(void) fprintf(stdout,"2 env %s=<%s>\n",ENVNAME,getenv(ENVNAME));
(void) setenv(ENVNAME,"something",1);
(void) fprintf(stdout,"3 env %s=<%s>\n",ENVNAME,getenv(ENVNAME));
}

What I am trying to explain, you have something not
defined in spec, was resolved in a way (you may not like, I agree)
for EONs.

Now "you" decide, to resolve UB another way, you may
have tons of applications in jeopardy.



-- 

A bientôt
===========================================================
Jean-Marc Pigeon                        E-Mail: jmp@safe.ca
SAFE Inc.                             Phone: (514) 493-4280
  Clement, 'a kiss solution' to get rid of SPAM (at last)
     Clement' Home base <"http://www.clement.safe.ca">
===========================================================


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4242 bytes --]

  reply	other threads:[~2015-04-23 13:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23  0:08 Jean-Marc Pigeon
2015-04-23  0:35 ` Laurent Bercot
2015-04-23  1:26   ` Jean-Marc Pigeon
2015-04-23  2:15     ` Rich Felker
2015-04-23  4:24       ` Jean-Marc Pigeon
2015-04-23  5:08         ` Raphael Cohn
2015-04-23 12:29           ` Jean-Marc Pigeon
2015-04-23  9:23         ` Laurent Bercot
2015-04-23  9:52           ` Raphael Cohn
2015-04-23 10:47             ` Laurent Bercot
2015-04-23 10:10         ` Rich Felker
2015-04-23 12:58           ` Jean-Marc Pigeon
2015-04-23 13:22             ` Szabolcs Nagy
2015-04-23 13:58               ` Jean-Marc Pigeon [this message]
2015-04-23 14:26                 ` Szabolcs Nagy
2015-04-23  8:05       ` Jens Gustedt
2015-04-23  9:55         ` Rich Felker
2015-04-24  4:11       ` Isaac Dunham
2015-04-23  5:52   ` Isaac Dunham

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=5538FA84.2060807@safe.ca \
    --to=jmp@safe.ca \
    --cc=musl@lists.openwall.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.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).