develooper Front page | perl.perl5.porters | Postings from December 2008

Re: [perl.git] branch blead, updated. GitLive-blead-80-g54ad55c

Thread Next
From:
Nicholas Clark
Date:
December 26, 2008 02:38
Subject:
Re: [perl.git] branch blead, updated. GitLive-blead-80-g54ad55c
Message ID:
20081226103827.GA20270@plum.flirble.org
On Fri, Dec 26, 2008 at 12:24:59AM +0100, Rafael Garcia-Suarez wrote:

>     [perl #6665] Different behavior using the -Idir option on the command line and inside a perl script
>     
>     Adds the -Idir at the beginning of @INC.
>     
>     (Plus a test by rgs -- check that -I does not add directories at the end
>     of the @INC array anymore)
> 
> M	perl.c
> M	t/run/switchI.t

> diff --git a/perl.c b/perl.c
> index 021f35d..deb9d38 100644
> --- a/perl.c
> +++ b/perl.c
> @@ -4873,7 +4873,8 @@ S_incpush_if_exists(pTHX_ SV *dir)
>  
>      if (PerlLIO_stat(SvPVX_const(dir), &tmpstatbuf) >= 0 &&
>  	S_ISDIR(tmpstatbuf.st_mode)) {
> -	av_push(GvAVn(PL_incgv), dir);
> +	av_unshift( GvAVn( PL_incgv ), 1 );
> +	av_store( GvAVn( PL_incgv ), 0, dir );
>  	dir = newSV(0);
>      }
>      return dir;
> @@ -5093,8 +5094,9 @@ S_incpush(pTHX_ const char *dir, bool addsubdirs, bool addoldvers, bool usesep,
>  #endif
>  	}
>  
> -	/* finally push this lib directory on the end of @INC */
> -	av_push(GvAVn(PL_incgv), libdir);
> +	/* finally add this lib directory at the beginning of @INC */
> +	av_unshift( GvAVn( PL_incgv ), 1 );
> +	av_store( GvAVn( PL_incgv ), 0, libdir );
>      }
>      if (subdir) {
>  	assert (SvREFCNT(subdir) == 1);

This patch does more than it says. It also moves '.' to the start of @INC:

$ ./miniperl -le 'print foreach @INC'
.
/home/nick/Perl/lib/perl5/site_perl/5.11.0
/home/nick/Perl/lib/perl5/site_perl/5.11.0/x86_64-linux-thread-multi
/home/nick/Perl/lib/perl5/5.11.0
/home/nick/Perl/lib/perl5/5.11.0/x86_64-linux-thread-multi

Which has the side effect of breaking the build:

make[2]: Entering directory `/home/nick/Perl/perl/ext/Encode/Symbol'
../../../miniperl "-I../../../lib" "-I../../../lib" ../../../lib/ExtUtils/xsubpp  -nolinenumbers -typemap ../../../lib/ExtUtils/typemap  Symbol.xs > Symbol.xsc && mv Symbol.xsc Symbol.c
Can't load module Encode, dynamic loading not available in this perl.
  (You may need to build a new perl executable which either supports
  dynamic loading or has the Encode module statically linked into it.)
 at Symbol.pm line 4
Compilation failed in require at Symbol.pm line 4.
BEGIN failed--compilation aborted at Symbol.pm line 4.
Compilation failed in require at ../../../lib/ExtUtils/ParseXS.pm line 8.
BEGIN failed--compilation aborted at ../../../lib/ExtUtils/ParseXS.pm line 8.
Compilation failed in require at ../../../lib/ExtUtils/xsubpp line 4.
BEGIN failed--compilation aborted at ../../../lib/ExtUtils/xsubpp line 4.
make[2]: *** [Symbol.c] Error 9
make[2]: Leaving directory `/home/nick/Perl/perl/ext/Encode/Symbol'
make[1]: *** [subdirs] Error 2
make[1]: Leaving directory `/home/nick/Perl/perl/ext/Encode'
make: *** [lib/auto/Encode/Encode.so] Error 2


(use Symbol picks up Encode::Symbol from . rather than the Symbol.pm from lib)

I guess we're missing regression tests to make sure that '.' is last in @INC.

Also, right now I'm not sure what part of this change needs undoing to fix '.'
in @INC and hence the build.

Nicholas Clark




Thread Next


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