Re: [Fwd: [PATCH]: Portability fixes]

2009-02-02 Thread Martin Buchholz
On Mon, Feb 2, 2009 at 05:42, Christopher Hegarty - Sun Microsystems
Ireland  wrote:
> +static int isAsciiSpace(char c) {
> +  return (((c) == '\t') || ((c) == '\r')  || ((c) == '\b') ||
> +  ((c) == '\n') || ((c) == ' ') );
> +}
> +

A very minor comment -
the parens around (c) are a very good idea in macro definitions,
but they are overkill in a function definition.


hg: jdk7/tl/jdk: 6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds

2009-02-02 Thread jean-christophe . collet
Changeset: 6c5d04d1eff4
Author:jccollet
Date:  2009-02-02 16:50 +0100
URL:   http://hg.openjdk.java.net/jdk7/tl/jdk/rev/6c5d04d1eff4

6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
Summary: Force Locale.US when parsing the cookie expiration date.
Reviewed-by: chegar

! src/share/classes/java/net/HttpCookie.java
+ test/java/net/CookieHandler/B6791927.java



Re: [Fwd: [PATCH]: Portability fixes]

2009-02-02 Thread Christopher Hegarty - Sun Microsystems

Martin Buchholz wrote:

On Mon, Feb 2, 2009 at 05:42, Christopher Hegarty - Sun Microsystems
Ireland  wrote:

+static int isAsciiSpace(char c) {
+  return (((c) == '\t') || ((c) == '\r')  || ((c) == '\b') ||
+  ((c) == '\n') || ((c) == ' ') );
+}
+


A very minor comment -
the parens around (c) are a very good idea in macro definitions,
but they are overkill in a function definition.


Thanks Martin,

I will remove the parentheses if I proceed with this part of the change. 
After the comments from Alan, I'm going to check with the Solaris folks 
on the status of 4160367, which appears to be fixed in S10 and greater. 
If we can I would like to remove the isspace check completely.


-Chris.


Re: [Fwd: [PATCH]: Portability fixes]

2009-02-02 Thread Alan Bateman

Christopher Hegarty - Sun Microsystems Ireland wrote:

Hi Alan, Christos,

I've looked at the changes that Christos suggested and also how Martin 
fixed UNIXProcess_md. Here is what I believe the final change should 
look like.


Comments:
1) "3. last is possibly uninitialized."
   We have already fixed this in a previous changeset, see [1]
2) I made similar changes to Inet6AddressImpl as well as for Inet4

Thanks for taking this one. The jint -> socklen_t change looks good to me.

I'm not so sure about keeping the workaround for that old Solaris 
hostname parsing bug (4160367). I just checked Solaris 10 and 
OpenSolaris and I can't duplicate it (eg: ping "" prints unknown 
host as expected). On older releases (I checked 8 and 9) then it 
duplicates readily (ping "" prints " is alive"). It might 
be worth checking into this as it may be that the workaround code can be 
removed, or at least only compiled on Solaris where it is needed.


-Alan.



Re: [Fwd: [PATCH]: Portability fixes]

2009-02-02 Thread Christopher Hegarty - Sun Microsystems Ireland

Hi Alan, Christos,

I've looked at the changes that Christos suggested and also how Martin 
fixed UNIXProcess_md. Here is what I believe the final change should 
look like.


Comments:
1) "3. last is possibly uninitialized."
   We have already fixed this in a previous changeset, see [1]
2) I made similar changes to Inet6AddressImpl as well as for Inet4

Source Changes:

diff --git a/src/solaris/native/java/net/Inet4AddressImpl.c 
b/src/solaris/native/java/net/Inet4AddressImpl.c

--- a/src/solaris/native/java/net/Inet4AddressImpl.c
+++ b/src/solaris/native/java/net/Inet4AddressImpl.c
@@ -169,7 +169,7 @@ Java_java_net_Inet4AddressImpl_lookupAll
  * Workaround for Solaris bug 4160367 - if a hostname contains a
  * white space then 0.0.0.0 is returned
  */
-if (isspace(hostname[0])) {
+if (isAsciiSpace(hostname[0])) {
 JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
 (char *)hostname);
 JNU_ReleaseStringPlatformChars(env, host, hostname);
@@ -325,7 +325,8 @@ ping4(JNIEnv *env, jint fd, struct socka
 ping4(JNIEnv *env, jint fd, struct sockaddr_in* him, jint timeout,
   struct sockaddr_in* netif, jint ttl) {
 jint size;
-jint n, len, hlen1, icmplen;
+jint n, hlen1, icmplen;
+socklen_t len;
 char sendbuf[1500];
 char recvbuf[1500];
 struct icmp *icmp;
diff --git a/src/solaris/native/java/net/Inet6AddressImpl.c 
b/src/solaris/native/java/net/Inet6AddressImpl.c

--- a/src/solaris/native/java/net/Inet6AddressImpl.c
+++ b/src/solaris/native/java/net/Inet6AddressImpl.c
@@ -200,7 +200,7 @@ Java_java_net_Inet6AddressImpl_lookupAll
  * Workaround for Solaris bug 4160367 - if a hostname contains a
  * white space then 0.0.0.0 is returned
  */
-if (isspace(hostname[0])) {
+if (isAsciiSpace(hostname[0])) {
 JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
 (char *)hostname);
 JNU_ReleaseStringPlatformChars(env, host, hostname);
@@ -455,7 +455,8 @@ ping6(JNIEnv *env, jint fd, struct socka
 ping6(JNIEnv *env, jint fd, struct sockaddr_in6* him, jint timeout,
   struct sockaddr_in6* netif, jint ttl) {
 jint size;
-jint n, len;
+jint n;
+socklen_t len;
 char sendbuf[1500];
 unsigned char recvbuf[1500];
 struct icmp6_hdr *icmp6;
diff --git a/src/solaris/native/java/net/net_util_md.h 
b/src/solaris/native/java/net/net_util_md.h

--- a/src/solaris/native/java/net/net_util_md.h
+++ b/src/solaris/native/java/net/net_util_md.h
@@ -106,6 +106,11 @@ extern jboolean NET_addrtransAvailable()

 extern jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);

+static int isAsciiSpace(char c) {
+  return (((c) == '\t') || ((c) == '\r')  || ((c) == '\b') ||
+  ((c) == '\n') || ((c) == ' ') );
+}
+
 /
  * Macros and constants
  */


-Chris.

[1] 
http://hg.openjdk.java.net/jdk7/tl/jdk/annotate/f9cf49b7b248/src/solaris/native/java/net/Inet6AddressImpl.c




On 01/30/09 10:36, Christopher Hegarty - Sun Microsystems Ireland wrote:

Hi Alan,

Yes, I will assign 6799040 to myself and work with Christos to finalize 
the networking changes.


Thanks,
-Chris.

Alan Bateman wrote:
Christos mailed core-libs-dev yesterday with a few portability 
issues.Anyone have cycles to look at the Inet4AddressImpl.c changes? 
I've created 6799040 to track it. Martin has already pushed a 
changeset to jdk7/tl/jdk for the UNIXProcess_md.c issue.




Subject:
[PATCH]: Portability fixes
From:
chris...@zoulas.com (Christos Zoulas)
Date:
Wed, 28 Jan 2009 14:44:37 -0500
To:
core-libs-...@openjdk.java.net

To:
core-libs-...@openjdk.java.net


Hello,

Here are some simple changes for your consideration:

1. passing possibly negative values to isdigit is undefined behavior:
   http://www.opengroup.org/onlinepubs/009695399/functions/isdigit.html
2. passing possibly negative values to isspace is undefined behavior:
   http://www.opengroup.org/onlinepubs/009695399/functions/isspace.html
3. last is possibly uninitialized.
4. recvfrom argument should be socklen_t not int:
   http://www.opengroup.org/onlinepubs/007908775/xns/recvfrom.html

Thanks,

christos

diff -r fc30e7f4b9b3 src/solaris/native/java/lang/UNIXProcess_md.c
--- a/src/solaris/native/java/lang/UNIXProcess_md.cFri Jan 16 
11:24:18 2009 -0500
+++ b/src/solaris/native/java/lang/UNIXProcess_md.cMon Jan 22 
16:25:36 2009 -0500

@@ -377,7 +377,7 @@
  */
 while ((dirp = readdir(dp)) != NULL) {
 int fd;
-if (isdigit(dirp->d_name[0]) &&
+if (isdigit((unsigned char)dirp->d_name[0]) &&
 (fd = strtol(dirp->d_name, NULL, 10)) >= from_fd + 2)
 close(fd);
 }
diff -r fc30e7f4b9b3 src/solaris/native/java/net/Inet4AddressImpl.c
--- a/src/solaris/native/java/net/Inet4AddressImpl

hg: jdk7/tl/jdk: 2 new changesets

2009-02-02 Thread weijun . wang
Changeset: dbb82636df41
Author:weijun
Date:  2009-02-03 09:38 +0800
URL:   http://hg.openjdk.java.net/jdk7/tl/jdk/rev/dbb82636df41

6552334: Enable DNS in Kerberos by default
Reviewed-by: valeriep

! src/share/classes/sun/security/krb5/Config.java
! src/share/classes/sun/security/krb5/KrbServiceLocator.java
! test/sun/security/krb5/DnsFallback.java

Changeset: ca32af4c0ea5
Author:weijun
Date:  2009-02-03 09:38 +0800
URL:   http://hg.openjdk.java.net/jdk7/tl/jdk/rev/ca32af4c0ea5

6785456: Read Kerberos setting from Windows environment variables
Reviewed-by: valeriep

! src/share/classes/sun/security/krb5/Config.java