Re: getline.h

2007-08-22 Thread Simon Josefsson
Eric Blake <[EMAIL PROTECTED]> writes:

> According to Jim Meyering on 8/19/2007 2:18 PM:
>> Eric Blake <[EMAIL PROTECTED]> wrote:
>>> I could go either way, although I'm leaning toward doing it now;
>> 
>> I agree.  Doing it now is fine.
>
> How about this for the patch, then?  Simon, this is your module.  The
> patch includes a couple of bug fixes in getdelim.c:

Looks fine to me, please install.  Thanks for writing a self-test!

/Simon




Re: getline.h

2007-08-22 Thread Jim Meyering
Eric Blake <[EMAIL PROTECTED]> wrote:
> 2007-08-21  Eric Blake  <[EMAIL PROTECTED]>
>
>   Move getline and getdelim into stdio.h, per POSIX 200x.
...

Thanks for doing that.
I've adjusted coreutils accordingly:

  http://git.sv.gnu.org/gitweb/?p=coreutils.git




Re: case-insensitive hash of strings

2007-08-22 Thread Jim Meyering
Eric Blake <[EMAIL PROTECTED]> wrote:
> A couple of questions.  First, in hash-pjw.c, should we be using unsigned
> char instead of char to iterate through the NUL-terminated string?

I'd rather not change it, unless there's a problem.
Have you found inputs for which it doesn't work well?




Re: getline.h

2007-08-22 Thread Bruno Haible
Hi Eric,

Thanks for working on this, and for the unit tests. The patch - excluding
the one of getdelim.c - is nearly perfect. But I see three problems:

1) You define the shell variable HAVE_DECL_GETDELIM depending whether the
   function exists, not whether the function is declared. But for example
   BeOS has the function but not the declaration. In this case we want
   stdio.h to provide the declaration, but there is no need for the
   function.

> --- m4/getdelim.m422 Aug 2006 17:15:28 -  1.2
> +++ m4/getdelim.m422 Aug 2007 00:04:01 -
> @@ -19,6 +20,7 @@ AC_DEFUN([gl_FUNC_GETDELIM],
>  
>if test $ac_cv_func_getdelim = no; then
>  gl_PREREQ_GETDELIM
> +HAVE_DECL_GETDELIM=0
>fi
>  ])
 
How about setting HAVE_DECL_GETDELIM depending on $ac_cv_have_decl_getdelim ?

2) Likewise for getline.

> --- m4/getline.m4 22 Aug 2006 17:15:28 -  1.18
> +++ m4/getline.m4 22 Aug 2007 00:04:01 -
> @@ -60,12 +62,12 @@ AC_DEFUN([gl_FUNC_GETLINE],
>  )])
>fi
>  
> +  if test $ac_cv_func_getline = no; then
> +HAVE_DECL_GETLINE=0
> +  fi
> +
>if test $am_cv_func_working_getline = no; then

3) This fails to provide a declaration for the rpl_getline function
if @REPLACE_GETLINE@ && @HAVE_DECL_GETLINE@ (e.g. on all those systems
which have a getline function which does not work: Cygwin, IRIX).

> +#if @GNULIB_GETLINE@
> +# if @REPLACE_GETLINE@
> +#  undef getline
> +#  define getline rpl_getline
> +# endif
> +# if [EMAIL PROTECTED]@
> +  ...
> +  extern ssize_t getline (char **, size_t *, FILE *);

The last #if should be:
   # if @REPLACE_GETLINE@ || [EMAIL PROTECTED]@

(as for example for the snprintf function).

4) Would you mind adding documentation files doc/function/get{line,delim}.texi
(since POSIX is being extended)? Otherwise I can do it.

Bruno





Multiply exported Gnulib symbols

2007-08-22 Thread Ludovic Courtès
Hi,

The following issue was brought up recently on the Guile list [0].

