Mon Nov 26 21:03:00 2012: Request 81375 was acted upon.
Transaction: Correspondence added by xyf.x...@gmail.com
       Queue: Inline
     Subject: Re: [rt.cpan.org #81375] chdir without cc
   Broken in: 0.50
    Severity: Normal
       Owner: Nobody
  Requestors: bernhard+c...@lsmod.de
      Status: open
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=81375 >


I vote for David,  It's a bug from chdir other than Inline.

On Tue, Nov 27, 2012 at 7:53 AM, dcmertens.p...@gmail.com via RT <
bug-inl...@rt.cpan.org> wrote:

> Mon Nov 26 18:53:28 2012: Request 81375 was acted upon.
> Transaction: Correspondence added by dcmertens.p...@gmail.com
>        Queue: Inline
>      Subject: Re: [rt.cpan.org #81375] chdir without cc
>    Broken in: 0.50
>     Severity: Normal
>        Owner: Nobody
>   Requestors: bernhard+c...@lsmod.de
>       Status: open
>  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=81375 >
>
>
> For the curious, a CPAN solution that handles this *very* nicely is
> p3rl.org/File::chdir
>
> David
> On Nov 24, 2012 6:52 PM, "Sisyphus via RT" <bug-inl...@rt.cpan.org> wrote:
>
> > Sat Nov 24 19:52:30 2012: Request 81375 was acted upon.
> > Transaction: Correspondence added by SISYPHUS
> >        Queue: Inline
> >      Subject: chdir without cc
> >    Broken in: 0.50
> >     Severity: Normal
> >        Owner: Nobody
> >   Requestors: bernhard+c...@lsmod.de
> >       Status: open
> >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=81375 >
> >
> >
> > On Sat Nov 24 07:56:37 2012, bmwiedemann wrote:
> >
> > > I appended to your script:
> > > system("pwd");
> >
> > [snip]
> >
> > > Using Pure Perl Implementation
> > > 42
> > > /home/bernhard/temp/_Inline/build/testc_pl_b91d
> > >
> > > and it showed that it changed the current dir for the perl process
> >
> > Yes, this could be fixed from within the script I provided as follows:
> >
> > #################################
> > use strict;
> > use warnings;
> > use Cwd;
> >
> >
> > my $cwd = getcwd();
> >
> > eval {
> >  require Inline; Inline->import (C => Config =>
> >     #CC => 'bogus', # Easy way to make the build fail
> >     BUILD_NOISY => 1);
> >
> >  require Inline; Inline->import (C =><<' EOC');
> >
> >  int foo() {
> >    warn("Using Inline\n");
> >    return 42;
> >  }
> >
> >  EOC
> > };
> >
> > # If Inline is unavailable, foo() simply calls
> > # the sub bar() pure perl implementation.
> > if($@) {
> >   chdir $cwd or warn "Couldn't chdir to $cwd";
> >   *foo =\&bar;
> > }
> >
> > sub bar {
> >   warn("Using Pure Perl Implementation\n");
> >   return 42;
> > }
> >
> > my $x = foo();
> > print "$x\n";
> > print $cwd, "\n";
> > #################################
> >
> > (I've used Cwd::getcwd instead of the pwd system call because pwd is not
> > available on all systems.)
> >
> > However, I think (not yet fully tested) this can also be fixed quite
> > simply from within C.pm by rewriting sub compile as:
> >
> > #################################
> > sub compile {
> >     my $o = shift;
> >
> >     my $build_dir = $o->{API}{build_dir};
> >     my $cwd = &cwd;
> >     ($cwd) = $cwd =~ /(.*)/ if $o->UNTAINT;
> >
> >     chdir $build_dir;
> >     eval {
> >     $o->call('makefile_pl', '"perl Makefile.PL"', 2);
> >     $o->call('make', '"make"', 2);
> >     $o->call('make_install', '"make install"', 2);
> >     };
> >     chdir $cwd;
> >     die if $@;
> >     $o->call('cleanup', 'Cleaning Up', 2);
> > }
> > #################################
> >
> > So I'll go with that changed version of C.pm's sub compile unless, in
> > the course of more thorough testing, I discover a problem with it.
> > If it tests ok for me, I'll release an Inline-0.51_03 that contains the
> > fix in a day or two.
> >
> > Thanks for the report !
> >
> > Cheers,
> > Rob
> >
> >
> >
>
>

Reply via email to