develooper Front page | perl.perl5.porters | Postings from February 2001

Re: JPL hack

Thread Previous
From:
Jarkko Hietaniemi
Date:
February 13, 2001 10:00
Subject:
Re: JPL hack
Message ID:
20010213115944.H18446@chaos.wustl.edu
On Wed, Jan 31, 2001 at 12:37:06PM -0800, cd@carios2.ca.boeing.com wrote:
> There have been persistent JPL failures/cores with jdk1.2/1.3. 
> Some brute force debugging on Solaris 2.7 revealed that Java
> is apparently no longer tolerant of native code diddling the
> environment. I don't know Java well but someone suggested Java's 
> heavier internal threading may have become a problem.  
>
> Here's a quick hack that gets JPL working with an environment
> dup. I've verified that this works on Solaris 2.7 with both 
> 5.6.0 and 5.005_03. (By works, I mean doesn't get a segv/
> problematic thread core dump with the Sample program in 
> the JPL distribution.) 
> 
> JPL is a key tool for several projects here. Any chance of 
> some fluent variant of this getting implemented? Other 
> workarounds?

Anyone conversant with JPL/JNI/Java have any comments/ideas?
The suggested patch may help for the core dump but it removes a chunk
of code completely, which feels a bit bad.  Is there some "Right Way"
to do what the removed code tries to do?

> Rgds,
> --
> Charles DeRykus 
> 
> 
> *** perl.c	Tue Jan 30 18:06:05 2001
> --- perl.c.orig	Fri Mar 17 14:35:15 2000
> ***************
> *** 11,22 ****
>    * "A ship then new they built for him/of mithril and of elven glass" --Bilbo
>    */
>   
> - /* dup environment if JPL */
> - #ifdef JPL
> - char **my_env_base, **env_base, **my_env;  
> - int my_env_count = 0;
> - #endif
> - 
>   #include "EXTERN.h"
>   #define PERL_IN_PERL_C
>   #include "perl.h"
> --- 11,16 ----
> ***************
> *** 3204,3239 ****
>   	    env = environ;
>   	if (env != environ)
>   	    environ[0] = Nullch;
> - #ifdef JPL
> -         env_base = env;
> -         for (; *env; env++) 
> -             my_env_count++;
> -         my_env = (char **) safemalloc( sizeof(char *) * (my_env_count+1) );
> -         my_env_base = my_env;
> -         env = env_base;
> -         for (; *env; env++, my_env++) {
> -            *my_env = (char *) safemalloc( sizeof(char) * (strlen(*env)+1) );
> -            strcpy( *my_env, *env );
> -         }
> -         *my_env = '\0';
> -         my_env = my_env_base;
> -         for (; *my_env; my_env++) {
> -             if ( !(s = strchr(*my_env,'=')))
> -                 continue;
> -             *s++ = '\0';
> - #if defined(MSDOS)
> -             (void)strupr(*my_env);
> - #endif
> -             sv = newSVpv(s--,0);
> -             (void)hv_store(hv, *my_env, s - *my_env, sv, 0);
> -             *s = '=';
> - #if defined(__BORLANDC__) && defined(USE_WIN32_RTL_ENV)
> -             /* Sins of the RTL. See note in my_setenv(). */
> -             (void)PerlEnv_putenv(savepv(*my_env));
> - #endif
> -         }
> -              /*  non-JPL */
> - #else
>   	for (; *env; env++) {
>   	    if (!(s = strchr(*env,'=')))
>   		continue;
> --- 3198,3203 ----
> ***************
> *** 3250,3256 ****
>   #endif
>   	}
>   #endif
> - #endif
>   #ifdef DYNAMIC_ENV_FETCH
>   	HvNAME(hv) = savepv(ENV_HV_NAME);
>   #endif
> --- 3214,3219 ----

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About