Suppose some library uses, e.g., the `strcasecmp' module, which exports
`strcasecmp ()' (assuming the module is actually compiled).  Suppose,
for instance, that an application using said library is also linked
against `strcasecmp'.  Then we may have troubles (depending on how the
application is linked to the library, depending on the OS, depending on
the dynamic linker's options, etc.).

Did you consider such situations already?  Any magic recipes to void
them?  :-)

Thanks,
Ludovic.

[0] http://article.gmane.org/gmane.lisp.guile.devel/6715





Re: getline() behaviour change

2007-08-22 Thread Bruno Haible
Hi Eric,

> The patch includes a couple of bug fixes in getdelim.c:
> 
> It is valid on entrance for *lineptr to be non-NULL but *n to be 0 (ie.
> via malloc(0)), but your implementation was leaking that memory.  Also,
> your implementation failed to set errno to EOVERFLOW when it detects that
> it needs to malloc more than SSIZE_MAX bytes.

> --- lib/getdelim.c29 Oct 2006 21:52:55 -  1.7
> +++ lib/getdelim.c22 Aug 2007 00:04:01 -
> @@ -62,10 +67,10 @@ getdelim (char **lineptr, size_t *n, int
>  
>flockfile (fp);
>  
> -  if (*lineptr == NULL || *n == 0)
> +  if (*n == 0)

This is a behaviour change: Previously when *lineptr == NULL, *n did not
need to be initialized. Now it needs to be initialized to 0. Should be
mentioned in NEWS.

>  {
>*n = 120;
> -  *lineptr = (char *) malloc (*n);
> +  *lineptr = (char *) realloc (*lineptr, 120);
>if (*lineptr == NULL)
>   {
> result = -1;

It's more maintainable to write *n instead of 120. Compilers optimize this
memory access anyway.

> @@ -97,6 +102,7 @@ getdelim (char **lineptr, size_t *n, int
> if (cur_len + 1 >= needed)
>   {
> result = -1;
> +   errno = EOVERFLOW;
> goto unlock_return;
>   }
 
The POSIX spec implies that errno should be set when getdelim fails. Therefore
errno needs to be set not only here, with EOVERFLOW. In lines 77 and 113
errno should be set to ENOMEM, since errno is undefined upon return from
malloc() or realloc().

Bruno





Updated user list

2007-08-22 Thread Ludovic Courtès
Hi,

The attached patch adds Guile (1.9.x) to the user list.

Thanks,
Ludovic.

diff --git a/ChangeLog b/ChangeLog
index d780a41..54fa517 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-08-22  Ludovic Courtès  <[EMAIL PROTECTED]>
+
+	* users.txt: Added Guile.
+
 2007-08-22  Eric Blake  <[EMAIL PROTECTED]>
 
 	* tests/test-getdelim.c (main): Use remove, not unlink.
diff --git a/tests/test-canonicalize.sh b/tests/test-canonicalize.sh
old mode 100644
new mode 100755
diff --git a/users.txt b/users.txt
index fa47d01..5802362 100644
--- a/users.txt
+++ b/users.txt
@@ -14,6 +14,7 @@ The following packages appear to be using gnulib and gnulib-tool:
   gpg http://cvs.gnupg.org/cgi-bin/viewcvs.cgi/trunk/
   gsasl   http://josefsson.org/cgi-bin/viewcvs.cgi/gsasl/
   gss http://josefsson.org/cgi-bin/viewcvs.cgi/gss/
+  guile   http://cvs.sv.gnu.org/viewvc/guile/guile/guile-core/
   gziphttp://cvs.sv.gnu.org/viewcvs/gzip/gzip/
   hello   http://cvs.sv.gnu.org/viewcvs/hello/hello/
   icoutilshttp://riva.ucam.org/svn/cjwatson/src/debian/icoutils/trunk/icoutils/
@@ -54,7 +55,7 @@ Articles:
 
 -
 
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2006, 2007 Free Software Foundation, Inc.
 
 This file is free documentation; the Free Software Foundation
 gives unlimited permission to copy and/or distribute it,


Re: getline() behaviour change

2007-08-22 Thread Jim Meyering
Hi Bruno,

Thanks for all the reviews.
I haven't had time to look at the rest, but the following stood out:

Bruno Haible <[EMAIL PROTECTED]> wrote:
> The POSIX spec implies that errno should be set when getdelim fails. Therefore
> errno needs to be set not only here, with EOVERFLOW. In lines 77 and 113
> errno should be set to ENOMEM, since errno is undefined upon return from
> malloc() or realloc().

Are you advocating support for non-POSIX malloc/realloc?
A *lot* of code expects malloc and realloc to set errno when they fail.

POSIX guarantees that errno is defined when malloc or realloc
fails, so there's no need to set it manually in that case.
Here are the two blocks of code you mention:

  *lineptr = (char *) realloc (*lineptr, 120);
  if (*lineptr == NULL)
{
  result = -1;
  goto unlock_return;
}
...
  new_lineptr = (char *) realloc (*lineptr, needed);
  if (new_lineptr == NULL)
{
  result = -1;
  goto unlock_return;
}

in each case, realloc fails, so errno is defined.

However, there is a related problem.
Here's the target of those "goto" statements:

 unlock_return:
  funlockfile (fp);
  return result;
}

Upon failure, on a system with the funlockfile function,
the errno value from a failed realloc may be clobbered
by that funlockfile call.  So when HAVE_FUNLOCKFILE != 0,
it should save and restore errno around that funlockfile call.




Re: Updated user list

2007-08-22 Thread Bruno Haible
Ludovic Courtès wrote:
> The attached patch adds Guile (1.9.x) to the user list.

Thanks, applied.

You're welcome!

Bruno





Re: Multiply exported Gnulib symbols

2007-08-22 Thread Bruno Haible
Ludovic Courtès wrote:
> Suppose some library uses, e.g., the `strcasecmp' module, which exports
> `strcasecmp ()' (assuming the module is actually compiled).  Suppose,
> for instance, that an application using said library is also linked
> against `strcasecmp'.  Then we may have troubles (depending on how the
> application is linked to the library, depending on the OS, depending on
> the dynamic linker's options, etc.).

