Skip to content
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

Closed
p5pRT opened this issue Oct 4, 2018 · 69 comments
Closed

perl 5.26: use lib pragma issue in IBM AIX #16709

p5pRT opened this issue Oct 4, 2018 · 69 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 4, 2018

Migrated from rt.perl.org#133558 (status was 'resolved')

Searchable as RT133558$

@p5pRT
Copy link
Author

p5pRT commented Oct 4, 2018

From gskallur@gmail.com

perl 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.
Because of which perl is not able to load modules in aix
--
Thanks & Regards
Gururaj Kallur
Mobile​: 91-9845227154

@p5pRT
Copy link
Author

p5pRT commented Oct 5, 2018

From @jkeenan

On Thu, 04 Oct 2018 11​:28​:40 GMT, gskallur@​gmail.com wrote​:

perl 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.
Because of which perl is not able to load modules in aix

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​:

#####
$> cd /tmp
$> mkdir '<DIRPATH>' # quotes needed because '<' is a shell metacharacter
$> mkdir system_dirpath
$> export DIRPATH=system_dirpath
$> echo $DIRPATH
system_dirpath
#####

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.

#####
$ perl 133558-use-lib.pl
@​INC​:
  /home/jkeenan/perl5/perlbrew/perls/perl-5.28.0/lib/5.28.0
  /home/jkeenan/perl5/perlbrew/perls/perl-5.28.0/lib/5.28.0/x86_64-linux
  /home/jkeenan/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0
  /home/jkeenan/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/x86_64-linux
  /tmp/system_dirpath
  <DIRPATH>

Hello world

Goodbye world
#####

Thank you very much.
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Oct 5, 2018

From @jkeenan

133558-use-lib.pl

@p5pRT
Copy link
Author

p5pRT commented Oct 5, 2018

From @jkeenan

Goodbye.pm

@p5pRT
Copy link
Author

p5pRT commented Oct 5, 2018

From @jkeenan

Hello.pm

@p5pRT
Copy link
Author

p5pRT commented Oct 5, 2018

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Oct 5, 2018

From @Tux

On Thu, 04 Oct 2018 20​:08​:33 -0700, "James E Keenan via RT"
<perlbug-followup@​perl.org> wrote​:

On Thu, 04 Oct 2018 11​:28​:40 GMT, gskallur@​gmail.com wrote​:

perl 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.
Because of which perl is not able to load modules in aix

I have never used AIX, but unless something is *very* different there
I do not think you are correct.

You know I can give you access to an AIX box, right?

* *
* Welcome to AIX 5.3.0.0/TL12-05/RD1140/64 *
* *
* IBM 9115 System p5 505 PowerPC *
* 2 CPU's, 4 Gb RAM *
* *

--
H.Merijn Brand http​://tux.nl Perl Monger http​://amsterdam.pm.org/
using perl5.00307 .. 5.29 porting perl5 on HP-UX, AIX, and openSUSE
http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org/
http​://qa.perl.org http​://www.goldmark.org/jeff/stupid-disclaimers/

@p5pRT
Copy link
Author

p5pRT commented Oct 5, 2018

From gskallur@gmail.com

Here <DIRPATH> means absolute path of the module

I tried your small exercise as below

placed 133558-use-lib.pl in /scratch/gkallur
and replaced the line use 5.26.0 wth use 5.26.1 as we are using perl 5.26.1
in 133558-use-lib.pl
-bash-4.2$ cat 133558-use-lib.pl
#!/usr/bin/env perl
use 5.26.1;
use warnings;

use lib ('<DIRPATH>', $ENV{DIRPATH});
say "\@​INC​:";
say " $_" for sort @​INC;

say "";

use Hello;
Hello​::hello();

say "";

use Goodbye;
Goodbye​::goodbye();

-bash-4.2$ mkdir /scratch/gkallur/system_dirpath
-bash-4.2$ export DIRPATH=/scratch/gkallur/system_dirpath
-bash-4.2$ echo $DIRPATH
-bash-4.2$ /scratch/gkallur/system_dirpath

placed Hello.pm and Goodbye.pm in /scratch/gkallur/system_dirpath

which perl
/scratch/gkallur/perl/bin/perl

-bash-4.2$ perl -v

This is perl 5, version 26, subversion 1 (v5.26.1) built for
aix-thread-multi-64all

Copyright 1987-2017, Larry Wall

Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http​://www.perl.org/, the Perl Home Page.

-bash-4.2$ perl 133558-use-lib.pl
Can't locate Hello.pm in @​INC (you may need to install the Hello module)
(@​INC contains​: /scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all
/scratch/gkallur/perl/lib/5.26.1 /scratch/gkallur/perl/lib
../lib/site_perl/5.26.1/aix-thread-multi-64all ../lib/site_perl/5.26.1
../lib/5.26.1/aix-thread-multi-64all ../lib/5.26.1) at 133558-use-lib.pl
line 11.
BEGIN failed--compilation aborted at 133558-use-lib.pl line 11.

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
machine( replaced the line use 5.26.1 wth use 5.22.0 in 133558-use-lib.pl )

-bash-4.2$ pwd
/scratch/gkallur
-bash-4.2$ export PATH=/scratch/gkallur/perl522/bin​:$PATH
-bash-4.2$ which perl
/scratch/gkallur/perl522/bin/perl
-bash-4.2$ perl -v

This is perl 5, version 22, subversion 0 (v5.22.0) built for
aix-thread-multi-64all

Copyright 1987-2015, Larry Wall

Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http​://www.perl.org/, the Perl Home Page.

-bash-4.2$ perl 133558-use-lib.pl
@​INC​:
  .
  ../lib/5.22.0
  ../lib/5.22.0/aix-thread-multi-64all
  ../lib/site_perl/5.22.0
  ../lib/site_perl/5.22.0/aix-thread-multi-64all
  /scratch/gkallur/perl522/lib
  /scratch/gkallur/perl522/lib/5.22.0
  /scratch/gkallur/perl522/lib/5.22.0/aix-thread-multi-64all
  /scratch/gkallur/system_dirpath
  <DIRPATH>

Hello world

Goodbye world

On Fri, Oct 5, 2018 at 8​:38 AM James E Keenan via RT <
perlbug-followup@​perl.org> wrote​:

On Thu, 04 Oct 2018 11​:28​:40 GMT, gskallur@​gmail.com wrote​:

perl 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.
Because of which perl is not able to load modules in aix

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​:

#####
$> cd /tmp
$> mkdir '<DIRPATH>' # quotes needed because '<' is a shell metacharacter
$> mkdir system_dirpath
$> export DIRPATH=system_dirpath
$> echo $DIRPATH
system_dirpath
#####

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.

#####
$ perl 133558-use-lib.pl
@​INC​:
/home/jkeenan/perl5/perlbrew/perls/perl-5.28.0/lib/5.28.0
/home/jkeenan/perl5/perlbrew/perls/perl-5.28.0/lib/5.28.0/x86_64-linux
/home/jkeenan/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0

/home/jkeenan/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/x86_64-linux
/tmp/system_dirpath
<DIRPATH>

Hello world

Goodbye world
#####

Thank you very much.
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Oct 5, 2018

From gskallur@gmail.com

It is completely blocking us on AIX. Severity is very high

On Thu, Oct 4, 2018 at 4​:58 PM <perlbug-followup@​perl.org> wrote​:

Greetings,

This message has been automatically generated in response to the
creation of a perl bug report regarding​:
"perl 5.26​: use lib pragma issue in IBM AIX".

