Re: gettext clobbers errno (was: Re: Fwd: Re: error.c: "Unknown system error" should report errno value)

2007-10-14 Thread Bruno Haible
Martin Koeppe wrote:
> Thanks. Unfortunately, this
> http://lists.gnu.org/archive/html/bug-gnu-gettext/
> is not a valid URL (404). And I looked on
> http://lists.gnu.org/archive/html/
> for "gettext" or "intl" and couldn't find either.

The bug-gnu-gettext archives are at
  http://lists.gnu.org/archive/html/bug-gnu-utils/

Bruno



___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: gettext clobbers errno (was: Re: Fwd: Re: error.c: "Unknown system error" should report errno value)

2007-10-14 Thread Martin Koeppe


Hi Bruno,

On Sun, 14 Oct 2007, Bruno Haible wrote:


Martin Koeppe wrote:

I just found the bug in gettext causing this trouble. Unfortunately I
didn't find a gettext mailing list.


For most GNU programs, you find the bug reporting address at the end of
the " --help" output. "gettext --help" is in this category.


Thanks. Unfortunately, this
http://lists.gnu.org/archive/html/bug-gnu-gettext/
is not a valid URL (404). And I looked on
http://lists.gnu.org/archive/html/
for "gettext" or "intl" and couldn't find either.



Gettext is 0.16.1, file dcigettext.c, function libintl_dcigettext()



Apparently, on interix tfind() on line 584 changes errno, before it
is saved in line 587. So the patch below should be applied.


Thank you for this analysis! I'm applying this patch.

--- 595,605 
retval = (char *) (*foundp)->translation;

   gl_rwlock_unlock (_nl_state_lock);
+   errno = saved_errno;


Thanks for adding this. For consistency with the rest of the file it 
should be written as:

   __set_errno (saved_errno);


Martin


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


gettext clobbers errno (was: Re: Fwd: Re: error.c: "Unknown system error" should report errno value)

2007-10-14 Thread Bruno Haible
Martin Koeppe wrote:
> I just found the bug in gettext causing this trouble. Unfortunately I 
> didn't find a gettext mailing list.

For most GNU programs, you find the bug reporting address at the end of
the " --help" output. "gettext --help" is in this category.

> Gettext is 0.16.1, file dcigettext.c, function libintl_dcigettext()
> 
> (gdb) display errno
> 1: {} 4321340 = 13
> (gdb) s
> 582   gl_rwlock_rdlock (tree_lock);
> 1: {} 4321340 = 13
> (gdb) s
> 584   foundp = (struct known_translation_t **) tfind (search, 
> &root, transcmp);
> 1: {} 4321340 = 13
> (gdb) frame
> #0  libintl_dcigettext (domainname=0x894d28 "coreutils", 
> msgid1=0x41b78a "`",
>  msgid2=0x0, plural=0, n=0, category=6) at ./dcigettext.c:584
> 584   foundp = (struct known_translation_t **) tfind (search, 
> &root, transcmp);
> (gdb) print errno
> $1 = 13
> (gdb) s
> 586   gl_rwlock_unlock (tree_lock);
> 1: {} 4321340 = 2
> (gdb) print errno
> $1 = 2
> (gdb) q
> 
> Apparently, on interix tfind() on line 584 changes errno, before it 
> is saved in line 587. So the patch below should be applied.

Thank you for this analysis! I'm applying this patch.


2007-10-14  Bruno Haible  <[EMAIL PROTECTED]>

* dcigettext.c (DCIGETTEXT): Save errno also around the tfind() call.
Needed because Interix 3.5 tfind() clobbers errno.
Reported by Martin Koeppe <[EMAIL PROTECTED]>.

*** dcigettext.c14 Oct 2007 15:58:47 -  1.35
--- dcigettext.c14 Oct 2007 16:02:09 -
***
*** 522,527 
--- 522,530 
: n == 1 ? (char *) msgid1 : (char *) msgid2);
  #endif
  
+   /* Preserve the `errno' value.  */
+   saved_errno = errno;
+ 
gl_rwlock_rdlock (_nl_state_lock);
  
/* If DOMAINNAME is NULL, we are interested in the default domain.  If
***
*** 592,604 
retval = (char *) (*foundp)->translation;
  
gl_rwlock_unlock (_nl_state_lock);
return retval;
  }
  #endif
  
-   /* Preserve the `errno' value.  */
-   saved_errno = errno;
- 
/* See whether this is a SUID binary or not.  */
DETERMINE_SECURE;
  
--- 595,605 
retval = (char *) (*foundp)->translation;
  
gl_rwlock_unlock (_nl_state_lock);
+   errno = saved_errno;
return retval;
  }
  #endif
  
/* See whether this is a SUID binary or not.  */
DETERMINE_SECURE;
  



___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils