RFR(8u): JDK-8136570: Avoid setting environment variables related to /usr/dt

Rob McKenna rob.mckenna at oracle.com
Tue Nov 8 19:22:10 UTC 2016


Meant to respond to this and your other mail earlier. I'll file a backport and take care of it. Thanks!

	-Rob

On 06/11/16 04:46, Martin Buchholz wrote:
> I support this backport.  It fixes a crash!
> 
> On Sun, Nov 6, 2016 at 12:27 PM, Tiago Daitx <tiago.daitx at canonical.com>
> wrote:
> 
> > Hi,
> >
> > Please review the backported changes for JDK-8136570 to 8u in the
> > inline patch bellow.
> >
> > JDK-8136570 <https://bugs.openjdk.java.net/browse/JDK-8136570>: Stop
> > changing user environment variables related to /usr/dt
> > JDK 9 changeset: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/acf424f856ce
> > JDK 9 Review Thread:
> > http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-
> > September/035271.html
> >
> > Original patch applies cleanly with a small offset on hunk #2, thus I
> > modified it to match 8u line numbers.
> >
> > Note: I'm a Participant, not a Contributor but I assume the backport
> > is trival enough to not require a signed OCA.
> >
> >
> > Patch bellow:
> >
> > # HG changeset patch
> > # User martin
> > # Date 1442425751 25200
> > # Node ID acf424f856ce5abf98ee59b9d28249eeba840428
> > # Parent  bb6e5a409fefefce5b748ceacfa581698c710567
> > 8136570: Stop changing user environment variables related to /usr/dt
> > 4953367: MAWT: Java should be more careful manipulating NLSPATH,
> > XFILESEARCHPATH env variables
> > Summary: Stop changing user environment variables: NLSPATH XFILESEARCHPATH
> > Reviewed-by: prr
> >
> > diff -r bb6e5a409fef -r acf424f856ce
> > src/solaris/native/java/lang/java_props_md.c
> > --- a/src/solaris/native/java/lang/java_props_md.c Thu Sep 17 17:33:00
> > 2015 +0200
> > +++ b/src/solaris/native/java/lang/java_props_md.c Wed Sep 16 10:49:11
> > 2015 -0700
> > @@ -91,46 +91,6 @@
> >      return 0;
> >  }
> >
> > -/* This function sets an environment variable using envstring.
> > - * The format of envstring is "name=value".
> > - * If the name has already existed, it will append value to the name.
> > - */
> > -static void
> > -setPathEnvironment(char *envstring)
> > -{
> > -    char name[20], *value, *current;
> > -
> > -    value = strchr(envstring, '='); /* locate name and value separator */
> > -
> > -    if (! value)
> > -        return; /* not a valid environment setting */
> > -
> > -    /* copy first part as environment name */
> > -    strncpy(name, envstring, value - envstring);
> > -    name[value-envstring] = '\0';
> > -
> > -    value++; /* set value point to value of the envstring */
> > -
> > -    current = getenv(name);
> > -    if (current) {
> > -        if (! strstr(current, value)) {
> > -            /* value is not found in current environment, append it */
> > -            char *temp = malloc(strlen(envstring) + strlen(current) + 2);
> > -        strcpy(temp, name);
> > -        strcat(temp, "=");
> > -        strcat(temp, current);
> > -        strcat(temp, ":");
> > -        strcat(temp, value);
> > -        putenv(temp);
> > -        }
> > -        /* else the value has already been set, do nothing */
> > -    }
> > -    else {
> > -        /* environment variable is not found */
> > -        putenv(envstring);
> > -    }
> > -}
> > -
> >  #ifndef P_tmpdir
> >  #define P_tmpdir "/var/tmp"
> >  #endif
> > @@ -612,16 +572,6 @@
> >      sprops.path_separator = ":";
> >      sprops.line_separator = "\n";
> >
> > -#if !defined(_ALLBSD_SOURCE)
> > -    /* Append CDE message and resource search path to NLSPATH and
> > -     * XFILESEARCHPATH, in order to pick localized message for
> > -     * FileSelectionDialog window (Bug 4173641).
> > -     */
> > -    setPathEnvironment("NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat");
> > -    setPathEnvironment("XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt");
> > -#endif
> > -
> > -
> >  #ifdef MACOSX
> >      setProxyProperties(&sprops);
> >  #endif
> >
> >
> >
> > Regards,
> >
> > --
> > Tiago Stürmer Daitx
> > Software Engineer
> > tiago.daitx at canonical.com
> >
> > PGP Key: 4096R/F5B213BE (hkp://keyserver.ubuntu.com)
> > Fingerprint = 45D0 FE5A 8109 1E91 866E  8CA4 1931 8D5E F5B2 13BE
> >


More information about the jdk8u-dev mailing list