Re: incorrect fix in net.c

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
Frediano Ziglio wrote:
> 2009/4/4 James K. Lowden <[email protected]>:
> > --- src/tds/net.c       16 Mar 2009 07:49:57 -0000      1.90
> > +++ src/tds/net.c       27 Mar 2009 09:22:49 -0000      1.91
> > @@ -700,7 +700,7 @@
> >           continue;
> >   }
> >
> > -  if (0 == nput || nput < 0 && sock_errno == EAGAIN)
> > +  if (0 == nput || sock_errno == EAGAIN)
> >           continue;
> >
> >
> > The above change is incorrect.  sock_errno has no meaning unless
> > send/write returns -1.
> >
> 
> [The] > 0 case is already handled, 0 case is tested by "0 == nput" so
> only < 0 is left (where sock_errno is valid)

Ah, clever.  OK.  

BTW, our mail clients are at war over spaces.  :-(  

The quoted text above appears on my screen as a series of pairs of 0x20
spaces alternating with "Â", what Unicode calls "LATIN CAPITAL LETTER A
WITH CIRCUMFLEX", U+00C2.  

What I originally sent was just a series of ASCII spaces, 0x20's.  The
mail header announced the encoding:

	Content-Type: text/plain; charset="us-ascii"
	Content-Transfer-Encoding: 7bit

Your message has

	Content-Type: text/plain; charset="utf-8"
	Content-Transfer-Encoding: base64

Decoded, the utf-8 looks like this:

$ sed -ne'/^Mj/,$p' 19500 | base64 -d | hexdump -C | sed -ne
'/net/,/continue/p'

64 73 2f 6e 65 74 2e 63  20 c2 a0 20 c2 a0 20 c2  |ds/net.c .. .. .|
a0 20 31 36 20 4d 61 72  20 32 30 30 39 20 30 37  |. 16 Mar 2009 07|
3a 34 39 3a 35 37 20 2d  30 30 30 30 20 c2 a0 20  |:49:57 -0000 .. |
c2 a0 20 c2 a0 31 2e 39  30 0a 3e 20 2b 2b 2b 20  |.. ..1.90.> +++ |
73 72 63 2f 74 64 73 2f  6e 65 74 2e 63 20 c2 a0  |src/tds/net.c ..|
20 c2 a0 20 c2 a0 20 32  37 20 4d 61 72 20 32 30  | .. .. 27 Mar 20|
30 39 20 30 39 3a 32 32  3a 34 39 20 2d 30 30 30  |09 09:22:49 -000|
30 20 c2 a0 20 c2 a0 20  c2 a0 31 2e 39 31 0a 3e  |0 .. .. ..1.91.>|
20 40 40 20 2d 37 30 30  2c 37 20 2b 37 30 30 2c  | @@ -700,7 +700,|
37 20 40 40 0a 3e 20 c2  a0 20 c2 a0 20 c2 a0 20  |7 @@.> .. .. .. |
c2 a0 20 c2 a0 20 63 6f  6e 74 69 6e 75 65 3b 0a  |.. .. continue;.|

Your mail client apparently converts every 0x20 0x20 pair to 0x20 0xA0,
makes every 2nd space a non-breaking space.  Those "c2 a0" sequences are
UTF-8 encodings of U+A0, a non-breaking space.  

My mail client, however, apparently doesn't recognize the charset property
of the Content-Type header.  It treats "c2 a0" as two characters: 0xC2 and
0xA0, an  and a non-breaking space.  

One of these days I'll upgrade, and I'm sure this old bug was fixed long
ago.  But I thought you might want to know where all those weird
characters were coming from.  

Regards, 

--jkl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.