You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Blair Zajac <bl...@orcaware.com> on 2002/07/17 00:48:12 UTC

Re: Is --enable-utf8 working everywhere?

Ulrich Drepper wrote:
> 
> On Tue, 2002-07-16 at 10:41, Blair Zajac wrote:
> 
> > #0  0x000318c4 in apr_xlate_conv_buffer (convset=0x0, inbuf=0xffbef380
> >     "stringtest.tmp", inbytes_left=0xffbef0ac, outbuf=0x558f0 "twice as long",
> >     outbytes_left=0xffbef0a8) at xlate.c:308
> > 308         if (convset->ich != (iconv_t)-1) {
> > (gdb) bt
> > #0  0x000318c4 in apr_xlate_conv_buffer (convset=0x0, inbuf=0xffbef380
> >     "stringtest.tmp", inbytes_left=0xffbef0ac, outbuf=0x558f0 "twice as long",
> >     outbytes_left=0xffbef0a8) at xlate.c:308
> > #1  0x0002116c in convert_to_stringbuf (convset=0x0, src_data=0xffbef380
> >     "stringtest.tmp", src_length=14, dest=0xffbef134, pool=0x55708)
> >     at subversion/libsvn_subr/utf.c:164
> > #2  0x0002161c in svn_utf_cstring_from_utf8 (dest=0xffbef1b4, src=0xffbef380
> >     "stringtest.tmp", pool=0x55708) at subversion/libsvn_subr/utf.c:375
> 
> I don't have access to the sources so take this with a grain of salt.
> 
> It looks as if the function svn_utf_cstring_from_utf8 calls to get a
> iconv descriptor returns NULL as a sign that no such converstion is
> possible.  iconv_open normally signals this with (iconv_t)-1.  So this
> can be a simple mismatch.  The error might not be visible on other
> platforms because they actually do have a decent amount of converters
> available.