There is no need to reply to this message right now. Your ticket has been
assigned an ID of [perl #133558].

You can view your ticket at
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=133558

Within the next 24 to 72 hours, your message will be posted to the Perl 5
Porters mailing list. Please be patient!

Please include the string​:

[perl #133558]

in the subject line of all future correspondence about this issue. To do
so,
you may reply to this message (please delete unnecessary quotes and text.)

Thank you,
perlbug-followup@​perl.org

-------------------------------------------------------------------------
Dkim-Signature​: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com;
s=20161025; h=mime-version​:from​:date​:message-id​:subject​:to;
bh=yLIh/Rc0ocKL/rCDDDkGaZKwfHpPXKKVyYzkDo7E5xg=;
b=Hrmia17NmxwQ8m3MN6NE3Pv32ewwe89SqgoJP//ldxx/84uHxXGeJmSSgf+tTQBMoW
S2FvtG1+BK+fvJNZa6sAgkhjt5+115hUPICdBjc6LeTf07A5KkdXIMh18MNJuHcDrhxj
QsZ2UUSZFhY7db/R9DUrq5sNuMO3SPIvm7lT/QfnDCn+QBAq30F4sLhJwDpKoNeOGTdb
+9v8Nfyky2TKCwpn5eNQmgF9JKc4HAOtYORGY0mW4PiJoEwbKfLSOqN45Hnq+KnAC7CH
97G1CyjYZFCwBTIkZZq2L16gn6sKDSVaatHkjvxMWaqA7HGhco2HPmuE2uv2JVkEU87y yjJQ==
X-PMX-Version​: 5.6.1.2065439, Antispam-Engine​: 2.7.2.376379,
Antispam-Data​: 2018.10.4.112116
Return-Path​: <gskallur@​gmail.com>
To​: perlbug@​perl.org
X-Spam-Status​: No, score=-2.0 required=6.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE
autolearn=ham version=3.3.1
X-Spam-Checker-Version​: SpamAssassin 3.3.1 (2010-03-16) on
mx3.develooper.com
MIME-Version​: 1.0
From gskallur@​gmail.com Thu Oct 4 04​:28​:39 2018
X-Original-To​: rt-perl5@​rtperl.dev
From​: Gururaj Kallur <gskallur@​gmail.com>
Message-ID​: <CAEbNYu4EBTAFgzd9N=jEx6aqrW=
LxKZ9vrVGVpY-osndHCdAVA@​mail.gmail.com>
X-RT-Mail-Extension​: perl5
Delivered-To​: rt-perl5@​rtperl.dev
Subject​: perl 5.26​: use lib pragma issue in IBM AIX
X-Google-SMTP-Source​:
ACcGV63ggL2KipKFUlLPXF2Y5Ziw2ziwKajwI1Pyj9NGDUU2v8AMTJ/rWKXfMcPP923+KziVlWkRTloL6Vd12m35pRM=
Date​: Thu, 4 Oct 2018 16​:58​:08 +0530
Received​: from xx1.develooper.com (xx1.dev [10.0.100.115]) by
rtperl.develooper.com (Postfix) with ESMTP id 6656C140 for
<rt-perl5@​rtperl.dev>; Thu, 4 Oct 2018 04​:28​:39 -0700 (PDT)
Received​: from localhost (xx1.develooper.com [127.0.0.1]) by localhost
(Postfix) with ESMTP id 39C5D11EF2C for <rt-perl5@​rtperl.dev>; Thu, 4
Oct 2018 04​:28​:39 -0700 (PDT)
Received​: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by
localhost (Postfix) with SMTP id 61EF411F0CE for <rt-perl5@​rtperl.dev>;
Thu, 4 Oct 2018 04​:28​:37 -0700 (PDT)
Received​: from mail-ed1-f46.google.com (mail-ed1-f46.google.com
[209.85.208.46]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No
client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS
id 8DDFC11EF2C for <perlbug@​perl.org>; Thu, 4 Oct 2018 04​:28​:22 -0700
(PDT)
Received​: by mail-ed1-f46.google.com with SMTP id c1-v6so8202734ede.5 for
<perlbug@​perl.org>; Thu, 04 Oct 2018 04​:28​:22 -0700 (PDT)
X-GM-Message-State​:
ABuFfoif1zhhgZhHi2yo7estvJoMUItTgiCBipOeYAo6HWCtpjEr7rZ2
d4VUKmHwY44dACnTzEx0ByLfw6Wqn7xVKsl8ec6N/MkGrDI=
X-Google-Dkim-Signature​: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;
s=20161025;
h=x-gm-message-state​:mime-version​:from​:date​:message-id​:subject​:to;
bh=yLIh/Rc0ocKL/rCDDDkGaZKwfHpPXKKVyYzkDo7E5xg=;
b=NBEZr7CkkX8s04t5HjKzoTIclES9dxdJbncPH43rCnrIp0FuOZRPAarf3vbiPmGoKA
JfkhUrOwIqyCxRU2A5qV9ErJdl+nAR3N+V/r0FF4lEZMXBE9/TToXWwdFiz66lmK5Kj0
rnOLufPXjtD4WGJwHusVRTR4wPqy5RVzp6LE7LHe/Yb30I8GfetIbhGfA/lUv2tdq6mh
Rg1yFaz5bx6q7nXOsUgm7nrkZpPCuNYvm+L0ava0QzBRnIvQhizMm/ijzZlTFuPY4duT
mVAqjkRlv97hk7LMGhfUHQixc3ndvdQDH7XmiYY6S/OOZ191GVGpgPih53rjwkwcNBY8 sr/A==
Content-Type​: multipart/alternative;
boundary="000000000000bbb3900577657338"
X-Received​: by 2002​:a50​:ee19​:: with SMTP id
g25-v6mr7781707eds.66.1538652500635; Thu, 04 Oct 2018 04​:28​:20 -0700 (PDT)
X-PMX-Spam​: Gauge=IIIIIIII, Probability=8%, Report=' HTML_50_70 0.1,
HTML_NO_HTTP 0.1, BODYTEXTH_SIZE_10000_LESS 0, BODYTEXTP_SIZE_3000_LESS 0,
BODYTEXTP_SIZE_400_LESS 0, BODY_SIZE_1000_1099 0, BODY_SIZE_2000_LESS 0,
BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_ALIGNS 0, DKIM_SIGNATURE
0, NO_CTA_URI_FOUND 0, NO_URI_FOUND 0, NO_URI_HTTPS 0, SMALL_BODY 0,
SPF_PASS 0, WEBMAIL_SOURCE 0, __C230066_P5 0, __CT 0, __CTYPE_HAS_BOUNDARY
0, __CTYPE_MULTIPART 0, __CTYPE_MULTIPART_ALT 0, __DKIM_ALIGNS_1 0,
__DKIM_ALIGNS_2 0, __DQ_NEG_HEUR 0, __DQ_NEG_IP 0, __FRAUD_WEBMAIL 0,
__FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __FUR_RDNS_GMAIL 0, __HAS_FROM 0,
__HAS_HTML 0, __HAS_MSGID 0, __HELO_GMAIL 0, __HEX28_LC_BOUNDARY 0,
__HTML_TAG_DIV 0, __MIME_HTML 0, __MIME_TEXT_H 0, __MIME_TEXT_H1 0,
__MIME_TEXT_H2 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_TEXT_P2 0,
__MIME_VERSION 0, __PHISH_SPEAR_SUBJ_ALERT 0, __RDNS_WEBMAIL 0,
__RUS_OBFU_PHONE 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __SUBJ_ALPHA_S
TART 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __X_GOOGLE_DKIM_SIGNATURE 0,
__YOUTUBE_RCVD 0, __zen.spamhaus.org_ERROR '
X-RT-Interface​: Email

@p5pRT
Copy link
Author

p5pRT commented Oct 8, 2018

From @iabyn

On Fri, Oct 05, 2018 at 11​:22​:41AM +0530, Gururaj Kallur wrote​:

(stuff about 'use lib')

Can you run this one liner under both the good and bad AIX perls and show
us the output​:

  $ perl -le'use lib "/foo/bar"; print for @​INC'

--
Wesley Crusher gets beaten up by his classmates for being a smarmy git,
and consequently has a go at making some friends of his own age for a
change.
  -- Things That Never Happen in "Star Trek" #18

@p5pRT
Copy link
Author

p5pRT commented Oct 8, 2018

From gskallur@gmail.com

With Good Perl

-bash-4.2$ perl -v

This is perl 5, version 22, subversion 0 (v5.22.0) built for
aix-thread-multi-64all

Copyright 1987-2015, Larry Wall

Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http​://www.perl.org/, the Perl Home Page.

-bash-4.2$ perl -le'use lib "/foo/bar"; print for @​INC'
/foo/bar
/scratch/gkallur/perl522/lib/5.22.0/aix-thread-multi-64all
/scratch/gkallur/perl522/lib/5.22.0
/scratch/gkallur/perl522/lib
../lib/site_perl/5.22.0/aix-thread-multi-64all
../lib/site_perl/5.22.0
../lib/5.22.0/aix-thread-multi-64all
../lib/5.22.0
.

With Bad perl

-bash-4.2$ perl -v

This is perl 5, version 26, subversion 1 (v5.26.1) built for
aix-thread-multi-64all

Copyright 1987-2017, Larry Wall

Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http​://www.perl.org/, the Perl Home Page.

-bash-4.2$ perl -le'use lib "/foo/bar"; print for @​INC'
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all
/scratch/gkallur/perl/lib/5.26.1
/scratch/gkallur/perl/lib
../lib/site_perl/5.26.1/aix-thread-multi-64all
../lib/site_perl/5.26.1
../lib/5.26.1/aix-thread-multi-64all
../lib/5.26.1

On Mon, Oct 8, 2018 at 1​:10 PM Dave Mitchell <davem@​iabyn.com> wrote​:

On Fri, Oct 05, 2018 at 11​:22​:41AM +0530, Gururaj Kallur wrote​:

(stuff about 'use lib')

Can you run this one liner under both the good and bad AIX perls and show
us the output​:

$ perl \-le'use lib "/foo/bar"; print for @&#8203;INC'

--
Wesley Crusher gets beaten up by his classmates for being a smarmy git,
and consequently has a go at making some friends of his own age for a
change.
-- Things That Never Happen in "Star Trek" #18

@p5pRT
Copy link
Author

p5pRT commented Oct 8, 2018

From @iabyn

On Mon, Oct 08, 2018 at 01​:19​:37PM +0530, Gururaj Kallur wrote​:

With Bad perl

-bash-4.2$ perl -le'use lib "/foo/bar"; print for @​INC'
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all

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
  lib.pm /usr/lib64/perl5/lib.pm
  strict.pm /usr/share/perl5/strict.pm
  vars.pm /usr/share/perl5/vars.pm
  warnings.pm /usr/share/perl5/warnings.pm
warnings/register.pm /usr/share/perl5/warnings/register.pm

Then can you include a copy of the file listed for lib.pm for the bad
system; for example that would /usr/lib64/perl5/lib.pm on my system,
and should be about 200 lines long.

--
Wesley Crusher gets beaten up by his classmates for being a smarmy git,
and consequently has a go at making some friends of his own age for a
change.
  -- Things That Never Happen in "Star Trek" #18

@p5pRT
Copy link
Author

p5pRT commented Oct 8, 2018

From gskallur@gmail.com

Here 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{$_}
for sort keys %INC'
  Config.pm
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all/Config.pm
  lib.pm
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all/lib.pm
  strict.pm /scratch/gkallur/perl/lib/5.26.1/strict.pm
  vars.pm /scratch/gkallur/perl/lib/5.26.1/vars.pm
  warnings.pm /scratch/gkallur/perl/lib/5.26.1/warnings.pm
warnings/register.pm /scratch/gkallur/perl/lib/5.26.1/warnings/register.pm

-bash-4.2$ cat /scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all/
lib.pm | wc -l
  211

On Mon, Oct 8, 2018 at 1​:58 PM Dave Mitchell <davem@​iabyn.com> wrote​:

On Mon, Oct 08, 2018 at 01​:19​:37PM +0530, Gururaj Kallur wrote​:

With Bad perl

-bash-4.2$ perl -le'use lib "/foo/bar"; print for @​INC'
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all

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
          lib\.pm /usr/lib64/perl5/lib\.pm
       strict\.pm /usr/share/perl5/strict\.pm
         vars\.pm /usr/share/perl5/vars\.pm
     warnings\.pm /usr/share/perl5/warnings\.pm

warnings/register.pm /usr/share/perl5/warnings/register.pm

Then can you include a copy of the file listed for lib.pm for the bad
system; for example that would /usr/lib64/perl5/lib.pm on my system,
and should be about 200 lines long.

--
Wesley Crusher gets beaten up by his classmates for being a smarmy git,
and consequently has a go at making some friends of his own age for a
change.
-- Things That Never Happen in "Star Trek" #18

--
Thanks & Regards
Gururaj Kallur
Mobile​: 91-9845227154

@p5pRT
Copy link
Author

p5pRT commented Oct 8, 2018

From gskallur@gmail.com

lib.pm

@p5pRT
Copy link
Author

p5pRT commented Oct 8, 2018

From gskallur@gmail.com

There is not much difference between working and non-working perl lib.pm
files

-bash-4.2$ diff /scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all/
lib.pm /scratch/gkallur/perl522/lib/5.22.0/aix-thread-multi-64all/lib.pm
16c16
< our $VERSION = '0.64';


our $VERSION = '0.63';

On Mon, Oct 8, 2018 at 2​:22 PM Gururaj Kallur <gskallur@​gmail.com> wrote​:

Here 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{$_}
for sort keys %INC'
Config.pm
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all/Config.pm
lib.pm
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all/lib.pm
strict.pm /scratch/gkallur/perl/lib/5.26.1/strict.pm
vars.pm /scratch/gkallur/perl/lib/5.26.1/vars.pm
warnings.pm /scratch/gkallur/perl/lib/5.26.1/warnings.pm
warnings/register.pm /scratch/gkallur/perl/lib/5.26.1/warnings/register.pm

-bash-4.2$ cat /scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all/
lib.pm | wc -l
211

On Mon, Oct 8, 2018 at 1​:58 PM Dave Mitchell <davem@​iabyn.com> wrote​:

On Mon, Oct 08, 2018 at 01​:19​:37PM +0530, Gururaj Kallur wrote​:

With Bad perl

-bash-4.2$ perl -le'use lib "/foo/bar"; print for @​INC'
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all

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
          lib\.pm /usr/lib64/perl5/lib\.pm
       strict\.pm /usr/share/perl5/strict\.pm
         vars\.pm /usr/share/perl5/vars\.pm
     warnings\.pm /usr/share/perl5/warnings\.pm

warnings/register.pm /usr/share/perl5/warnings/register.pm

Then can you include a copy of the file listed for lib.pm for the bad
system; for example that would /usr/lib64/perl5/lib.pm on my system,
and should be about 200 lines long.

--
Wesley Crusher gets beaten up by his classmates for being a smarmy git,
and consequently has a go at making some friends of his own age for a
change.
-- Things That Never Happen in "Star Trek" #18

--
Thanks & Regards
Gururaj Kallur
Mobile​: 91-9845227154

--
Thanks & Regards
Gururaj Kallur
Mobile​: 91-9845227154

@p5pRT
Copy link
Author

p5pRT commented Oct 8, 2018

From @iabyn

On Mon, Oct 08, 2018 at 02​:22​:17PM +0530, Gururaj Kallur wrote​:

Here is the output and attached the lib.pm which is listed below

Thanks. What does this get you on the bad system​:

$ perl -le'unshift @​INC, "/foo/bar", @​INC; print for @​INC'

--
You never really learn to swear until you learn to drive.

@p5pRT
Copy link
Author

p5pRT commented Oct 8, 2018

From gskallur@gmail.com

-bash-4.2$ perl -le'unshift @​INC, "/foo/bar", @​INC; print for @​INC'
/foo/bar
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all
/scratch/gkallur/perl/lib/5.26.1
/scratch/gkallur/perl/lib
../lib/site_perl/5.26.1/aix-thread-multi-64all
../lib/site_perl/5.26.1
../lib/5.26.1/aix-thread-multi-64all
../lib/5.26.1
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all
/scratch/gkallur/perl/lib/5.26.1
/scratch/gkallur/perl/lib
../lib/site_perl/5.26.1/aix-thread-multi-64all
../lib/site_perl/5.26.1
../lib/5.26.1/aix-thread-multi-64all
../lib/5.26.1

On Mon, Oct 8, 2018 at 2​:56 PM Dave Mitchell <davem@​iabyn.com> wrote​:

On Mon, Oct 08, 2018 at 02​:22​:17PM +0530, Gururaj Kallur wrote​:

Here is the output and attached the lib.pm which is listed below

Thanks. What does this get you on the bad system​:

$ perl -le'unshift @​INC, "/foo/bar", @​INC; print for @​INC'

--
You never really learn to swear until you learn to drive.

@p5pRT
Copy link
Author

p5pRT commented Oct 8, 2018

From @iabyn

On Mon, Oct 08, 2018 at 03​:25​:30PM +0530, Gururaj Kallur wrote​:

-bash-4.2$ perl -le'unshift @​INC, "/foo/bar", @​INC; print for @​INC'
/foo/bar
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all
/scratch/gkallur/perl/lib/5.26.1
/scratch/gkallur/perl/lib
../lib/site_perl/5.26.1/aix-thread-multi-64all
../lib/site_perl/5.26.1
../lib/5.26.1/aix-thread-multi-64all
../lib/5.26.1
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all
/scratch/gkallur/perl/lib/5.26.1
/scratch/gkallur/perl/lib
../lib/site_perl/5.26.1/aix-thread-multi-64all
../lib/site_perl/5.26.1
../lib/5.26.1/aix-thread-multi-64all
../lib/5.26.1

Is that the exact output, with most of the lines duplicated, or was that a
cut+paste error?

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
the point where you will have to do some diagnosis of this yourself​:

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
at various points in the 'import' subroutine, to confirm that with
"use lib '/foo/bar'",
  * the expected lib.pm file is being loaded rather than some other
  version;
  * the import() sub from that file is being called, and with the
  expected arguments,
  * that import() is executing one or more of the lines which do
  * 'unshift @​INC, ...', and print the contents of @​INC just before
  and after such lines;
  * print the contents of @​INC just before import() returns.
  * etc
to try and work out what is happening.

--
The Enterprise successfully ferries an alien VIP from one place to another
without serious incident.
  -- Things That Never Happen in "Star Trek" #7

@p5pRT
Copy link
Author

p5pRT commented Oct 8, 2018

From @iabyn

On Mon, Oct 08, 2018 at 11​:37​:50PM +0200, Tomasz Konojacki wrote​:

Well, the lines were duplicated because @​INC was also passed as a part
of the LIST argument to unshift.

D'oh!

--
Fire extinguisher (n) a device for holding open fire doors.

@p5pRT
Copy link
Author

p5pRT commented Oct 8, 2018

From @xenu

On Mon, 8 Oct 2018 22​:13​:50 +0100
Dave Mitchell <davem@​iabyn.com> wrote​:

Is that the exact output, with most of the lines duplicated, or was that a
cut+paste error?

Well, the lines were duplicated because @​INC was also passed as a part
of the LIST argument to unshift.

@p5pRT
Copy link
Author

p5pRT commented Oct 9, 2018

From gskallur@gmail.com

For AIX and HPUX we need to set below variables for any version of perl.

export PERL5HOME=/scratch/gkallur/perl
export PERL_HOME=/scratch/gkallur/perl
export PERL5LIB=/scratch/gkallur/perl/lib
export PATH=/scratch/gkallur/perl/bin​:$PATH

Only PATH setting will not work on AIX and HPUX.

Here is the output perl -V

-bash-4.2$ perl -V
Summary of my perl5 (revision 5 version 26 subversion 1) configuration​:

  Platform​:
  osname=aix
  osvers=6.1.0.0
  archname=aix-thread-multi-64all
  uname='aix localhost 1 6 00f6e5954c00 '
  config_args='-Dprefix=/scratch/gkallur/perl
-Dcc=/usr/local/packages/vac_remote/13-dec2014/opt/IBM/xlC/13.1.0/bin/xlc_r
-Doptimize=-O -Dusethreads -Duseithreads -Duserelocatableinc -Uusemymalloc
-des -Acppflags=-D_ALL_SOURCE -D_THREAD_SAFE -DAIXRIOS -D_ANSI_C_SOURCE
-DPERL_USE_SAFE_PUTENV -D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias
-DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -I/usr/local/include -q64
-DUSE_64_BIT_ALL -qlanglvl=extended -Accflags=-D_ALL_SOURCE -D_THREAD_SAFE
-DAIXRIOS -D_ANSI_C_SOURCE -DPERL_USE_SAFE_PUTENV -D_POSIX_SOURCE
-qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT
-I/usr/local/include -q64 -DUSE_64_BIT_ALL -qlanglvl=extended
-Aldflags=-bexpall -b64 -brtl -Alddlflags=-b64 -bhalt​:4 -bexpall -G
-bnoentry -lpthreads -lc'
  hint=recommended
  useposix=true
  d_sigaction=define
  useithreads=define
  usemultiplicity=define
  use64bitint=define
  use64bitall=define
  uselongdouble=undef
  usemymalloc=n
  default_inc_excludes_dot=define
  bincompat5005=undef
  Compiler​:

cc='/usr/local/packages/vac_remote/13-dec2014/opt/IBM/xlC/13.1.0/bin/xlc_r
-q64'
  ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1
-qnoansialias -qlanglvl=extc99 -DUSE_NATIVE_DLOPEN -D_ALL_SOURCE
-D_THREAD_SAFE -DAIXRIOS -D_ANSI_C_SOURCE -DPERL_USE_SAFE_PUTENV
-D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN
-DNEED_PTHREAD_INIT -I/usr/local/include -q64 -DUSE_64_BIT_ALL
-qlanglvl=extended -DNEED_PTHREAD_INIT -I/usr/local/include -q64 -q64'
  optimize='-O'
  cppflags='-D_ALL_SOURCE -D_THREAD_SAFE -DAIXRIOS -D_ANSI_C_SOURCE
-DPERL_USE_SAFE_PUTENV -D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias
-DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -I/usr/local/include -q64
-DUSE_64_BIT_ALL -qlanglvl=extended'
  ccversion=''
  gccversion=''
  gccosandvers=''
  intsize=4
  longsize=8
  ptrsize=8
  doublesize=8
  byteorder=87654321
  doublekind=4
  d_longlong=define
  longlongsize=8
  d_longdbl=define
  longdblsize=8
  longdblkind=0
  ivtype='long'
  ivsize=8
  nvtype='double'
  nvsize=8
  Off_t='off_t'
  lseeksize=8
  alignbytes=8
  prototype=define
  Linker and Libraries​:
  ld='ld'
  ldflags ='-brtl -bdynamic -bexpall -b64 -brtl -L/usr/local/lib -b64'
  libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
  libs=-lpthread -lbind -lnsl -ldbm -ldl -lld -lm -lcrypt -lpthreads -lc
  perllibs=-lpthread -lbind -lnsl -ldl -lld -lm -lcrypt -lpthreads -lc
  libc=/lib/libc.a
  so=a
  useshrplib=false
  libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_aix.xs
  dlext=so
  d_dlsymun=undef
  ccdlflags=' -bE​:.../../lib/5.26.1/aix-thread-multi-64all/CORE/perl.exp'
  cccdlflags=' '
  lddlflags='-b64 -bhalt​:4 -G -bI​:$(PERL_INC)/perl.exp -bE​:$(BASEEXT).exp
-bnoentry -lpthreads -lc -lm -b64 -bhalt​:4 -bexpall -G -bnoentry -lpthreads
-lc -L/usr/local/lib'

Characteristics of this binary (from libperl)​:
  Compile-time options​:
  HAS_TIMES
  MULTIPLICITY
  PERLIO_LAYERS
  PERL_COPY_ON_WRITE
  PERL_DONT_CREATE_GVSV
  PERL_IMPLICIT_CONTEXT
  PERL_MALLOC_WRAP
  PERL_OP_PARENT
  PERL_PRESERVE_IVUV
  PERL_USE_SAFE_PUTENV
  USE_64_BIT_ALL
  USE_64_BIT_INT
  USE_ITHREADS
  USE_LARGE_FILES
  USE_LOCALE
  USE_LOCALE_COLLATE
  USE_LOCALE_CTYPE
  USE_LOCALE_NUMERIC
  USE_LOCALE_TIME
  USE_PERLIO
  USE_PERL_ATOF
  USE_REENTRANT_API
  Built under aix
  Compiled at Oct 3 2018 11​:50​:11
  %ENV​:
  PERL5HOME="/scratch/gkallur/perl"
  PERL5LIB="/scratch/gkallur/perl/lib"
  PERL_HOME="/scratch/gkallur/perl"
  @​INC​:
  /scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all
  /scratch/gkallur/perl/lib/5.26.1
  /scratch/gkallur/perl/lib
  ../lib/site_perl/5.26.1/aix-thread-multi-64all
  ../lib/site_perl/5.26.1
  ../lib/5.26.1/aix-thread-multi-64all
  ../lib/5.26.1

On Tue, Oct 9, 2018 at 3​:14 AM Dave Mitchell via RT <
perlbug-followup@​perl.org> wrote​:

On Mon, Oct 08, 2018 at 11​:37​:50PM +0200, Tomasz Konojacki wrote​:

Well, the lines were duplicated because @​INC was also passed as a part
of the LIST argument to unshift.

D'oh!

--
Fire extinguisher (n) a device for holding open fire doors.

@p5pRT
Copy link
Author

p5pRT commented Oct 9, 2018

From gskallur@gmail.com

Added print statements in in the 'import' subroutine of
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all/lib.pm
Here is the import subroutine with print statements

sub import {
  shift;

  my %names;
  print "**** Arguement passed : @​_";
  foreach (reverse @​_) {
  my $path = $_; # we'll be modifying it, so break the alias
  if ($path eq '') {
  require Carp;
  Carp​::carp("Empty compile time value given to use lib");
  }

  if ($path !~ /\.par$/i && -e $path && ! -d _) {
  require Carp;
  Carp​::carp("Parameter to use lib must be directory, not file");
  }
  unshift(@​INC, $path);
  print "**** After UNSHIFT in foreach loop : @​INC";
  # Add any previous version directories we found at configure time
  foreach my $incver (@​inc_version_list)
  {
  my $dir = "$path/$incver";
  unshift(@​INC, $dir) if -d $dir;
  }
  # Put a corresponding archlib directory in front of $path if it
  # looks like $path has an archlib directory below it.
  my($arch_auto_dir, $arch_dir, $version_dir, $version_arch_dir)
  = _get_dirs($path);
  unshift(@​INC, $arch_dir) if -d $arch_auto_dir;
  unshift(@​INC, $version_dir) if -d $version_dir;
  unshift(@​INC, $version_arch_dir) if -d $version_arch_dir;
  }
  print "**** After foreach loop : @​INC";

  # remove trailing duplicates
  @​INC = grep { ++$names{$_} == 1 } @​INC;
  print "**** Before return statement : @​INC";
  return;
}

And the output is

-bash-4.2$ perl -le'use lib "/foo/bar"; print for @​INC'
**** Arguement passed : /foo/bar
**** After foreach loop :
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all
/scratch/gkallur/perl/lib/5.26.1 /scratch/gkallur/perl/lib
../lib/site_perl/5.26.1/aix-thread-multi-64all ../lib/site_perl/5.26.1
../lib/5.26.1/aix-thread-multi-64all ../lib/5.26.1
**** Before return statement :
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all
/scratch/gkallur/perl/lib/5.26.1 /scratch/gkallur/perl/lib
../lib/site_perl/5.26.1/aix-thread-multi-64all ../lib/site_perl/5.26.1
../lib/5.26.1/aix-thread-multi-64all ../lib/5.26.1
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all
/scratch/gkallur/perl/lib/5.26.1
/scratch/gkallur/perl/lib
../lib/site_perl/5.26.1/aix-thread-multi-64all
../lib/site_perl/5.26.1
../lib/5.26.1/aix-thread-multi-64all
../lib/5.26.1

I found that it is not printing the print statement inside the foreach loop
( print "**** After UNSHIFT in foreach loop : @​INC"; )

@p5pRT
Copy link
Author

p5pRT commented Oct 9, 2018

From gskallur@gmail.com

It is not going inside foreach loop in import subroutine.
If I remove the "reverse" from the "foreach (reverse @​_) {" in import
subroutine
Then it is going inside the foreach loop. Here is the output after removing
"reverse" from foraeach

-bash-4.2$ perl -le'use lib "/foo/bar"; print for @​INC'
**** Arguement passed : /foo/bar
**** After UNSHIFT in foreach loop : /foo/bar
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all
/scratch/gkallur/perl/lib/5.26.1 /scratch/gkallur/perl/lib
../lib/site_perl/5.26.1/aix-thread-multi-64all ../lib/site_perl/5.26.1
../lib/5.26.1/aix-thread-multi-64all ../lib/5.26.1
**** After foreach loop : /foo/bar
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all
/scratch/gkallur/perl/lib/5.26.1 /scratch/gkallur/perl/lib
../lib/site_perl/5.26.1/aix-thread-multi-64all ../lib/site_perl/5.26.1
../lib/5.26.1/aix-thread-multi-64all ../lib/5.26.1
**** Before return statement : /foo/bar
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all
/scratch/gkallur/perl/lib/5.26.1 /scratch/gkallur/perl/lib
../lib/site_perl/5.26.1/aix-thread-multi-64all ../lib/site_perl/5.26.1
../lib/5.26.1/aix-thread-multi-64all ../lib/5.26.1
/foo/bar
/scratch/gkallur/perl/lib/5.26.1/aix-thread-multi-64all
/scratch/gkallur/perl/lib/5.26.1
/scratch/gkallur/perl/lib
../lib/site_perl/5.26.1/aix-thread-multi-64all
../lib/site_perl/5.26.1
../lib/5.26.1/aix-thread-multi-64all
../lib/5.26.1

@p5pRT
Copy link
Author

p5pRT commented Oct 9, 2018

From gskallur@gmail.com

Modified the import subroutine as below and is working fine. ( defined an
array my @​sd=reverse @​_; and used in foreach )
sub import {
  shift;

  my %names;
  print "**** Arguement passed : @​_";
  my @​sd=reverse @​_;
  foreach (@​sd) {
  my $path = $_; # we'll be modifying it, so break the alias
  if ($path eq '') {
  require Carp;
  Carp​::carp("Empty compile time value given to use lib");
  }

  if ($path !~ /\.par$/i && -e $path && ! -d _) {
  require Carp;
  Carp​::carp("Parameter to use lib must be directory, not file");
  }
  unshift(@​INC, $path);
  print "**** After UNSHIFT in foreach loop : @​INC";
  # Add any previous version directories we found at configure time
  foreach my $incver (@​inc_version_list)
  {
  my $dir = "$path/$incver";
  unshift(@​INC, $dir) if -d $dir;
  }
  # Put a corresponding archlib directory in front of $path if it
  # looks like $path has an archlib directory below it.
  my($arch_auto_dir, $arch_dir, $version_dir, $version_arch_dir)
  = _get_dirs($path);
  unshift(@​INC, $arch_dir) if -d $arch_auto_dir;
  unshift(@​INC, $version_dir) if -d $version_dir;
  unshift(@​INC, $version_arch_dir) if -d $version_arch_dir;
  }
  print "**** After foreach loop : @​INC";

  # remove trailing duplicates
  @​INC = grep { ++$names{$_} == 1 } @​INC;
  print "**** Before return statement : @​INC";
  return;
}

If reverse is inside the foreach then it is not working.

@p5pRT
Copy link
Author

p5pRT commented Oct 9, 2018

From @iabyn

On Tue, Oct 09, 2018 at 12​:50​:16PM +0530, Gururaj Kallur wrote​:

If reverse is inside the foreach then it is not working.

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");'
  [/foo/bar]
  $

--
Diplomacy is telling someone to go to hell in such a way that they'll
look forward to the trip

@p5pRT
Copy link
Author

p5pRT commented Oct 9, 2018

From gskallur@gmail.com

No output for the line

-bash-4.2$ perl -le 'sub f { for (reverse @​_) { print "[$_]" } }
f("/foo/bar");'
-bash-4.2$

I have written small code to test the reverse behaviour.
Here is the file reverse.pl
-bash-4.2$ cat reverse.pl
#!/usr/bin/env perl
use strict;
use warnings;
use 5.26.1;

my @​words = qw(Foo Bar Moo);
my @​sdrow = reverse @​words;

foreach (@​sdrow){
print "$_\n";
}
-bash-4.2$ perl reverse.pl
Moo
Bar
Foo

After changing the foreach loop as below

-bash-4.2$ cat reverse.pl
#!/usr/bin/env perl
use strict;
use warnings;
use 5.26.1;

my @​words = qw(Foo Bar Moo);
my @​sdrow = reverse @​words;

foreach (reverse @​words){
print "$_\n";
}
-bash-4.2$ perl reverse.pl
-bash-4.2$

No output

@p5pRT
Copy link
Author

p5pRT commented Oct 9, 2018

From @iabyn

On Tue, Oct 09, 2018 at 02​:24​:56PM +0530, Gururaj Kallur wrote​:

No output

Thanks.

So,
1) can you show me the output of

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
optimisation disabled and debugging symbols enabled, and to single step
through a C function in the perl src using a debugger like gdb?

The building would involve adding the '-DDEBUGGING' switch to the
./Configure command line in addition to any usual switches.

--
In England there is a special word which means the last sunshine
of the summer. That word is "spring".

@p5pRT
Copy link
Author

p5pRT commented Oct 9, 2018

From gskallur@gmail.com

-bash-4.2$ perl -MO=Concise -e' for (reverse @​a) { print }'
g <@​> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e​:1) v​:{ ->3
f <2> leaveloop vK/2 ->g
7 <{> enteriter(next->c last->f redo->8) vKS/DEF,REVERSED ->d
- <0> ex-pushmark s ->3
- <1> ex-list lKM ->6
3 <0> pushmark s ->4
- <1> ex-reverse lKM/1 ->-
- <0> ex-pushmark s ->4
5 <1> rv2av[t2] sKR/1 ->6
4 <#> gv[*a] s ->5
6 <#> gv[*_] s ->7
- <1> null vK/1 ->f
e <|> and(other->8) vK/1 ->f
d <0> iter s/REVERSED ->e
- <@​> lineseq vK ->-
8 <;> nextstate(main 3 -e​:1) v ->9
b <@​> print vK ->c
9 <0> pushmark s ->a
- <1> ex-rv2sv sK/1 ->b
a <#> gvsv[*_] s ->b
c <0> unstack v ->d
-e syntax OK

I will try to build with the debug options. Give me some time. Once done
will let you know

@p5pRT
Copy link
Author

p5pRT commented Oct 9, 2018

From gskallur@gmail.com

Compiled perl with -DDEBUGGING and optimisation disabled and debugging
symbols enabled

here is the perl -V output

-bash-4.2$ perl -V
Summary of my perl5 (revision 5 version 26 subversion 1) configuration​:

  Platform​:
  osname=aix
  osvers=6.1.0.0
  archname=aix-thread-multi-64all
  uname='aix localhost 1 6 00f6e5954c00 '
  config_args='-Dprefix=/scratch/gkallur/perl_debug/perl
-Dcc=/usr/local/packages/vac_remote/13-dec2014/opt/IBM/xlC/13.1.0/bin/xlc_r
-Dusethreads -DDEBUGGING -Duseithreads -Duserelocatableinc -Uusemymalloc
-des -Acppflags=-D_ALL_SOURCE -D_THREAD_SAFE -DAIXRIOS -D_ANSI_C_SOURCE
-DPERL_USE_SAFE_PUTENV -D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias
-DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -I/usr/local/include -q64
-DUSE_64_BIT_ALL -qlanglvl=extended -Accflags=-D_ALL_SOURCE -D_THREAD_SAFE
-DAIXRIOS -D_ANSI_C_SOURCE -DPERL_USE_SAFE_PUTENV -D_POSIX_SOURCE
-qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT
-I/usr/local/include -q64 -DUSE_64_BIT_ALL -qlanglvl=extended
-Aldflags=-bexpall -b64 -brtl -Alddlflags=-b64 -bhalt​:4 -bexpall -G
-bnoentry -lpthreads -lc'
  hint=recommended
  useposix=true
  d_sigaction=define
  useithreads=define
  usemultiplicity=define
  use64bitint=define
  use64bitall=define
  uselongdouble=undef
  usemymalloc=n
  default_inc_excludes_dot=define
  bincompat5005=undef
  Compiler​:

cc='/usr/local/packages/vac_remote/13-dec2014/opt/IBM/xlC/13.1.0/bin/xlc_r
-q64'
  ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1
-qnoansialias -qlanglvl=extc99 -DUSE_NATIVE_DLOPEN -D_ALL_SOURCE
-D_THREAD_SAFE -DAIXRIOS -D_ANSI_C_SOURCE -DPERL_USE_SAFE_PUTENV
-D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN
-DNEED_PTHREAD_INIT -I/usr/local/include -q64 -DUSE_64_BIT_ALL
-qlanglvl=extended -DNEED_PTHREAD_INIT -DDEBUGGING -I/usr/local/include
-q64 -q64'
  optimize='-O -g'
  cppflags='-D_ALL_SOURCE -D_THREAD_SAFE -DAIXRIOS -D_ANSI_C_SOURCE
-DPERL_USE_SAFE_PUTENV -D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias
-DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -I/usr/local/include -q64
-DUSE_64_BIT_ALL -qlanglvl=extended'
  ccversion=''
  gccversion=''
  gccosandvers=''
  intsize=4
  longsize=8
  ptrsize=8
  doublesize=8
  byteorder=87654321
  doublekind=4
  d_longlong=define
  longlongsize=8
  d_longdbl=define
  longdblsize=8
  longdblkind=0
  ivtype='long'
  ivsize=8
  nvtype='double'
  nvsize=8
  Off_t='off_t'
  lseeksize=8
  alignbytes=8
  prototype=define
  Linker and Libraries​:
  ld='ld'
  ldflags ='-brtl -bdynamic -bexpall -b64 -brtl -L/usr/local/lib -b64'
  libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
  libs=-lpthread -lbind -lnsl -ldbm -ldl -lld -lm -lcrypt -lpthreads -lc
  perllibs=-lpthread -lbind -lnsl -ldl -lld -lm -lcrypt -lpthreads -lc
  libc=/lib/libc.a
  so=a
  useshrplib=false
  libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_aix.xs
  dlext=so
  d_dlsymun=undef
  ccdlflags=' -bE​:.../../lib/5.26.1/aix-thread-multi-64all/CORE/perl.exp'
  cccdlflags=' '
  lddlflags='-b64 -bhalt​:4 -G -bI​:$(PERL_INC)/perl.exp -bE​:$(BASEEXT).exp
-bnoentry -lpthreads -lc -lm -b64 -bhalt​:4 -bexpall -G -bnoentry -lpthreads
-lc -L/usr/local/lib'

Characteristics of this binary (from libperl)​:
  Compile-time options​:
  DEBUGGING
  HAS_TIMES
  MULTIPLICITY
  PERLIO_LAYERS
  PERL_COPY_ON_WRITE
  PERL_DONT_CREATE_GVSV
  PERL_IMPLICIT_CONTEXT
  PERL_MALLOC_WRAP
  PERL_OP_PARENT
  PERL_PRESERVE_IVUV
  PERL_TRACK_MEMPOOL
  PERL_USE_SAFE_PUTENV
  USE_64_BIT_ALL
  USE_64_BIT_INT
  USE_ITHREADS
  USE_LARGE_FILES
  USE_LOCALE
  USE_LOCALE_COLLATE
  USE_LOCALE_CTYPE
  USE_LOCALE_NUMERIC
  USE_LOCALE_TIME
  USE_PERLIO
  USE_PERL_ATOF
  USE_REENTRANT_API
  Built under aix
  Compiled at Oct 9 2018 04​:35​:18
  %ENV​:
  PERL5HOME="/scratch/gkallur/perl_debug/perl"
  PERL5LIB="/scratch/gkallur/perl_debug/perl/lib"
  PERL_HOME="/scratch/gkallur/perl_debug/perl"
  @​INC​:
  /scratch/gkallur/perl_debug/perl/lib/5.26.1/aix-thread-multi-64all
  /scratch/gkallur/perl_debug/perl/lib/5.26.1
  /scratch/gkallur/perl_debug/perl/lib
  ../lib/site_perl/5.26.1/aix-thread-multi-64all
  ../lib/site_perl/5.26.1
  ../lib/5.26.1/aix-thread-multi-64all
  ../lib/5.26.1

@p5pRT
Copy link
Author

p5pRT commented Oct 9, 2018

From @iabyn

On Tue, Oct 09, 2018 at 05​:27​:29PM +0530, Gururaj Kallur wrote​:

Compiled perl with -DDEBUGGING and optimisation disabled and debugging
symbols enabled

Ok thanks. Run this and show me the output​:

$ perl -Dst -le '@​a = qw(/foo/bar); for (reverse @​a) { print }'

EXECUTING...

  =>
(-e​:0) enter
  =>
(-e​:0) nextstate
  =>
(-e​:1) pushmark
  => *
(-e​:1) const(PV("/foo/bar"\0))
  => * PV("/foo/bar"\0)
(-e​:1) pushmark
  => * PV("/foo/bar"\0) *
(-e​:1) gv(main​::a)
  => * PV("/foo/bar"\0) * GV()
(-e​:1) rv2av
  => * PV("/foo/bar"\0) * AV()
(-e​:1) aassign
  =>
(-e​:1) nextstate
  =>
(-e​:1) pushmark
  => *
(-e​:1) gv(main​::a)
  => * GV()
(-e​:1) rv2av
  => * AV()
(-e​:1) gv(main​::_)
  => * AV() GV()
(-e​:1) enteriter
  =>
(-e​:1) iter
  =>
(-e​:1) nextstate
  =>
(-e​:1) pushmark
  => *
(-e​:1) gvsv(main​::_)
  => * PV("/foo/bar"\0)
(-e​:1) print
/foo/bar
  => SV_YES
(-e​:1) unstack
  =>
(-e​:1) iter
  => SV_NO
(-e​:1) leaveloop
  =>
(-e​:1) leave

--
I took leave and went to hear Mrs Turner's daughter play on the harpsicon,
but Lord, it was enough to make any man sick to hear her; yet I was forced
to commend her highly.
  -- The Diary of Samuel Pepys, 1 May 1663

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2018

From @iabyn

On Tue, Oct 16, 2018 at 12​:32​:01PM +0530, Gururaj Kallur wrote​:

Applied the patch and recompiled the perl.
Here is the output

-bash-4.2$ ./perl -Dq -le '@​a = qw(/foo/bar); for (reverse @​a) { print }'
goto retno

Err, that wasn't a cut'n'paste error was it? Are you absolutely sure that
there weren't a couple of line of output before the 'goto retno', along
the lines of​:

  CXt_LOOP_ARY​:
  inc=-1; ix=-1; fill=0
  inc>0​: 0; ix>fill​: 0; ix<0​: 1

failing that, are you absolutely sure that the patch was applied
correctly?

--
Art is anything that has a label (especially if the label is "untitled 1")

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2018

From gskallur@gmail.com

Better to attach full file pp_hot.c and I will replace and recompile it
once again.
Please send me full file with debugging statements. I am recompiling perl
one more time with patch

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2018

From @iabyn

On Tue, Oct 16, 2018 at 01​:07​:59PM +0530, Gururaj Kallur wrote​:

Better to attach full file pp_hot.c and I will replace and recompile it
once again.
Please send me full file with debugging statements. I am recompiling perl
one more time with patch

Attached is a modified pp_hot.c against release 5.26.0.

--
Fire extinguisher (n) a device for holding open fire doors.

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2018

From @iabyn

pp_hot.c

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2018

From gskallur@gmail.com

Thanks,

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​:
inc=4294967295; ix=4294967296; fill=0
inc>0​: 1; ix>fill​: 1; ix<0​: 0
goto retno

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2018

From @craigberry

On Mon, Oct 15, 2018 at 12​:36 AM Gururaj Kallur <gskallur@​gmail.com> wrote​:

-bash-4.2$ ./perl -Ilib Porting/expand-macro.pl UNLIKELY
Can't open perl script "Porting/expand-macro.pl"​: A file or directory in the path name does not exist.

Sorry, I didn't mention that this has to be run from the top level of
your Perl build directory after Perl is built. I don't expect it to
reveal much, but this macro is involved in the if statement that
determines whether "goto retno" gets run, so it seems worth knowing
exactly how it expands on the problem system.

On Sat, Oct 13, 2018 at 7​:33 AM Craig A. Berry <craig.a.berry@​gmail.com> wrote​:

On Thu, Oct 11, 2018 at 2​:31 AM Gururaj Kallur <gskallur@​gmail.com> wrote​:

Not able to proceed with gdb. Any suggestion

What does the UNLIKELY macro expand to? Check like so​:

$ ./perl -Ilib Porting/expand-macro.pl UNLIKELY

--
Thanks & Regards
Gururaj Kallur
Mobile​: 91-9845227154

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2018

From @iabyn

On Tue, Oct 16, 2018 at 03​:10​:14PM +0530, Gururaj Kallur wrote​:

Thanks,

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​:
inc=4294967295; ix=4294967296; fill=0
inc>0​: 1; ix>fill​: 1; ix<0​: 0
goto retno

Thanks. What's the full output of

  ./perl -Ilib -V

in the build directory of that debugging perl?

--
It's not that I'm afraid to die, I just don't want to be there when it
happens.
  -- Woody Allen

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2018

From gskallur@gmail.com

-bash-4.2$ ./perl -Ilib -V
Summary of my perl5 (revision 5 version 26 subversion 1) configuration​:

  Platform​:
  osname=aix
  osvers=6.1.0.0
  archname=aix-thread-multi-64all
  uname='aix localhost 1 6 00f6e5954c00 '
  config_args='-Dprefix=/scratch/gkallur/perl_debug/perl
-Dcc=/usr/local/packages/vac_remote/13-dec2014/opt/IBM/xlC/13.1.0/bin/xlc_r
-DDEBUGGING -Dusethreads -Duseithreads -Duserelocatableinc -Uusemymalloc
-des -Acppflags=-D_ALL_SOURCE -D_THREAD_SAFE -DAIXRIOS -D_ANSI_C_SOURCE
-DPERL_USE_SAFE_PUTENV -D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias
-DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -I/usr/local/include -q64
-DUSE_64_BIT_ALL -qlanglvl=extended -Accflags=-D_ALL_SOURCE -D_THREAD_SAFE
-DAIXRIOS -D_ANSI_C_SOURCE -DPERL_USE_SAFE_PUTENV -D_POSIX_SOURCE
-qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT
-I/usr/local/include -q64 -DUSE_64_BIT_ALL -qlanglvl=extended
-Aldflags=-bexpall -b64 -brtl -Alddlflags=-b64 -bhalt​:4 -bexpall -G
-bnoentry -lpthreads -lc'
  hint=recommended
  useposix=true
  d_sigaction=define
  useithreads=define
  usemultiplicity=define
  use64bitint=define
  use64bitall=define
  uselongdouble=undef
  usemymalloc=n
  default_inc_excludes_dot=define
  bincompat5005=undef
  Compiler​:

cc='/usr/local/packages/vac_remote/13-dec2014/opt/IBM/xlC/13.1.0/bin/xlc_r
-q64'
  ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1
-qnoansialias -qlanglvl=extc99 -DUSE_NATIVE_DLOPEN -D_ALL_SOURCE
-D_THREAD_SAFE -DAIXRIOS -D_ANSI_C_SOURCE -DPERL_USE_SAFE_PUTENV
-D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN
-DNEED_PTHREAD_INIT -I/usr/local/include -q64 -DUSE_64_BIT_ALL
-qlanglvl=extended -DNEED_PTHREAD_INIT -DDEBUGGING -I/usr/local/include
-q64 -q64'
  optimize='-O -g'
  cppflags='-D_ALL_SOURCE -D_THREAD_SAFE -DAIXRIOS -D_ANSI_C_SOURCE
-DPERL_USE_SAFE_PUTENV -D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias
-DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -I/usr/local/include -q64
-DUSE_64_BIT_ALL -qlanglvl=extended'
  ccversion=''
  gccversion=''
  gccosandvers=''
  intsize=4
  longsize=8
  ptrsize=8
  doublesize=8
  byteorder=87654321
  doublekind=4
  d_longlong=define
  longlongsize=8
  d_longdbl=define
  longdblsize=8
  longdblkind=0
  ivtype='long'
  ivsize=8
  nvtype='double'
  nvsize=8
  Off_t='off_t'
  lseeksize=8
  alignbytes=8
  prototype=define
  Linker and Libraries​:
  ld='ld'
  ldflags ='-brtl -bdynamic -bexpall -b64 -brtl -L/usr/local/lib -b64'
  libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
  libs=-lpthread -lbind -lnsl -ldbm -ldl -lld -lm -lcrypt -lpthreads -lc
  perllibs=-lpthread -lbind -lnsl -ldl -lld -lm -lcrypt -lpthreads -lc
  libc=/lib/libc.a
  so=a
  useshrplib=false
  libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_aix.xs
  dlext=so
  d_dlsymun=undef
  ccdlflags=' -bE​:.../../lib/5.26.1/aix-thread-multi-64all/CORE/perl.exp'
  cccdlflags=' '
  lddlflags='-b64 -bhalt​:4 -G -bI​:$(PERL_INC)/perl.exp -bE​:$(BASEEXT).exp
-bnoentry -lpthreads -lc -lm -b64 -bhalt​:4 -bexpall -G -bnoentry -lpthreads
-lc -L/usr/local/lib'

Characteristics of this binary (from libperl)​:
  Compile-time options​:
  DEBUGGING
  HAS_TIMES
  MULTIPLICITY
  PERLIO_LAYERS
  PERL_COPY_ON_WRITE
  PERL_DONT_CREATE_GVSV
  PERL_IMPLICIT_CONTEXT
  PERL_MALLOC_WRAP
  PERL_OP_PARENT
  PERL_PRESERVE_IVUV
  PERL_TRACK_MEMPOOL
  PERL_USE_SAFE_PUTENV
  USE_64_BIT_ALL
  USE_64_BIT_INT
  USE_ITHREADS
  USE_LARGE_FILES
  USE_LOCALE
  USE_LOCALE_COLLATE
  USE_LOCALE_CTYPE
  USE_LOCALE_NUMERIC
  USE_LOCALE_TIME
  USE_PERLIO
  USE_PERL_ATOF
  USE_REENTRANT_API
  Built under aix
  Compiled at Oct 16 2018 02​:28​:20
  %ENV​:
  PERL5HOME="/scratch/gkallur/perl_debug/perl"
  PERL5LIB="/scratch/gkallur/perl_debug/perl/lib"
  PERL_HOME="/scratch/gkallur/perl_debug/perl"
  @​INC​:
  lib
  /scratch/gkallur/perl_debug/perl/lib/5.26.1/aix-thread-multi-64all
  /scratch/gkallur/perl_debug/perl/lib/5.26.1
  /scratch/gkallur/perl_debug/perl/lib
  ./../lib/site_perl/5.26.1/aix-thread-multi-64all
  ./../lib/site_perl/5.26.1
  ./../lib/5.26.1/aix-thread-multi-64all
  ./../lib/5.26.1

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2018

From @iabyn

On Tue, Oct 16, 2018 at 05​:58​:33PM +0530, Gururaj Kallur wrote​:

-bash-4.2$ ./perl -Ilib -V
Summary of my perl5 (revision 5 version 26 subversion 1) configuration​:

And for the final piece of the jigsaw, can you run this command​:

  $ grep U8TYPE config.h handy.h

--
Monto Blanco... scorchio!

@p5pRT
Copy link
Author

p5pRT commented Oct 17, 2018

From gskallur@gmail.com

-bash-4.2$ pwd
/scratch/gkallur/perl_debug/perl/lib/5.26.1/aix-thread-multi-64all/CORE
-bash-4.2$ grep U8TYPE config.h handy.h
config.h​:/* U8TYPE​:
config.h​:#define U8TYPE unsigned char /**/
handy.h​:typedef U8TYPE U8;

@p5pRT
Copy link
Author

p5pRT commented Oct 17, 2018

From @Tux

On Tue, 9 Oct 2018 11​:04​:41 +0530, Gururaj Kallur <gskallur@​gmail.com>
wrote​:

cc='/usr/local/packages/vac_remote/13-dec2014/opt/IBM/xlC/13.1.0/bin/xlc_r
-q64'
ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1
-qnoansialias -qlanglvl=extc99 -DUSE_NATIVE_DLOPEN -D_ALL_SOURCE
-D_THREAD_SAFE -DAIXRIOS -D_ANSI_C_SOURCE -DPERL_USE_SAFE_PUTENV
-D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN
-DNEED_PTHREAD_INIT -I/usr/local/include -q64 -DUSE_64_BIT_ALL
-qlanglvl=extended -DNEED_PTHREAD_INIT -I/usr/local/include -q64 -q64'
optimize='-O'
cppflags='-D_ALL_SOURCE -D_THREAD_SAFE -DAIXRIOS -D_ANSI_C_SOURCE
-DPERL_USE_SAFE_PUTENV -D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias
-DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -I/usr/local/include -q64
-DUSE_64_BIT_ALL -qlanglvl=extended'
ccversion=''
gccversion=''

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
instead of setting your $PATH to include the xlc_r location

1. Do you have /etc/vac.cfg.131 (or alike)
2. Do you (also) have other versions of xlc installed?

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)
xlc_r​: use = DEFLT_C
  crt = /lib/crt0.o
  mcrt = /lib/mcrt0.o
  gcrt = /lib/gcrt0.o
  libraries = -L/usr/vac/lib,-lxlopt,-lxlipa,-lxl,-lpthreads,-lc
  proflibs = -L/lib/profiled,-L/usr/lib/profiled
  hdlibs = -L/usr/vac/lib,-lhmd
  options = -qlanglvl=extc99,-qcpluscmt,-qkeyword=inline,-qalias=ansi,-qthreaded,-D_THREAD_SAFE,-D__VACPP_MULTI__

As you can see, there are "hidden" options that do not show in -V

--
H.Merijn Brand http​://tux.nl Perl Monger http​://amsterdam.pm.org/
using perl5.00307 .. 5.29 porting perl5 on HP-UX, AIX, and openSUSE
http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org/
http​://qa.perl.org http​://www.goldmark.org/jeff/stupid-disclaimers/

@p5pRT
Copy link
Author

p5pRT commented Oct 17, 2018

From @Tux

On Wed, 17 Oct 2018 09​:13​:19 +0200, "H.Merijn Brand"
<h.m.brand@​xs4all.nl> wrote​:

ccversion=''
gccversion=''  

I find it weird that it did not detect your ccversion

These methods are currently used​:

$ lslpp -ql -Ou vac.C | grep -v '^Path' | head -1
  vac.C 12.1.0.12 COMMITTED IBM XL C Compiler

$ lslpp -L | grep 'C for AIX Compiler$'
  vac.msg.en_US.C 12.1.0.12 C F XL 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
  Version​: 12.01.0000.0012

$ strings `which xlc_r` | grep -i version​: | sort -u
@​(#) Version​: 12.01.0000.0012
Version​: 12.01.0000.0012

$ gxlc --version
IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72)
Version​: 12.01.0000.0012

(note that my vac/gxlc does not know about -dumpversion)

--
H.Merijn Brand http​://tux.nl Perl Monger http​://amsterdam.pm.org/
using perl5.00307 .. 5.29 porting perl5 on HP-UX, AIX, and openSUSE
http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org/
http​://qa.perl.org http​://www.goldmark.org/jeff/stupid-disclaimers/

@p5pRT
Copy link
Author

p5pRT commented Oct 17, 2018

From gskallur@gmail.com

I have used same configuration options to compile perl 5.14.4, 5.22.0 and
5.16.1.

I could not see issue in 5.14.4, 5.22.0. They are working fine.

@p5pRT
Copy link
Author

p5pRT commented Oct 17, 2018

From gskallur@gmail.com

Sorry its typo.

The configuration options used to compile perl 5.14.4, 5.22.0 and 5.26.1
are same.

I could not see issue in 5.14.4, 5.22.0. They are working fine.

@p5pRT
Copy link
Author

p5pRT commented Oct 17, 2018

From @iabyn

On Wed, Oct 17, 2018 at 01​:41​:04PM +0530, Gururaj Kallur wrote​:

Sorry its typo.

The configuration options used to compile perl 5.14.4, 5.22.0 and 5.26.1
are same.

I could not see issue in 5.14.4, 5.22.0. They are working fine.

I *think* its a C compiler bug relating to integer conversions and
promotions (but I've never fully understood them so I can't be sure).

In pp_hot.c, can you change the line which is two lines above the first
'DEBUG_q' line from

  inc = 1 - (PL_op->op_private & OPpITER_REVERSED);
to
  inc = (IV)1 - (IV)(PL_op->op_private & OPpITER_REVERSED);

recompile, and see what

  ./perl -Dq -le '@​a = qw(/foo/bar); for (reverse @​a) { print }'

gives you.

--
"Emacs isn't a bad OS once you get used to it.
It just lacks a decent editor."

@p5pRT
Copy link
Author

p5pRT commented Oct 17, 2018

From gskallur@gmail.com

After replacing the line, here is the output

-bash-4.2$ ./perl -Dq -le '@​a = qw(/foo/bar); for (reverse @​a) { print }'

CXt_LOOP_ARY​:
inc=-1; ix=0; fill=0
inc>0​: 0; ix>fill​: 0; ix<0​: 0
/foo/bar

CXt_LOOP_ARY​:
inc=-1; ix=-1; fill=0
inc>0​: 0; ix>fill​: 0; ix<0​: 1
goto retno

@p5pRT
Copy link
Author

p5pRT commented Oct 17, 2018

From @iabyn

On Wed, Oct 17, 2018 at 03​:39​:08PM +0530, Gururaj Kallur wrote​:

After replacing the line, here is the output

-bash-4.2$ ./perl -Dq -le '@​a = qw(/foo/bar); for (reverse @​a) { print }'

CXt_LOOP_ARY​:
inc=-1; ix=0; fill=0
inc>0​: 0; ix>fill​: 0; ix<0​: 0
/foo/bar

CXt_LOOP_ARY​:
inc=-1; ix=-1; fill=0
inc>0​: 0; ix>fill​: 0; ix<0​: 1
goto retno

I've now pushed the following commit to blead. It is suitable for
packporting to any perl >= 5.24.

commit d6139ec
Author​: David Mitchell <davem@​iabyn.com>
AuthorDate​: Wed Oct 17 15​:10​:10 2018 +0100
Commit​: David Mitchell <davem@​iabyn.com>
CommitDate​: Wed Oct 17 15​:10​:10 2018 +0100

  fix 'for reverse @​array' bug on AIX
 
  RT #133558
 
  Due to what appears to be a compiler bug on AIX (or perhaps it's
  undefined behaviour which happens to work on other platforms), this line
  of code in pp_iter()​:
 
  inc = 1 - (PL_op->op_private & OPpITER_REVERSED);
 
  was setting inc to 4294967295 rather than to the expected -1 (inc was a
  64-bit signed long).
 
  Fix it with a couple of judicious (IV) casts (which ought to be a NOOP).

--
Technology is dominated by two types of people​: those who understand what
they do not manage, and those who manage what they do not understand.

@p5pRT
Copy link
Author

p5pRT commented Oct 18, 2018

From gskallur@gmail.com

From where Can I download the patch.

@p5pRT
Copy link
Author

p5pRT commented Oct 22, 2018

From @iabyn

On Thu, Oct 18, 2018 at 11​:06​:56AM +0530, Gururaj Kallur wrote​:

From where Can I download the patch.

The raw patch can be found here​:

https://perl5.git.perl.org/perl.git/patch/d6139ec4a9065ae249ab512398326a70dfb2fea2

--
"Emacs isn't a bad OS once you get used to it.
It just lacks a decent editor."

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2018

From @tonycoz

On Wed, 17 Oct 2018 22​:37​:32 -0700, gskallur@​gmail.com wrote​:

From where Can I download the patch.

Did Dave's patch solve the problem for you?

Tony

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2018

From gskallur@gmail.com

Yes. Now it's working fine on AIX. Also tried it on Linux. It's working
fine in Linux also.

On Thu, 13 Dec 2018, 5​:26 am Tony Cook via RT <perlbug-followup@​perl.org
wrote​:

On Wed, 17 Oct 2018 22​:37​:32 -0700, gskallur@​gmail.com wrote​:

From where Can I download the patch.

Did Dave's patch solve the problem for you?

Tony

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2018

From @tonycoz

On Wed, 12 Dec 2018 19​:14​:27 -0800, gskallur@​gmail.com wrote​:

Yes. Now it's working fine on AIX. Also tried it on Linux. It's working
fine in Linux also.

On Thu, 13 Dec 2018, 5​:26 am Tony Cook via RT <perlbug-followup@​perl.org
wrote​:

On Wed, 17 Oct 2018 22​:37​:32 -0700, gskallur@​gmail.com wrote​:

From where Can I download the patch.

Did Dave's patch solve the problem for you?

Tony

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

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2018

@tonycoz - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented Dec 15, 2018

From @Leont

On Mon, Oct 22, 2018 at 11​:49 AM Dave Mitchell <davem@​iabyn.com> wrote​:

On Thu, Oct 18, 2018 at 11​:06​:56AM +0530, Gururaj Kallur wrote​:

From where Can I download the patch.

The raw patch can be found here​:

https://perl5.git.perl.org/perl.git/patch/d6139ec4a9065ae249ab512398326a70dfb2fea2

The existing code is far too "smart" for its own good. I think we're
much better off rewriting it to something more obvious like attached.

Leon

@p5pRT
Copy link
Author

p5pRT commented Dec 15, 2018

From @Leont

0001-Don-t-be-smart-with-OPpITER_REVERSED.patch
From 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

@p5pRT
Copy link
Author

p5pRT commented Dec 16, 2018

From @iabyn

On Sat, Dec 15, 2018 at 11​:14​:31PM +0100, Leon Timmermans wrote​:

The existing code is far too "smart" for its own good. I think we're
much better off rewriting it to something more obvious like attached.

- 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;

The existing code is specifically written to avoid a branch (and thus a
possible CPU stall point) in a very hot bit of code. There are comments
directly above the line explaining what it does, and an assertion.
The fact that it failed due to a compiler bug shouldn't be a reason to
eliminate it.

--
The warp engines start playing up a bit, but seem to sort themselves out
after a while without any intervention from boy genius Wesley Crusher.
  -- Things That Never Happen in "Star Trek" #17

@p5pRT
Copy link
Author

p5pRT commented May 22, 2019

From @khwilliamson

Thank 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
resolved.

Perl 5.30.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.30.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT
Copy link
Author

p5pRT commented May 22, 2019

@khwilliamson - Status changed from 'pending release' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant