chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH] Replace unsafe string functions with their


From: Mario Domenech Goulart
Subject: Re: [Chicken-hackers] [PATCH] Replace unsafe string functions with their safer counterparts
Date: Fri, 07 Feb 2014 00:52:50 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Hi Peter,

On Thu, 6 Feb 2014 10:04:08 +0100 Peter Bex <address@hidden> wrote:

> On Thu, Feb 06, 2014 at 02:21:07AM +0000, Mario Domenech Goulart wrote:
>> On Wed, 05 Feb 2014 23:56:11 +0000 Mario Domenech Goulart <address@hidden> 
>> wrote:
>> > The environment variable tests in posix-tests.scm caught the issue.
>> > Here's an example:
>> >
>> >   #;1> (use posix)
>> >   ; loading c:/local/chicken-master-mingw/lib/chicken/7/posix.import.so
>> >   ; ...
>> >   ; loading library posix ...
>> >   #;2> (setenv "FOO" "bar")
>> >   #;3> (get-environment-variable "FOO")
>> >   "x\x01=b\x03"
>> >
>> > Reverting 8efbbc50d050d28c34ea0c5a58d0de92ec9f918a makes tests pass
>> > again.  Tested on cygwin, mingw (Windows XP 32bit).
>> 
>> I forgot to mention that on cygwin I had to define HAVE_STRLCAT and
>> HAVE_STRLCPY in Makefile.cygwin, otherwise I'd get errors like
>> http://paste.call-cc.org/paste?id=87b50bb84351693193183e7c58f2293b6cd52148
>> 
>> After defining HAVE_STRLCAT and STRLCPY and rebuilding chicken, I get
>> the environment variables issue.
>
> I've added that.  Here's a patch that should fix the setenv issue.
> I haven't tested it yet, so please give it a try.
>
> The second patch should prevent these collision problems if for some
> reason a library happens to define strlcat() even if HAVE_STRLCAT is
> not defined.  This can not only happen if HAVE_STRLCAT is erroneously
> omitted on platforms that simply have it, but also on Linux for example,
> when using libbsd and including bsd/string.h

I quickly tested your patches.

0001-Prevent-problems-when-the-host... breaks Linux and mingw-msys
("undefined reference to strlcat").  Doesn't seem to cause problems on
cygwin.

0002-Fix-strlcat-usage-in-setenv... doesn't fix the setenv issue (tested
on Windows XP, cygwin).

Best wishes.
Mario
-- 
http://parenteses.org/mario



reply via email to

[Prev in Thread] Current Thread [Next in Thread]