[cc'ing dev@apr.apache.org]

It looks like a problem with iconv_open on my Solaris 8 system where
iconv_open returns (iconv_t)-1, but errno is 0.

Here's a way to demonstrate this using Apr only.  Apply the following
patch to apr and run

% test/testmd5 626 UTF-8

Amongst the other print out, I get

iconv_open failed: returned ffffffff errno is 0

Best,
Blair

-- 
Blair Zajac <bl...@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/


Index: i18n/unix/xlate.c
===================================================================
RCS file: /home/cvspublic/apr/i18n/unix/xlate.c,v
retrieving revision 1.28
diff -u -r1.28 xlate.c
--- i18n/unix/xlate.c   15 Jul 2002 19:21:01 -0000      1.28
+++ i18n/unix/xlate.c   16 Jul 2002 22:46:53 -0000
@@ -52,6 +52,7 @@
  * <http://www.apache.org/>.
  */

+#include <stdio.h>
 #include "apr_private.h"

 #include "apr_lib.h"
@@ -269,7 +270,9 @@
     if (!found) {
         new->ich = iconv_open(topage, frompage);
         if (new->ich == (iconv_t)-1) {
-            return errno;
+const int e = errno;
+fprintf(stderr, "iconv_open failed: returned %p errno is %d\n", new->ich, e);
+            return e;
         }
         found = 1;
         check_sbcs(new);
Index: test/testmd5.c
===================================================================
RCS file: /home/cvspublic/apr/test/testmd5.c,v
retrieving revision 1.14
diff -u -r1.14 testmd5.c
--- test/testmd5.c      10 Jul 2002 06:01:13 -0000      1.14
+++ test/testmd5.c      16 Jul 2002 22:46:53 -0000
@@ -98,6 +98,7 @@
     STD_TEST_NEQ("    apr_md5_init", apr_md5_init(&context))

     if (xlate) {
+#define APR_HAS_XLATE 1
 #if APR_HAS_XLATE
         STD_TEST_NEQ("    apr_md5_set_xlate",
                      apr_md5_set_xlate(&context, xlate))

Re: Is --enable-utf8 working everywhere?

Posted by Greg Hudson <gh...@MIT.EDU>.
On Tue, 2002-07-16 at 21:14, Branko Čibej wrote:
> Strictly speaking, Ulrich's patch is better, because there's no 
> guarantee that "errno" is a simple global variable. It could be 
> translated into a function call, for all you know -- depends on the 
> platform, linc implementation, threading support, etc. etc. So making a 
> copy makes sense.

So it's a function call.  So what?  It still returns a single stable
value.

If you're worried about speed, that's ridiculous.  This is an error
case; a few cycles here or there isn't going to matter.  (And it's not
like errno is ever a slow function call, when it's a function call.)


Re: Is --enable-utf8 working everywhere?

Posted by Greg Hudson <gh...@MIT.EDU>.
On Tue, 2002-07-16 at 21:14, Branko Čibej wrote:
> Strictly speaking, Ulrich's patch is better, because there's no 
> guarantee that "errno" is a simple global variable. It could be 
> translated into a function call, for all you know -- depends on the 
> platform, linc implementation, threading support, etc. etc. So making a 
> copy makes sense.

So it's a function call.  So what?  It still returns a single stable
value.

If you're worried about speed, that's ridiculous.  This is an error
case; a few cycles here or there isn't going to matter.  (And it's not
like errno is ever a slow function call, when it's a function call.)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is --enable-utf8 working everywhere?

Posted by Branko Čibej <br...@xbc.nu>.
Blair Zajac wrote:

>Ulrich Drepper wrote:
>  
>
>>On Tue, 2002-07-16 at 15:48, Blair Zajac wrote:
>>
>>As a real patch use
>>
>>--- apr/i18n/unix/xlate.c       Tue Apr 16 15:37:07 2002
>>+++ apr/i18n/unix/xlate.c-new   Tue Jul 16 17:21:07 2002
>>@@ -255,7 +255,8 @@
>>     if (!found) {
>>         new->ich = iconv_open(topage, frompage);
>>         if (new->ich == (iconv_t)-1) {
>>-            return errno;
>>+            int e = errno;
>>+            return e ? e : EINVAL;
>>         }
>>         found = 1;
>>         check_sbcs(new);
>>    
>>
>
>Karl, can you help out here and check in a fix for this?
>
>We don't need to make a copy of errno.
>

Strictly speaking, Ulrich's patch is better, because there's no 
guarantee that "errno" is a simple global variable. It could be 
translated into a function call, for all you know -- depends on the 
platform, linc implementation, threading support, etc. etc. So making a 
copy makes sense.

>  It's not clear to me which
>error value we should pick.  Is EINVAL appropriate when the OS
>doesn't set errno when it should?  Maybe we should use something
>else that signifies we don't know what the real errno is.  The
>Solaris man pages for iconv_open() says it can return EMFILE,
>ENFILE, ENOMEM and EINVAL.
>

EINVAL is right.



-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is --enable-utf8 working everywhere

Posted by Ulrich Drepper <dr...@redhat.com>.
On Wed, 2002-07-17 at 14:37, Greg Hudson wrote:

> I'll try once more, having been seemingly ignored last time: What,
> precisely, is the problem with calling __error() twice?

Speed and much more importantly size.  On x86 the code sequence with
using a variable is 14 bytes shorter and no conditional jump is needed. 
Multiply this with all the places you have to perform "defensive
programming" and you'll end up with a large number.  The error handling
code also effects the non-error case since icache gets polluted with
unnecessary code.

I have never suggested to change every place where errno isn't used up
to this standard (even though this would be good).  But if you get a
patch which does it like that no argument like "that's not how we did it
so far" must outweigh the benefits.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

Re: Is --enable-utf8 working everywhere

Posted by Ulrich Drepper <dr...@redhat.com>.
On Wed, 2002-07-17 at 14:37, Greg Hudson wrote:

> I'll try once more, having been seemingly ignored last time: What,
> precisely, is the problem with calling __error() twice?

Speed and much more importantly size.  On x86 the code sequence with
using a variable is 14 bytes shorter and no conditional jump is needed. 
Multiply this with all the places you have to perform "defensive
programming" and you'll end up with a large number.  The error handling
code also effects the non-error case since icache gets polluted with
unnecessary code.

I have never suggested to change every place where errno isn't used up
to this standard (even though this would be good).  But if you get a
patch which does it like that no argument like "that's not how we did it
so far" must outweigh the benefits.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

Re: Is --enable-utf8 working everywhere

Posted by Greg Hudson <gh...@MIT.EDU>.
On Wed, 2002-07-17 at 17:33, Ulrich Drepper wrote:
> You will always end up with two calls to 'foo' since the compiler is not
> allowed to eliminate them.  It has no means to determine that 'foo' has
> no side effects and a constant return value.

I'll try once more, having been seemingly ignored last time: What,
precisely, is the problem with calling __error() twice?


Re: Is --enable-utf8 working everywhere

Posted by Greg Hudson <gh...@MIT.EDU>.
On Wed, 2002-07-17 at 17:33, Ulrich Drepper wrote:
> You will always end up with two calls to 'foo' since the compiler is not
> allowed to eliminate them.  It has no means to determine that 'foo' has
> no side effects and a constant return value.

I'll try once more, having been seemingly ignored last time: What,
precisely, is the problem with calling __error() twice?


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is --enable-utf8 working everywhere?

Posted by Ulrich Drepper <dr...@redhat.com>.
On Wed, 2002-07-17 at 09:35, Alan Shutko wrote:

> Could you explain what the impact of this is?  Is the concern that
> we'll have a different result between calls to the hidden function
> call, or that it's somewhat wasteful to call it multiple times, or
> something else?

Compile this code:

extern int *foo (void);
int
bar (void)
{
  return *foo () ? *foo () : 1;
}


This is what effectively corresponds to

  return errno ? errno : 1;

You will always end up with two calls to 'foo' since the compiler is not
allowed to eliminate them.  It has no means to determine that 'foo' has
no side effects and a constant return value.

With gcc the story is different since we can declare 'foo' as

  extern int *foo (void) __attribute__ ((const));

This is why you see only one function can.  But this doesn't work with a
compiler which only implements ISO C or which has no support in the
system's headers.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

Re: Is --enable-utf8 working everywhere?

Posted by Ulrich Drepper <dr...@redhat.com>.
On Wed, 2002-07-17 at 09:35, Alan Shutko wrote:

> Could you explain what the impact of this is?  Is the concern that
> we'll have a different result between calls to the hidden function
> call, or that it's somewhat wasteful to call it multiple times, or
> something else?

Compile this code:

extern int *foo (void);
int
bar (void)
{
  return *foo () ? *foo () : 1;
}


This is what effectively corresponds to

  return errno ? errno : 1;

You will always end up with two calls to 'foo' since the compiler is not
allowed to eliminate them.  It has no means to determine that 'foo' has
no side effects and a constant return value.

With gcc the story is different since we can declare 'foo' as

  extern int *foo (void) __attribute__ ((const));

This is why you see only one function can.  But this doesn't work with a
compiler which only implements ISO C or which has no support in the
system's headers.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

Re: Is --enable-utf8 working everywhere?

Posted by Alan Shutko <at...@acm.org>.
Ulrich Drepper <dr...@redhat.com> writes:

> Wrong.  errno is in fact on most systems a hidden function call and the
> C language does not have any provisions to say that a function call can
> be eliminated because it always returns the same value and has no side
> effects.  

Could you explain what the impact of this is?  Is the concern that
we'll have a different result between calls to the hidden function
call, or that it's somewhat wasteful to call it multiple times, or
something else?

I think I and other people understand that it can be a call, but don't
see why that matters in this instance.

-- 
Alan Shutko <at...@acm.org> - In a variety of flavors!
Computers will become self-aware entities if struck by lightning.

Re: Is --enable-utf8 working everywhere?

Posted by Alan Shutko <at...@acm.org>.
Ulrich Drepper <dr...@redhat.com> writes:

> Wrong.  errno is in fact on most systems a hidden function call and the
> C language does not have any provisions to say that a function call can
> be eliminated because it always returns the same value and has no side
> effects.  

Could you explain what the impact of this is?  Is the concern that
we'll have a different result between calls to the hidden function
call, or that it's somewhat wasteful to call it multiple times, or
something else?

I think I and other people understand that it can be a call, but don't
see why that matters in this instance.

-- 
Alan Shutko <at...@acm.org> - In a variety of flavors!
Computers will become self-aware entities if struck by lightning.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

RE: Is --enable-utf8 working everywhere?

Posted by Ulrich Drepper <dr...@redhat.com>.
On Wed, 2002-07-17 at 08:44, Ryan Bloom wrote:

> While errno is not a simple variable, compilers are smart enough to
> treat it as if it is a simple variable, so just 'return errno' works
> everywhere.

Wrong.  errno is in fact on most systems a hidden function call and the
C language does not have any provisions to say that a function call can
be eliminated because it always returns the same value and has no side
effects.  We have such a feature in gcc but it's not evailable
everywhere.

And the fact that you don't make copies in APR anywhere does not mean
anything.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

RE: Is --enable-utf8 working everywhere?

Posted by Ulrich Drepper <dr...@redhat.com>.
On Wed, 2002-07-17 at 08:44, Ryan Bloom wrote:

> While errno is not a simple variable, compilers are smart enough to
> treat it as if it is a simple variable, so just 'return errno' works
> everywhere.

Wrong.  errno is in fact on most systems a hidden function call and the
C language does not have any provisions to say that a function call can
be eliminated because it always returns the same value and has no side
effects.  We have such a feature in gcc but it's not evailable
everywhere.

And the fact that you don't make copies in APR anywhere does not mean
anything.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

RE: Is --enable-utf8 working everywhere?

Posted by Ryan Bloom <rb...@covalent.net>.
> From: Ryan Bloom [mailto:rbb@covalent.net]
>
> > From: Ulrich Drepper [mailto:drepper@redhat.com]
> >
> > On Tue, 2002-07-16 at 17:49, Blair Zajac wrote:
> >
> > > We don't need to make a copy of errno.
> >
> > Oh yes, we do.  When it comes to interaction with the C library you
> can
> > believe me.  errno is no simple variable on almost all systems.  So,
> use
> > the patch as I wrote it, please.
> 
> You most definitely do not need to make a copy of errno.  As proof, we
> don't make copies of it anywhere in APR, and it works on every
platform
> we have tried.
> 
> While errno is not a simple variable, compilers are smart enough to
> treat it as if it is a simple variable, so just 'return errno' works
> everywhere.

BTW, I thought of this after I hit send.  Errno MUST be treated as a
simple variable, or all of the older apps that used it as such would
break with new compilers.

Ryan



RE: Is --enable-utf8 working everywhere?

Posted by Ryan Bloom <rb...@covalent.net>.
> From: Ryan Bloom [mailto:rbb@covalent.net]
>
> > From: Ulrich Drepper [mailto:drepper@redhat.com]
> >
> > On Tue, 2002-07-16 at 17:49, Blair Zajac wrote:
> >
> > > We don't need to make a copy of errno.
> >
> > Oh yes, we do.  When it comes to interaction with the C library you
> can
> > believe me.  errno is no simple variable on almost all systems.  So,
> use
> > the patch as I wrote it, please.
> 
> You most definitely do not need to make a copy of errno.  As proof, we
> don't make copies of it anywhere in APR, and it works on every
platform
> we have tried.
> 
> While errno is not a simple variable, compilers are smart enough to
> treat it as if it is a simple variable, so just 'return errno' works
> everywhere.

BTW, I thought of this after I hit send.  Errno MUST be treated as a
simple variable, or all of the older apps that used it as such would
break with new compilers.

Ryan



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

RE: Is --enable-utf8 working everywhere?

Posted by Ryan Bloom <rb...@covalent.net>.
> From: Ulrich Drepper [mailto:drepper@redhat.com]
>
> On Tue, 2002-07-16 at 17:49, Blair Zajac wrote:
> 
> > We don't need to make a copy of errno.
> 
> Oh yes, we do.  When it comes to interaction with the C library you
can
> believe me.  errno is no simple variable on almost all systems.  So,
use
> the patch as I wrote it, please.

You most definitely do not need to make a copy of errno.  As proof, we
don't make copies of it anywhere in APR, and it works on every platform
we have tried.

While errno is not a simple variable, compilers are smart enough to
treat it as if it is a simple variable, so just 'return errno' works
everywhere.

Ryan



RE: Is --enable-utf8 working everywhere?

Posted by Ryan Bloom <rb...@covalent.net>.
> From: Ulrich Drepper [mailto:drepper@redhat.com]
>
> On Tue, 2002-07-16 at 17:49, Blair Zajac wrote:
> 
> > We don't need to make a copy of errno.
> 
> Oh yes, we do.  When it comes to interaction with the C library you
can
> believe me.  errno is no simple variable on almost all systems.  So,
use
> the patch as I wrote it, please.

You most definitely do not need to make a copy of errno.  As proof, we
don't make copies of it anywhere in APR, and it works on every platform
we have tried.

While errno is not a simple variable, compilers are smart enough to
treat it as if it is a simple variable, so just 'return errno' works
everywhere.

Ryan



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is --enable-utf8 working everywhere?

Posted by Ulrich Drepper <dr...@redhat.com>.
On Tue, 2002-07-16 at 17:49, Blair Zajac wrote:

> We don't need to make a copy of errno.

Oh yes, we do.  When it comes to interaction with the C library you can
believe me.  errno is no simple variable on almost all systems.  So, use
the patch as I wrote it, please.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

Re: Is --enable-utf8 working everywhere?

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Blair Zajac <bl...@orcaware.com> writes:
> Karl, can you help out here and check in a fix for this?

Hey, Blair, just an `ACK'.  Thanks for the work; I'm following this
thread as a background process, will take a closer look as soon as I'm
done with issue #797, which is top priority right now (as it can lead
to data corruption).

Fortunately I'm not the only Subversion developer who's also an APR
developer :-), so this doesn't need to bottleneck on me.  And I see
it's not, judging by the thread so far, good...

-K

Re: Is --enable-utf8 working everywhere?

Posted by Branko Čibej <br...@xbc.nu>.
Blair Zajac wrote:

>Ulrich Drepper wrote:
>  
>
>>On Tue, 2002-07-16 at 15:48, Blair Zajac wrote:
>>
>>As a real patch use
>>
>>--- apr/i18n/unix/xlate.c       Tue Apr 16 15:37:07 2002
>>+++ apr/i18n/unix/xlate.c-new   Tue Jul 16 17:21:07 2002
>>@@ -255,7 +255,8 @@
>>     if (!found) {
>>         new->ich = iconv_open(topage, frompage);
>>         if (new->ich == (iconv_t)-1) {
>>-            return errno;
>>+            int e = errno;
>>+            return e ? e : EINVAL;
>>         }
>>         found = 1;
>>         check_sbcs(new);
>>    
>>
>
>Karl, can you help out here and check in a fix for this?
>
>We don't need to make a copy of errno.
>

Strictly speaking, Ulrich's patch is better, because there's no 
guarantee that "errno" is a simple global variable. It could be 
translated into a function call, for all you know -- depends on the 
platform, linc implementation, threading support, etc. etc. So making a 
copy makes sense.

>  It's not clear to me which
>error value we should pick.  Is EINVAL appropriate when the OS
>doesn't set errno when it should?  Maybe we should use something
>else that signifies we don't know what the real errno is.  The
>Solaris man pages for iconv_open() says it can return EMFILE,
>ENFILE, ENOMEM and EINVAL.
>

EINVAL is right.



-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


Re: Is --enable-utf8 working everywhere?

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Blair Zajac <bl...@orcaware.com> writes:
> Karl, can you help out here and check in a fix for this?

Hey, Blair, just an `ACK'.  Thanks for the work; I'm following this
thread as a background process, will take a closer look as soon as I'm
done with issue #797, which is top priority right now (as it can lead
to data corruption).

Fortunately I'm not the only Subversion developer who's also an APR
developer :-), so this doesn't need to bottleneck on me.  And I see
it's not, judging by the thread so far, good...

-K

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is --enable-utf8 working everywhere?

Posted by Ulrich Drepper <dr...@redhat.com>.
On Tue, 2002-07-16 at 17:49, Blair Zajac wrote:

> We don't need to make a copy of errno.

Oh yes, we do.  When it comes to interaction with the C library you can
believe me.  errno is no simple variable on almost all systems.  So, use
the patch as I wrote it, please.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

Re: Is --enable-utf8 working everywhere?

Posted by Blair Zajac <bl...@orcaware.com>.
Ulrich Drepper wrote:
> 
> On Tue, 2002-07-16 at 15:48, Blair Zajac wrote:
> 
> As a real patch use
> 
> --- apr/i18n/unix/xlate.c       Tue Apr 16 15:37:07 2002
> +++ apr/i18n/unix/xlate.c-new   Tue Jul 16 17:21:07 2002
> @@ -255,7 +255,8 @@
>      if (!found) {
>          new->ich = iconv_open(topage, frompage);
>          if (new->ich == (iconv_t)-1) {
> -            return errno;
> +            int e = errno;
> +            return e ? e : EINVAL;
>          }
>          found = 1;
>          check_sbcs(new);

Karl, can you help out here and check in a fix for this?

We don't need to make a copy of errno.  It's not clear to me which
error value we should pick.  Is EINVAL appropriate when the OS
doesn't set errno when it should?  Maybe we should use something
else that signifies we don't know what the real errno is.  The
Solaris man pages for iconv_open() says it can return EMFILE,
ENFILE, ENOMEM and EINVAL.

diff -u -r1.28 xlate.c
--- i18n/unix/xlate.c   15 Jul 2002 19:21:01 -0000      1.28
+++ i18n/unix/xlate.c   17 Jul 2002 00:45:19 -0000
@@ -269,7 +269,7 @@
     if (!found) {
         new->ich = iconv_open(topage, frompage);
         if (new->ich == (iconv_t)-1) {
-            return errno;
+            return errno ? errno : EINVAL;
         }
         found = 1;
         check_sbcs(new);

Best,
Blair

-- 
Blair Zajac <bl...@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is --enable-utf8 working everywhere?

Posted by Blair Zajac <bl...@orcaware.com>.
Ulrich Drepper wrote:
> 
> On Tue, 2002-07-16 at 15:48, Blair Zajac wrote:
> 
> As a real patch use
> 
> --- apr/i18n/unix/xlate.c       Tue Apr 16 15:37:07 2002
> +++ apr/i18n/unix/xlate.c-new   Tue Jul 16 17:21:07 2002
> @@ -255,7 +255,8 @@
>      if (!found) {
>          new->ich = iconv_open(topage, frompage);
>          if (new->ich == (iconv_t)-1) {
> -            return errno;
> +            int e = errno;
> +            return e ? e : EINVAL;
>          }
>          found = 1;
>          check_sbcs(new);

Karl, can you help out here and check in a fix for this?

We don't need to make a copy of errno.  It's not clear to me which
error value we should pick.  Is EINVAL appropriate when the OS
doesn't set errno when it should?  Maybe we should use something
else that signifies we don't know what the real errno is.  The
Solaris man pages for iconv_open() says it can return EMFILE,
ENFILE, ENOMEM and EINVAL.

diff -u -r1.28 xlate.c
--- i18n/unix/xlate.c   15 Jul 2002 19:21:01 -0000      1.28
+++ i18n/unix/xlate.c   17 Jul 2002 00:45:19 -0000
@@ -269,7 +269,7 @@
     if (!found) {
         new->ich = iconv_open(topage, frompage);
         if (new->ich == (iconv_t)-1) {
-            return errno;
+            return errno ? errno : EINVAL;
         }
         found = 1;
         check_sbcs(new);

Best,
Blair

-- 
Blair Zajac <bl...@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/

Re: Is --enable-utf8 working everywhere?

Posted by Ulrich Drepper <dr...@redhat.com>.
On Tue, 2002-07-16 at 15:48, Blair Zajac wrote:

As a real patch use

--- apr/i18n/unix/xlate.c	Tue Apr 16 15:37:07 2002
+++ apr/i18n/unix/xlate.c-new	Tue Jul 16 17:21:07 2002
@@ -255,7 +255,8 @@
     if (!found) {
         new->ich = iconv_open(topage, frompage);
         if (new->ich == (iconv_t)-1) {
-            return errno;
+            int e = errno;
+            return e ? e : EINVAL;
         }
         found = 1;
         check_sbcs(new);


-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

Re: Is --enable-utf8 working everywhere?

Posted by Ulrich Drepper <dr...@redhat.com>.
On Tue, 2002-07-16 at 15:48, Blair Zajac wrote:

As a real patch use

--- apr/i18n/unix/xlate.c	Tue Apr 16 15:37:07 2002
+++ apr/i18n/unix/xlate.c-new	Tue Jul 16 17:21:07 2002
@@ -255,7 +255,8 @@
     if (!found) {
         new->ich = iconv_open(topage, frompage);
         if (new->ich == (iconv_t)-1) {
-            return errno;
+            int e = errno;
+            return e ? e : EINVAL;
         }
         found = 1;
         check_sbcs(new);


-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------