Three possible issues are known:

1) guile defining (via gnulib) a symbol called 'strcasecmp', which overrides
   the libc's strcasecmp symbol for libraries that come after libguile in the
   executable's link list or are dynamically loaded.

   We work around such problems by doing the override at the preprocessor
   level, rather than at the link level. I.e. on a system where strcasecmp
   is or may be defined at libc level, gnulib does
 #define strcasecmp rpl_strcasecmp
   and defines rpl_strcasecmp.

2) guile using gnulib's strcasecmp function, and other libraries using the
   libc's function, and some code expecting the two to return identical
   results.

   For this we don't have a workaround. If code assumes that libguile works
   a certain way, please make sure that you have a clear specification of
   what's expected.

3) Two different libraries, say, libguile and libgettextpo, using auxiliary
   functions from gnulib. It may happen that libguile and libgettextpo both
   define rpl_strcasecmp, and that this leads to link-time issues.

   For this we have nothing prepackaged in gnulib-tool, but there is a
   Makefile snippet that does the necessary #defines, i.e.
  #define rpl_strcasecmp scm_strcasecmp
   in guile's config.h, and
  #define rpl_strcasecmp libgettextpo_strcasecmp
   in libgettextpo's config.h. You find this code in the 'config.h' rule in
   
http://cvs.savannah.gnu.org/viewvc/gettext/gettext-tools/libgettextpo/Makefile.am?revision=1.13&root=gettext&view=text

Bruno





Re: getline() behaviour change

2007-08-22 Thread Bruno Haible
Jim Meyering wrote:
> Are you advocating support for non-POSIX malloc/realloc?

Sure. gnulib supports - to a large extent - mingw. It uses a malloc
implementation from msvcrt.dll. This malloc does not set errno.

> A *lot* of code expects malloc and realloc to set errno when they fail.

Such code is not portable to plain ISO C 99 systems.

A lot of code also expects malloc and realloc (and other library calls)
to leave errno untouched when they succeed [1]. This is also wrong, even
on POSIX systems.

