New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perl 5.26: use lib pragma issue in IBM AIX #16709
Comments
From gskallur@gmail.comperl 5.26 use lib pragma is not working in IBM AIX use lib "<DIRPATH>"; Above code snippet fails to append the DIRPATH to perl INC. |
From @jkeenanOn Thu, 04 Oct 2018 11:28:40 GMT, gskallur@gmail.com wrote:
I have never used AIX, but unless something is *very* different there I do not think you are correct. The syntax 'use lib "<DIRPATH>";' only makes sense to me if you have a directory whose name is, literally, '<DIRPATH>' beneath the current working directory. But if you have such a directory, and if it contains a Perl module, and if your Perl program is written correctly, then the module found in that directory can be use-d and its subroutines invoked. I suspect, however, that what the string '<DIRPATH>' means to you is a system-wide environmental variable holding a value for a special directory. A properly written Perl program can handle that as well. Consider: ##### Now, place attachment Hello.pm in directory '<DIRPATH>'. Place attachment Goodbye.pm in directory system_dirpath. Place program in 133558-use-lib.pl the current directory and run. ##### Hello world Goodbye world Thank you very much. |
From @jkeenan |
The RT System itself - Status changed from 'new' to 'open' |
From @TuxOn Thu, 04 Oct 2018 20:08:33 -0700, "James E Keenan via RT"
You know I can give you access to an AIX box, right? * * -- |
From gskallur@gmail.comHere <DIRPATH> means absolute path of the module I tried your small exercise as below placed 133558-use-lib.pl in /scratch/gkallur use lib ('<DIRPATH>', $ENV{DIRPATH}); say ""; use Hello; say ""; use Goodbye; -bash-4.2$ mkdir /scratch/gkallur/system_dirpath placed Hello.pm and Goodbye.pm in /scratch/gkallur/system_dirpath which perl -bash-4.2$ perl -v This is perl 5, version 26, subversion 1 (v5.26.1) built for Copyright 1987-2017, Larry Wall Perl may be copied only under the terms of either the Artistic License or Complete documentation for Perl, including FAQ lists, should be found on -bash-4.2$ perl 133558-use-lib.pl Same thing is working in Linux. And also working with perl 5.22.0 on IBM AIX Here is the output of 133558-use-lib.pl with perl 5.22.0 on the same AIX -bash-4.2$ pwd This is perl 5, version 22, subversion 0 (v5.22.0) built for Copyright 1987-2015, Larry Wall Perl may be copied only under the terms of either the Artistic License or Complete documentation for Perl, including FAQ lists, should be found on -bash-4.2$ perl 133558-use-lib.pl Hello world Goodbye world On Fri, Oct 5, 2018 at 8:38 AM James E Keenan via RT <
|
From gskallur@gmail.comIt is completely blocking us on AIX. Severity is very high On Thu, Oct 4, 2018 at 4:58 PM <perlbug-followup@perl.org> wrote:
|
From @iabynOn Fri, Oct 05, 2018 at 11:22:41AM +0530, Gururaj Kallur wrote:
Can you run this one liner under both the good and bad AIX perls and show $ perl -le'use lib "/foo/bar"; print for @INC' -- |
From gskallur@gmail.comWith Good Perl -bash-4.2$ perl -v This is perl 5, version 22, subversion 0 (v5.22.0) built for Copyright 1987-2015, Larry Wall Perl may be copied only under the terms of either the Artistic License or Complete documentation for Perl, including FAQ lists, should be found on -bash-4.2$ perl -le'use lib "/foo/bar"; print for @INC' With Bad perl -bash-4.2$ perl -v This is perl 5, version 26, subversion 1 (v5.26.1) built for Copyright 1987-2017, Larry Wall Perl may be copied only under the terms of either the Artistic License or Complete documentation for Perl, including FAQ lists, should be found on -bash-4.2$ perl -le'use lib "/foo/bar"; print for @INC' On Mon, Oct 8, 2018 at 1:10 PM Dave Mitchell <davem@iabyn.com> wrote:
|
From @iabynOn Mon, Oct 08, 2018 at 01:19:37PM +0530, Gururaj Kallur wrote:
Interesting. On the bad system, do the following: $ perl -e'use lib "/foo/bar"; printf "%20s %s\n", $_, $INC{$_} for sort keys %INC' You should get something like Config.pm /usr/lib64/perl5/Config.pm Then can you include a copy of the file listed for lib.pm for the bad -- |
From gskallur@gmail.comHere is the output and attached the lib.pm which is listed below -bash-4.2$ perl -e'use lib "/foo/bar"; printf "%20s %s\n", $_, $INC{$_} -bash-4.2$ cat /scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all/ On Mon, Oct 8, 2018 at 1:58 PM Dave Mitchell <davem@iabyn.com> wrote:
-- |
From gskallur@gmail.com |
From gskallur@gmail.comThere is not much difference between working and non-working perl lib.pm -bash-4.2$ diff /scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all/
On Mon, Oct 8, 2018 at 2:22 PM Gururaj Kallur <gskallur@gmail.com> wrote:
-- |
From @iabynOn Mon, Oct 08, 2018 at 02:22:17PM +0530, Gururaj Kallur wrote:
Thanks. What does this get you on the bad system: $ perl -le'unshift @INC, "/foo/bar", @INC; print for @INC' -- |
From gskallur@gmail.com-bash-4.2$ perl -le'unshift @INC, "/foo/bar", @INC; print for @INC' On Mon, Oct 8, 2018 at 2:56 PM Dave Mitchell <davem@iabyn.com> wrote:
|
From @iabynOn Mon, Oct 08, 2018 at 03:25:30PM +0530, Gururaj Kallur wrote:
Is that the exact output, with most of the lines duplicated, or was that a Can you show the output of 'perl -V' on the bad system. I'm kind of running out of suggestions here. I think we may have reached make a backup copy of /scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all/lib.pm then start to edit that file, putting in debugging "print" statements -- |
From @iabynOn Mon, Oct 08, 2018 at 11:37:50PM +0200, Tomasz Konojacki wrote:
D'oh! -- |
From @xenuOn Mon, 8 Oct 2018 22:13:50 +0100
Well, the lines were duplicated because @INC was also passed as a part |
From gskallur@gmail.comFor AIX and HPUX we need to set below variables for any version of perl. export PERL5HOME=/scratch/gkallur/perl Only PATH setting will not work on AIX and HPUX. Here is the output perl -V -bash-4.2$ perl -V Platform: cc='/usr/local/packages/vac_remote/13-dec2014/opt/IBM/xlC/13.1.0/bin/xlc_r Characteristics of this binary (from libperl): On Tue, Oct 9, 2018 at 3:14 AM Dave Mitchell via RT <
|
From gskallur@gmail.comAdded print statements in in the 'import' subroutine of sub import { my %names; if ( # remove trailing duplicates And the output is -bash-4.2$ perl -le'use lib "/foo/bar"; print for @INC' I found that it is not printing the print statement inside the foreach loop |
From gskallur@gmail.comIt is not going inside foreach loop in import subroutine. -bash-4.2$ perl -le'use lib "/foo/bar"; print for @INC' |
From gskallur@gmail.comModified the import subroutine as below and is working fine. ( defined an my %names; if ( # remove trailing duplicates If reverse is inside the foreach then it is not working. |
From @iabynOn Tue, Oct 09, 2018 at 12:50:16PM +0530, Gururaj Kallur wrote:
That's very odd. Can that behaviour be reproduced directly, rather than just in lib.pm? E.g. does this line show any output? $ perl -le 'sub f { for (reverse @_) { print "[$_]" } } f("/foo/bar");' -- |
From gskallur@gmail.comNo output for the line -bash-4.2$ perl -le 'sub f { for (reverse @_) { print "[$_]" } } I have written small code to test the reverse behaviour. my @words = qw(Foo Bar Moo); foreach (@sdrow){ After changing the foreach loop as below -bash-4.2$ cat reverse.pl my @words = qw(Foo Bar Moo); foreach (reverse @words){ No output |
From @iabynOn Tue, Oct 09, 2018 at 02:24:56PM +0530, Gururaj Kallur wrote:
Thanks. So, perl -MO=Concise -e' for (reverse @a) { print }' 2) do you have the facility/ability to build a version of perl-5.26.1 with The building would involve adding the '-DDEBUGGING' switch to the -- |
From gskallur@gmail.com-bash-4.2$ perl -MO=Concise -e' for (reverse @a) { print }' I will try to build with the debug options. Give me some time. Once done |
From gskallur@gmail.comCompiled perl with -DDEBUGGING and optimisation disabled and debugging here is the perl -V output -bash-4.2$ perl -V Platform: cc='/usr/local/packages/vac_remote/13-dec2014/opt/IBM/xlC/13.1.0/bin/xlc_r Characteristics of this binary (from libperl): |
From @iabynOn Tue, Oct 09, 2018 at 05:27:29PM +0530, Gururaj Kallur wrote:
Ok thanks. Run this and show me the output: $ perl -Dst -le '@a = qw(/foo/bar); for (reverse @a) { print }' EXECUTING... => -- |
From @iabynOn Tue, Oct 16, 2018 at 12:32:01PM +0530, Gururaj Kallur wrote:
Err, that wasn't a cut'n'paste error was it? Are you absolutely sure that CXt_LOOP_ARY: failing that, are you absolutely sure that the patch was applied -- |
From gskallur@gmail.comBetter to attach full file pp_hot.c and I will replace and recompile it |
From @iabynOn Tue, Oct 16, 2018 at 01:07:59PM +0530, Gururaj Kallur wrote:
Attached is a modified pp_hot.c against release 5.26.0. -- |
From gskallur@gmail.comThanks, Replaced pp_hot.c with attached one and recompiled the perl. Here is the output -bash-4.2$ ./perl -Dq -le '@a = qw(/foo/bar); for (reverse @a) { print }' CXt_LOOP_ARY: |
From @craigberryOn Mon, Oct 15, 2018 at 12:36 AM Gururaj Kallur <gskallur@gmail.com> wrote:
Sorry, I didn't mention that this has to be run from the top level of
|
From @iabynOn Tue, Oct 16, 2018 at 03:10:14PM +0530, Gururaj Kallur wrote:
Thanks. What's the full output of ./perl -Ilib -V in the build directory of that debugging perl? -- |
From gskallur@gmail.com-bash-4.2$ ./perl -Ilib -V Platform: cc='/usr/local/packages/vac_remote/13-dec2014/opt/IBM/xlC/13.1.0/bin/xlc_r Characteristics of this binary (from libperl): |
From @iabynOn Tue, Oct 16, 2018 at 05:58:33PM +0530, Gururaj Kallur wrote:
And for the final piece of the jigsaw, can you run this command: $ grep U8TYPE config.h handy.h -- |
From gskallur@gmail.com-bash-4.2$ pwd |
From @TuxOn Tue, 9 Oct 2018 11:04:41 +0530, Gururaj Kallur <gskallur@gmail.com>
I find it weird that it did not detect your ccversion You are using xlc_r, which is fine, but you specify the full compiler 1. Do you have /etc/vac.cfg.131 (or alike) What is the section for xlc_r in /etc/vac.cfg** (if you have it? For my AIX-5 with vac-7 it looks like this: * standard c compiler aliased as xlc_r (71 Threads) As you can see, there are "hidden" options that do not show in -V -- |
From @TuxOn Wed, 17 Oct 2018 09:13:19 +0200, "H.Merijn Brand"
These methods are currently used: $ lslpp -ql -Ou vac.C | grep -v '^Path' | head -1 $ lslpp -L | grep 'C for AIX Compiler$' $ lslpp -L | grep 'IBM C and C++ Compilers LUM$' These might need to be added: $ what `which xlc_r` | grep -i version: | sort -u $ strings `which xlc_r` | grep -i version: | sort -u $ gxlc --version (note that my vac/gxlc does not know about -dumpversion) -- |
From gskallur@gmail.comI have used same configuration options to compile perl 5.14.4, 5.22.0 and I could not see issue in 5.14.4, 5.22.0. They are working fine. |
From gskallur@gmail.comSorry its typo. The configuration options used to compile perl 5.14.4, 5.22.0 and 5.26.1 I could not see issue in 5.14.4, 5.22.0. They are working fine. |
From @iabynOn Wed, Oct 17, 2018 at 01:41:04PM +0530, Gururaj Kallur wrote:
I *think* its a C compiler bug relating to integer conversions and In pp_hot.c, can you change the line which is two lines above the first inc = 1 - (PL_op->op_private & OPpITER_REVERSED); recompile, and see what ./perl -Dq -le '@a = qw(/foo/bar); for (reverse @a) { print }' gives you. -- |
From gskallur@gmail.comAfter replacing the line, here is the output -bash-4.2$ ./perl -Dq -le '@a = qw(/foo/bar); for (reverse @a) { print }' CXt_LOOP_ARY: CXt_LOOP_ARY: |
From @iabynOn Wed, Oct 17, 2018 at 03:39:08PM +0530, Gururaj Kallur wrote:
I've now pushed the following commit to blead. It is suitable for commit d6139ec fix 'for reverse @array' bug on AIX -- |
From gskallur@gmail.comFrom where Can I download the patch. |
From @iabynOn Thu, Oct 18, 2018 at 11:06:56AM +0530, Gururaj Kallur wrote:
The raw patch can be found here: https://perl5.git.perl.org/perl.git/patch/d6139ec4a9065ae249ab512398326a70dfb2fea2 -- |
From @tonycozOn Wed, 17 Oct 2018 22:37:32 -0700, gskallur@gmail.com wrote:
Did Dave's patch solve the problem for you? Tony |
From gskallur@gmail.comYes. Now it's working fine on AIX. Also tried it on Linux. It's working On Thu, 13 Dec 2018, 5:26 am Tony Cook via RT <perlbug-followup@perl.org
|
From @tonycozOn Wed, 12 Dec 2018 19:14:27 -0800, gskallur@gmail.com wrote:
Thanks, closing this ticket and added the commit to the backport votes files for 5.28 and 5.26. It cherry-picks cleanly to both. Tony |
@tonycoz - Status changed from 'open' to 'pending release' |
From @LeontOn Mon, Oct 22, 2018 at 11:49 AM Dave Mitchell <davem@iabyn.com> wrote:
The existing code is far too "smart" for its own good. I think we're Leon |
From @Leont0001-Don-t-be-smart-with-OPpITER_REVERSED.patchFrom 94e0a670a42963b33e926e590e83b8b9b0d78c5d Mon Sep 17 00:00:00 2001
From: Leon Timmermans <fawaka@gmail.com>
Date: Sat, 15 Dec 2018 22:50:36 +0100
Subject: [PATCH] Don't be "smart" with OPpITER_REVERSED
---
pp_hot.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/pp_hot.c b/pp_hot.c
index dc02612042..fc4770aca1 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -3931,8 +3931,7 @@ PP(pp_iter)
case CXt_LOOP_LIST: /* for (1,2,3) */
- assert(OPpITER_REVERSED == 2); /* so inc becomes -1 or 1 */
- inc = (IV)1 - (IV)(PL_op->op_private & OPpITER_REVERSED);
+ inc = PL_op->op_private & OPpITER_REVERSED ? -1 : 1;
ix = (cx->blk_loop.state_u.stack.ix += inc);
if (UNLIKELY(inc > 0
? ix > cx->blk_oldsp
@@ -3947,7 +3946,7 @@ PP(pp_iter)
case CXt_LOOP_ARY: /* for (@ary) */
av = cx->blk_loop.state_u.ary.ary;
- inc = (IV)1 - (IV)(PL_op->op_private & OPpITER_REVERSED);
+ inc = PL_op->op_private & OPpITER_REVERSED ? -1 : 1;
ix = (cx->blk_loop.state_u.ary.ix += inc);
if (UNLIKELY(inc > 0
? ix > AvFILL(av)
--
2.20.0
|
From @iabynOn Sat, Dec 15, 2018 at 11:14:31PM +0100, Leon Timmermans wrote:
The existing code is specifically written to avoid a branch (and thus a -- |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release today of Perl 5.30.0, this and 160 other issues have been Perl 5.30.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#133558 (status was 'resolved')
Searchable as RT133558$
The text was updated successfully, but these errors were encountered: