From: Neil Jerram <neil@ossau.uklinux.net>
Subject: ["Nelson H. F. Beebe" <beebe@math.utah.edu>] Re: guile-1.5.6: some build comments: putenv() problems
Date: 01 Apr 2002 19:35:13 +0100 [thread overview]
Message-ID: <m3u1qvuv1a.fsf@laruns.ossau.uklinux.net> (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
reply other threads:[~2002-04-01 18:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3u1qvuv1a.fsf@laruns.ossau.uklinux.net \
--to=neil@ossau.uklinux.net \
/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.
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).