unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* ["Nelson H. F. Beebe" <beebe@math.utah.edu>] Re: guile-1.5.6: some build comments: putenv() problems
@ 2002-04-01 18:35 Neil Jerram
  0 siblings, 0 replies; only message in thread
From: Neil Jerram @ 2002-04-01 18:35 UTC (permalink / raw)



[-- Attachment #0: Type: message/rfc822, Size: 4455 bytes --]

From: "Nelson H. F. Beebe" <beebe@math.utah.edu>
To: Neil Jerram <neil@ossau.uklinux.net>
Cc: beebe@math.utah.edu
Subject: Re: guile-1.5.6: some build comments: putenv() problems
Date: Mon, 1 Apr 2002 09:19:15 -0700 (MST)
Message-ID: <CMM.0.92.0.1017677955.beebe@suncore.math.utah.edu>

>> ...
>>     Nelson>     ERROR: srfi-19.test: SRFI date/time library: #<procedure
>> time-utc->date (time . tz-offset)> respects local DST if no TZ-OFFSET given -
>> arguments: ((system-error "putenv" "~A" ("No such file or directory") (2)))
>>
>> How is putenv's return code documented on Solaris?  Looks like putenv
>> is returning <0, which Guile, perhaps wrongly, interprets as an error.
>> ...

On Solaris 2.8, "man putenv" says:

>> ...
>> RETURN VALUES
>>      The putenv() functions returns a non-zero value  if  it  was
>>      unable  to  obtain  enough  space  using   malloc(3C) for an
>>      expanded environment. Otherwise, 0 is returned.
>> ...

I wrote and ran this little test program:

	% cat putenv.c
	#include <stdio.h>
	#include <stdlib.h>

	#ifndef EXIT_SUCCESS
	#define EXIT_SUCCESS 0
	#endif

	#if !defined(MAXBIG)
	#define MAXBIG (size_t)(50 * 1024 * 1024)
	#endif

	int
	main(void)
	{
	    int ret;
	    char *big;
	    ret = putenv("foo");
	    if (ret != 0) printf("putenv(\"foo\") returns %d\n", ret);
	    ret = putenv("foobar=foobar");
	    if (ret != 0) printf("putenv(\"foobar=foobar\") returns %d\n", ret);

	    big = (char*)malloc(MAXBIG);
	    if (big != (char*)NULL)
	    {
		memset(big,'X',MAXBIG);
		memcpy(big,"x=",2);
		big[MAXBIG-1] = '\0';
		ret = putenv(big);
		if (ret != 0) printf("putenv(\"x=XXX...\") returns %d\n", ret);
	    }

	    return (EXIT_SUCCESS);
	}

	% cc -g putenv.c && ./a.out
	[no output]

Even with -DMAXBIG='500 * 1024 * 1024', it did not produce an error.
I tried it on some other systems with 500MB and 1GB strings: the a.out
file took a long time to run, but did not report an error.  Thus, it
doesn't look like a nonzero return from putenv() is likely.

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- Center for Scientific Computing       FAX: +1 801 585 1640, +1 801 581 4148 -
- University of Utah                    Internet e-mail: beebe@math.utah.edu  -
- Department of Mathematics, 110 LCB        beebe@acm.org  beebe@computer.org -
- 155 S 1400 E RM 233                       beebe@ieee.org                    -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe  -
-------------------------------------------------------------------------------



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-04-01 18:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-01 18:35 ["Nelson H. F. Beebe" <beebe@math.utah.edu>] Re: guile-1.5.6: some build comments: putenv() problems Neil Jerram

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