I've done a bit more digging.  It turns out the problem only occurs for shared 
JVM (which I don't think I need).  But the problem is not in Inline::Java at 
all.  Here is a simple script to demonstrate the problem which lies in either 
Perl's open function of in IPC::Open3's open3 method.

#!/usr/bin/perl

use IPC::Open3;
use IO::File;

# This one works fine:
# my $pid = open3( '<&STDIN', '>&STDOUT', '>&STDERR', 'ls' );
# warn "$pid\n";

# This one does not.
my $dev_null = '/dev/null';

my $out = new IO::File( ">/dev/null" );
if ( not defined $out ) {
    die "couldn't open $dn for writing\n"; 
}   

my $pid = open3( '<&STDIN', $out, '>&STDERR', 'ls' );

Running this results in:
open3: open(GLOB(0x180b0cc), >&=4) failed: Bad file descriptor at ./open3test 
line 17

I even poked inside IPC::Open3 and wrote to the handle whose descriptor is 4 
without problem.

Whom should I tell of this apparent bug?

Phil

p.s. For completeness, here is perl -V:
Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
  Platform:
    osname=darwin, osvers=8.0, archname=darwin-thread-multi-2level
    uname='darwin b01.apple.com 8.0 darwin kernel version 8.0.0: tue nov 15 
13:23:51 pst 2005; root:xnu-792.99.1.obj~6release_ppc power macintosh powerpc '
    config_args='-ds -e -Dprefix=/usr -Dccflags=-g  -pipe  
-Dldflags=-Dman3ext=3pm -Duseithreads -Duseshrplib'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp 
-fno-strict-aliasing -I/usr/local/include',
    optimize='-O3',
    cppflags='-no-cpp-precomp -g -pipe -fno-common -DPERL_DARWIN 
-no-cpp-precomp -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='4.0.1 (Apple Computer, Inc. build 5250)', 
gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='-L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-bundle -undefined dynamic_lookup 
-L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES 
PERL_IMPLICIT_CONTEXT
  Locally applied patches:
        23953 - fix for File::Path::rmtree CAN-2004-0452 security issue
        33990 - fix for setuid perl security issues
  Built under darwin
  Compiled at Jan 13 2006 11:59:39
  @INC:
    /System/Library/Perl/5.8.6/darwin-thread-multi-2level
    /System/Library/Perl/5.8.6
    /Library/Perl/5.8.6/darwin-thread-multi-2level
    /Library/Perl/5.8.6
    /Library/Perl
    /Network/Library/Perl/5.8.6/darwin-thread-multi-2level
    /Network/Library/Perl/5.8.6
    /Network/Library/Perl
    /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level
    /System/Library/Perl/Extras/5.8.6
    /Library/Perl/5.8.1
    .


----- Original Message ----
From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]; inline@perl.org
Sent: Tuesday, October 10, 2006 9:51:25 AM
Subject: RE: Inline::Java on Mac OS X

This looks like it might be a mismatch between java 1.4 and java 1.5.
Maybe some parts of the process are using one and some the other?

It doesn't look like the same problems the previous messages dealt with,
though.

 -Ken 

> -----Original Message-----
> From: Phil Crow [mailto:[EMAIL PROTECTED] 
> Sent: Monday, October 09, 2006 5:36 PM
> To: inline@perl.org
> Subject: Inline::Java on Mac OS X
> 
> Is there an archive for messages on this list?  I
> remember a discussion some time ago about getting
> Inline::Java to run on Mac OS X.  But, since I had no
> mac at the time, I deleted it.
> 
> Now, you've guessed that I have a new mac and would
> like to use Inline::Java once more.
> 
> In case my question is really new, here is what
> happened.  I have Inline 0.44 running on Perl 5.8.6 on
> version 10.4 of OS X.  When I tried to install
> Inline::Java, I got errors.  perl Makefile.PL went
> fine, as did make java and make.  make test said
> things like:
> 
> t/03_objects...........
> Note: inner_obj13.java uses unchecked or unsafe
> operations.
> Note: Recompile with -Xlint:unchecked for details.
> 
> I took these as warnings, but I'm not sure.
> 
> It also said things like:
> t/10_2_shared_start....Can't exec JVM: open3:
> open(GLOB(0x180a9bc), >&=9) failed: Bad file
> descriptor at
> /Users/phil/cpansrc/Inline-Java-0.51/blib/lib/Inline/Java/JVM.pm
> line 185
>  at
> /Users/phil/cpansrc/Inline-Java-0.51/blib/lib/Inline/Java.pm
> line 484
> BEGIN failed--compilation aborted at
> t/10_2_shared_start.t line 33.
> JVM taking more than 15 seconds to start, or died
> before Perl could connect. Increase config
> STARTUP_DELAY if necessary. at
> /Users/phil/cpansrc/Inline-Java-0.51/blib/lib/Inline/Java.pm
> line 484
> 
> and
> 
> t/10_3_shared_use......Can't find running JVM and
> START_JVM = 0 at
> /Users/phil/cpansrc/Inline-Java-0.51/blib/lib/Inline/Java.pm
> line 484
> BEGIN failed--compilation aborted at
> t/10_3_shared_use.t line 32.
> 
> In total, 25 tests failed.
> 
> Any help is appreciated,
> 
> Phil
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 





Reply via email to