> Here are the two blocks of code you mention:
> 
>   *lineptr = (char *) realloc (*lineptr, 120);
>   if (*lineptr == NULL)
>   {
> result = -1;
> goto unlock_return;
>   }
> ...
> new_lineptr = (char *) realloc (*lineptr, needed);
> if (new_lineptr == NULL)
>   {
> result = -1;
> goto unlock_return;
>   }
> 
> in each case, realloc fails, so errno is defined.

Errno is not defined in this case, on mingw.

>  unlock_return:
>   funlockfile (fp);
>   return result;
> }
> 
> Upon failure, on a system with the funlockfile function,
> the errno value from a failed realloc may be clobbered
> by that funlockfile call.

Yes. Well spotted!

Bruno


[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7312





Re: getline() behaviour change

2007-08-22 Thread Ben Pfaff
Bruno Haible <[EMAIL PROTECTED]> writes:

> Jim Meyering wrote:
>> A *lot* of code expects malloc and realloc to set errno when they fail.
>
> Such code is not portable to plain ISO C 99 systems.

We could extend gnulib's existing malloc/realloc wrappers to
ensure that malloc/realloc set errno when they fail, if it is
worthwhile to do so.
-- 
Ben Pfaff 
http://benpfaff.org





Re: getline.h

2007-08-22 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Bruno Haible on 8/22/2007 3:02 PM:
> Hi Eric,
> 
> Thanks for working on this, and for the unit tests. The patch - excluding
> the one of getdelim.c - is nearly perfect. But I see three problems:

Thanks for catching the nits.  Please feel free to apply patches if you
come up with them before me.

> 
> 3) This fails to provide a declaration for the rpl_getline function
> if @REPLACE_GETLINE@ && @HAVE_DECL_GETLINE@ (e.g. on all those systems
> which have a getline function which does not work: Cygwin, IRIX).

Actually, cygwin's getline works, as of 1.5.19 (now at 1.5.24); it passed
the test-readline.c requirements just fine.  Unless you have a countercase
where it does not work, in which case we need to beef up the test.

- --
Don't work too hard, make some time for fun as well!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGzM8p84KuGfSFAYARAiuOAJ90hLNFcPQLjAi9zNAQqciuutpsgQCfcroX
+VpLlnU+5OrV3iygzi3hg1c=
=mMr9
-END PGP SIGNATURE-




Re: getline() behaviour change

2007-08-22 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Bruno Haible on 8/22/2007 3:25 PM:
>>  
>> -  if (*lineptr == NULL || *n == 0)
>> +  if (*n == 0)
> 
> This is a behaviour change: Previously when *lineptr == NULL, *n did not
> need to be initialized. Now it needs to be initialized to 0. Should be
> mentioned in NEWS.

Hmm, I agree.  But the wording the draft 3 of POSIX 200x requires *n to be
initialized - if it is non-zero, then *lineptr must point to that many
bytes, so *n must be 0 if *lineptr is NULL when used in a manner compliant
with POSIX.  Maybe it is worth a question on the Austin group mailing list
as to whether this is intentional?  Or do we go ahead and be generous by
resetting *n to a sane value when *lineptr is NULL (ie. revert this one line)?

- --
Don't work too hard, make some time for fun as well!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGzNA784KuGfSFAYARAmQeAJ41dT8abUd991cOKHxciQIro8dCfgCgqNsv
gxWCa3449T1Cv7vIpHiVU7s=
=cqbs
-END PGP SIGNATURE-




Re: getline() behaviour change

2007-08-22 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Ben Pfaff on 8/22/2007 5:19 PM:
> Bruno Haible <[EMAIL PROTECTED]> writes:
> 
>> Jim Meyering wrote:
>>> A *lot* of code expects malloc and realloc to set errno when they fail.
>> Such code is not portable to plain ISO C 99 systems.
> 
> We could extend gnulib's existing malloc/realloc wrappers to
> ensure that malloc/realloc set errno when they fail, if it is
> worthwhile to do so.

I would somewhat like this idea - it is much nicer assuming that malloc
reliably sets errno to ENOMEM on failure than having to patch all callers
of malloc to do the same.

- --
Don't work too hard, make some time for fun as well!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGzNCA84KuGfSFAYARAt1gAJ9/wJ1wo481LMUSJMdxyPSkzOTlogCcDwUt
rh03w3E/qiRJWvYw58xfvK0=
=PWXo
-END PGP SIGNATURE-




Re: getline.h

2007-08-22 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Eric Blake on 8/22/2007 6:04 PM:
> According to Bruno Haible on 8/22/2007 3:02 PM:
>> Hi Eric,
> 
>> Thanks for working on this, and for the unit tests. The patch - excluding
>> the one of getdelim.c - is nearly perfect. But I see three problems:
> 
> Thanks for catching the nits.  Please feel free to apply patches if you
> come up with them before me.

Here's what I'm committing; I think it addresses all your points.

2007-08-22  Eric Blake  <[EMAIL PROTECTED]>

Getline touchups.
* lib/getdelim.c (getdelim): Revert regression that required *n to
be 0 when *lineptr is NULL.  Preserve errno across funlockfile.
* m4/getdelim.m4 (gl_FUNC_GETDELIM): Check for declaration of
getdelim, rather than whether implementation is missing.
* m4/getline.m4 (gl_FUNC_GETLINE): Likewise for getline.
* lib/stdio_.h (getline): Also declare if replacement is
required.
* doc/functions/getdelim.texi: New file.
* doc/functions/getline.texi: Likewise.
* doc/gnulib.texi (Function Substitutes): Add new files.
Reported by Bruno Haible.

- --
Don't work too hard, make some time for fun as well!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFGzOoD84KuGfSFAYARAl+dAJ9XrkZHtoiOQwJUpxWbqc3JTl+KowCWOSv6
wSAwvtfYANnM796ICFivDg==
=c4j1
-END PGP SIGNATURE-
Index: lib/getdelim.c
===
RCS file: /sources/gnulib/gnulib/lib/getdelim.c,v
retrieving revision 1.8
diff -u -p -r1.8 getdelim.c
--- lib/getdelim.c  22 Aug 2007 12:54:22 -  1.8
+++ lib/getdelim.c  23 Aug 2007 01:58:57 -
@@ -58,6 +58,7 @@ getdelim (char **lineptr, size_t *n, int
 {
   ssize_t result;
   size_t cur_len = 0;
+  int e; /* Preserve errno across funlockfile.  */
 
   if (lineptr == NULL || n == NULL || fp == NULL)
 {
@@ -67,13 +68,14 @@ getdelim (char **lineptr, size_t *n, int
 
   flockfile (fp);
 
-  if (*n == 0)
+  if (*lineptr == NULL || *n == 0)
 {
   *n = 120;
-  *lineptr = (char *) realloc (*lineptr, 120);
+  *lineptr = (char *) realloc (*lineptr, *n);
   if (*lineptr == NULL)
{
  result = -1;
+ e = ENOMEM;
  goto unlock_return;
}
 }
@@ -86,6 +88,7 @@ getdelim (char **lineptr, size_t *n, int
   if (i == EOF)
{
  result = -1;
+ e = errno;
  break;
}
 
@@ -102,7 +105,7 @@ getdelim (char **lineptr, size_t *n, int
  if (cur_len + 1 >= needed)
{
  result = -1;
- errno = EOVERFLOW;
+ e = EOVERFLOW;
  goto unlock_return;
}
 
@@ -110,6 +113,7 @@ getdelim (char **lineptr, size_t *n, int
  if (new_lineptr == NULL)
{
  result = -1;
+ e = ENOMEM;
  goto unlock_return;
}
 
@@ -128,5 +132,7 @@ getdelim (char **lineptr, size_t *n, int
 
  unlock_return:
   funlockfile (fp);
+  if (result == -1)
+errno = e;
   return result;
 }
Index: lib/stdio_.h
===
RCS file: /sources/gnulib/gnulib/lib/stdio_.h,v
retrieving revision 1.33
diff -u -p -r1.33 stdio_.h
--- lib/stdio_.h22 Aug 2007 12:54:22 -  1.33
+++ lib/stdio_.h23 Aug 2007 01:58:57 -
@@ -328,7 +328,7 @@ extern long rpl_ftell (FILE *fp);
 #  undef getline
 #  define getline rpl_getline
 # endif
-# if [EMAIL PROTECTED]@
+# if [EMAIL PROTECTED]@ || @REPLACE_GETLINE@
   /* Read up to (and including) a newline from FP into *LINEPTR (and
  NUL-terminate it).  *LINEPTR is a pointer returned from malloc (or
  NULL), pointing to *N characters of space.  It is realloc'ed as
Index: doc/gnulib.texi
===
RCS file: /sources/gnulib/gnulib/doc/gnulib.texi,v
retrieving revision 1.42
diff -u -p -r1.42 gnulib.texi
--- doc/gnulib.texi 15 Jul 2007 14:05:43 -  1.42
+++ doc/gnulib.texi 23 Aug 2007 01:58:57 -
@@ -929,6 +929,7 @@ by Gnulib.
 * getcontext::
 * getcwd::
 * getdate::
+* getdelim::
 * getegid::
 * getenv::
 * geteuid::
@@ -945,6 +946,7 @@ by Gnulib.
 * gethostid::
 * gethostname::
 * getitimer::
+* getline::
 * getlogin::
 * getlogin_r::
 * getmsg::
@@ -2047,6 +2049,7 @@ by Gnulib.
 @include functions/getcontext.texi
 @include functions/getcwd.texi
 @include functions/getdate.texi
[EMAIL PROTECTED] functions/getdelim.texi
 @include functions/getegid.texi
 @include functions/getenv.texi
 @include functions/geteuid.texi
@@ -2063,6 +2066,7 @@ by Gnulib.
 @include functions/gethostid.texi
 @include functions/gethostname.texi
 @include functions/getitimer.texi
[EMAIL PROTECTED] functions/getl

Re: yesno module and i18n

2007-08-22 Thread Paul Eggert
Eric Blake <[EMAIL PROTECTED]> writes:

> I agree with Paul - a POSIX conforming mv uses only yesexpr to
> decide on affirmative responses.

Yes, I'm afraid I don't see any other way to read the intent of POSIX.
The definition of "affirmative response" confirms this reading; see
.

Also, as a practical matter, it's a pain if this info resides in two
locations, as the user or installer or sysadmin has to worry about
both places.

> Cygwin's nl_langinfo is broken

Is there some way that "configure" can detect this problem reliably?
If not, then perhaps the simplest thing is to just live with the
problem on Cygwin hosts; after all, if nl_langinfo is broken then
Cygwin users must already be accustomed to applications that require
one to type 'y' or 'Y' for "yes" regardless of locale.




do not set errno after failing malloc [Re: getline() behaviour change

2007-08-22 Thread Jim Meyering
Bruno Haible <[EMAIL PROTECTED]> wrote:
> Jim Meyering wrote:
>> Are you advocating support for non-POSIX malloc/realloc?
>
> Sure. gnulib supports - to a large extent - mingw. It uses a malloc
> implementation from msvcrt.dll. This malloc does not set errno.

You're dumbing down gnulib to accommodate _mingw_?!?
Please, don't do that.

Add a wrapper, rather than polluting all application code.
This is a fundamental tenet of gnulib:
If there's some portability problem, gnulib allows all of its client
code to assume the desired behavior.  Nonconforming hosts like mingw
can endure the run-time overhead of wrappers or replacement functions.
That's far cleaner than polluting malloc-using applications with
obscure code to set errno upon malloc failure.




Re: getline() behaviour change

2007-08-22 Thread Jim Meyering
Ben Pfaff <[EMAIL PROTECTED]> wrote:

> Bruno Haible <[EMAIL PROTECTED]> writes:
>
>> Jim Meyering wrote:
>>> A *lot* of code expects malloc and realloc to set errno when they fail.
>>
>> Such code is not portable to plain ISO C 99 systems.
>
> We could extend gnulib's existing malloc/realloc wrappers to
> ensure that malloc/realloc set errno when they fail, if it is
> worthwhile to do so.

It is definitely worthwhile to do so.