View Issue Details

IDProjectCategoryView StatusLast Update
0000515Perl for OS/2Bugpublic2012-06-11 00:26
ReportershmuelAssigned To 
Status newResolutionopen 
PlatformAMD dual coreOSeComStationOS Version2.0 GA
Summary0000515: Perl 5.14.2 is truncating path names in @ISA
DescriptionPerl scripts terminate with the error message

Can't locate in @INC (@INC contains: F:\Perl5\lib F:/Perl5/lib/si
rl/5.14.2/o F:/Perl5/lib/site_perl/5.14 F:/Perl5/lib/5.14.2/o F:/Perl5/lib/
F:/Perl5/lib/site_pe .).
Steps To ReproduceNote: I have 4.14.2 installed in F:\Perl5

SET MAKESHELL=F:\Perl5\bin\sh.exe
SET MANPATH=F:\Perl5\man
SET PERLLIB=F:\Perl5\lib
SET PERL_SH_DIR=F:/Perl5/bin

[h:\]perl -v

This is perl 5, version 14, subversion 2 (v5.14.2) built for os2

Copyright 1987-2011, Larry Wall

OS/2 port Copyright (c) 1990, 1991, Raymond Chen, Kai Uwe Rommel
Version 5 port Copyright (c) 1994-2002, Andreas Kaiser, Ilya Zakharevich
Version 5.8.8+ ports Copyright (c) 2007-2012, Paul Smedley, Knut St. Osmundsen

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, the Perl Home Page.

[h:\]perl -V
Can't locate in @INC (@INC contains: F:\Perl5\lib F:/Perl5/lib/site_perl/5.14.2/o F:/Perl5/lib/site_perl/5.14 F:/Perl5/lib/5.14.2/o F:/Perl5/lib/5.14 F:/Perl5/lib/site_pe .).
BEGIN failed--compilation aborted.
Additional InformationPer readme.os2, I installed LIBC065 (via the WPI)

[h:\]dir q:\libc0* /s

 Volume in drive Q is ECS 2_0 GA Serial number is AB1D:1C14

 Directory of Q:\Apps\Lib\libc0*

 6-11-07 22:53 48,142 0 libc06.dll
 6-11-07 22:53 48,142 0 libc061.dll
 6-11-07 22:53 157,124 0 libc062.dll
 4-15-07 12:37 1,340,869 0 libc062x.dll
 6-11-07 22:53 1,349,060 0 libc063.dll
      2,943,337 bytes in 5 files and 0 dirs 2,944,512 bytes allocated

    Total for: Q:\Apps\libc0*
      2,943,337 bytes in 5 files and 0 dirs 2,944,512 bytes allocated

 Directory of Q:\ecs\dll\libc0*

 4-14-04 16:37 356,330 0 libc05.dll
10-03-11 6:07 48,142 0 libc06.dll
10-03-11 6:07 48,142 0 libc061.dll
10-03-11 6:07 157,124 0 libc062.dll
10-03-11 6:07 157,124 0 libc063.dll
10-03-11 6:07 1,345,016 0 libc064.dll
 5-22-08 23:29 1,349,061 0 libc064x.dll
      3,460,939 bytes in 7 files and 0 dirs 3,462,144 bytes allocated

    Total for: Q:\ecs\libc0*
      3,460,939 bytes in 7 files and 0 dirs 3,462,144 bytes allocated

 Directory of Q:\usr\lib\libc0*

 1-17-05 9:54 2,212,930 0 libc06b4.dbg
 1-17-05 9:54 562,710 0 libc06b4.dll
 1-17-05 9:54 2,011,796 0 libc06b4.elh
 1-17-05 9:54 2,332,934 0
 1-17-05 9:54 2,395,150 0 libc06b4.logchk
 1-17-05 9:54 2,563,688 0
 1-17-05 9:54 2,441,623 0
 1-17-05 9:54 2,240,576 0 libc06b4.prf
 1-17-05 9:54 2,552,702 0
     19,314,109 bytes in 9 files and 0 dirs 19,317,248 bytes allocated

    Total for: Q:\usr\lib\libc0*
     19,314,109 bytes in 9 files and 0 dirs 19,317,248 bytes allocated

    Total for: Q:\usr\libc0*
     19,314,109 bytes in 9 files and 0 dirs 19,317,248 bytes allocated

    Total for: Q:\libc0*
     25,718,385 bytes in 21 files and 0 dirs 25,723,904 bytes allocated
    391,932,416 bytes free
TagsNo tags attached.



2012-01-21 16:50

reporter   ~0002182

I came looking to see if this had yet been reported as I am seeing the same thing. If I don't set perllib_prefix then it finds the .pm files fine when run on the same drive as it searches for /perl5/lib on the root of the drive but when on another drive having to set the perllib_prefix to be able to find them fails as above.


2012-01-22 11:46

reporter   ~0002183

If I issue these commands

PATH F:\perl5\bin;%PATH%
SET MANPATH=F:\Perl5\man
SET PERLLIB=F:\Perl5\lib
SET PERL_SH_DIR=F:/Perl5/bin

then the perl -V works, but a test script gives me an error message:

Can't locate in @INC (@INC contains: F:\Perl5\lib /perl5/lib/5.10.0/os2 /perl5/lib/5.10.0 /perl5/lib/site_perl/5.10.0/os2 /perl5/lib/site_perl/5.10.0 .) at H:\UTILITY/testpl.cmd line 3.
BEGIN failed--compilation aborted at H:\UTILITY/testpl.cmd line 3.

A dir shows that the mopdule exists:

[h:\]dir /s f:\perl5\

 Volume in drive F is ECS BOOT0 Serial number is 29EE:1415

 Directory of F:\perl5\lib\5.14.2\

 1-03-12 3:37 18,672 124
         18,672 bytes in 1 file and 0 dirs 18,944 bytes allocated

 Directory of F:\perl5\lib\5.14.2\encoding\

 1-03-12 3:37 6,236 124
          6,236 bytes in 1 file and 0 dirs 6,656 bytes allocated

kLIBC Pathrewriters maps /perl5 to F:\perl5


2012-01-22 12:16

reporter   ~0002184

You need to check your testpl again I think... it is using the wrong Perl:


2012-01-22 14:13

reporter   ~0002185

You're right; EXTPROC had an absolute path. When I changed it to just perl -options and left PERLLIB_PREFIX unset it worked. The bypass will cause harmless warnings installing CPAN modules, but I can live with that.


2012-01-22 18:50

administrator   ~0002186

I wonder if the code that handles PERLLIB_PREFIX can't handle the fact that the installation path is /perl5 and it's trying to change a drive letter?

I wonder what the best solution is - change the default installation to u:/perl5 and maybe PERLLIB_PREFIX will work correctly, or leave it as /perl5 and suggest the use of the klibc rewriter and that people NOT use PERLLIB_PREFIX?


2012-01-22 22:50

reporter   ~0002188

Without PERLLIB_PREFIX I have problems building CPAN modules:

[h:\vendors\cpan\digest-sha1-2.11]perl Makefile.PL
Writing Makefile for Digest::SHA1
Writing MYMETA.yml

Skip blib/lib/Digest/ (unchanged)
gcc -c -DDOSISH -DOS2=2 -DEMBED -I. -I/usr/local/include -O2 -fomit-frame-pointer -falign-loops=2 -falign-jumps=2 -falign-functions=2 -s -DVERSION=\"2.11\"
-DXS_VERSION=\"2.11\" -Zdll "-I/perl5/lib/5.14.2/os2/CORE" SHA1.c
In file included from SHA1.xs:8:
/perl5/lib/5.14.2/os2/CORE/perl.h:2577:27: os2ish.h: No such file or directory
In file included from /perl5/lib/5.14.2/os2/CORE/perl.h:5040,
                 from SHA1.xs:8:
/perl5/lib/5.14.2/os2/CORE/proto.h:266: error: parse error before '*' token
In file included from /perl5/lib/5.14.2/os2/CORE/perl.h:5070,
                 from SHA1.xs:8:
/perl5/lib/5.14.2/os2/CORE/intrpvar.h:88: error: parse error before "PL_statbuf"

/perl5/lib/5.14.2/os2/CORE/intrpvar.h:88: warning: data definition has no type or storage class
/perl5/lib/5.14.2/os2/CORE/intrpvar.h:89: error: parse error before "PL_statcache"
/perl5/lib/5.14.2/os2/CORE/intrpvar.h:89: warning: data definition has no type or storage class
SHA1.xs: In function `XS_Digest__SHA1_clone':
SHA1.xs:488: warning: initialization discards qualifiers from pointer target type
make.exe: *** [SHA1.o] Error 1


2012-01-23 09:06

reporter   ~0002190

KLIBCpathrewriter does appear to work... don't know why I didn't think to try it before other than I haven't explicitly used it very often.
Adding the drive as u: may fix it but it is odd how it is showing up.
First it adds a /o to the path then it drops the .2 from the path then it adds the /o again to the next path. I hate to say drop the PERLLIB_PREFIX as it has been around for a long time and is in almost any write up of how to setup Perl on OS/2 and dropping it would then cause all the documentation to cause people to go astray... on the other hand, klibcpathrewriter seems to work so hate to see unnecessary work done trying to figure it out, especially if it is more than just adding the drive letter.


2012-01-23 10:31

reporter   ~0002191

I wouldn't mind saying to drop PERLLIB_PREFIX if that worked, but it breaks the CPAN build process. We need a fix or bypass that doesn't break anything else.


2012-01-27 12:58

reporter   ~0002201

I get a little farther if I use an exlicit drive on the left side of SET PERLLIB_PREFIX=u:/perl5/lib;F:/perl5/lib, but I still get an error message from gcc:

gcc -c -DDOSISH -DOS2=2 -DEMBED -I. -I/usr/local/include -O2 -fomit-frame-pointer -falign-loops=2 -falign-jumps=2 -falign-functions=2 -s -DVERSION=\"2.131\"
 -DXS_VERSION=\"2.131\" -Zdll "-I/perl5/lib/5.14.2/os2/CORE" -DUSE_PPPORT_H Dumper.c
gcc: gcc: error executing U:/usr/i386-pc-os2-emx/bin/as.exe: No such file or directory

I verified that the file exists:

[g:\os2]dir U:\usr\i386-pc-os2-emx\bin\as.exe

 Volume in drive U is SMEDLEY Serial number is 3EBD:8001
 Directory of U:\usr\i386-pc-os2-emx\bin\as.exe

 6-11-07 9:19 212,992 0 as.exe


2012-04-02 21:13

reporter   ~0002232

A little late to the party :-)

What PERLLIB_PREFIX does to mess things up depends on the difference in lengths of the two strings. if the replacement is two characters longer then it will drop the last two characters. I have tried using PERL5LIB which gets around the truncation problem but even with the drive letters CPAN still fails with not finding some fairly basic thing like "strict". *And* it fails if invoked from a different drive. :-(


2012-04-06 00:08

reporter   ~0002233

I can get a bit further by setting PERLLIB_PREFIX=/perl5;/perl5 having installed into the root of a drive. So the broken substitution does not come into play. I then used klibcrewriter to change /perl5 into t:/perl5.

Next problem in trying to install *anything* from CPAN is all tests fail always. And if there is a compile involved I get the "no such file os2ish.h" message. This is because it does not exist. The file ...../CORE/os2ish.h is a soft link to os2/os2ish.h but it does not exist. The link implies that there is a ...../CORE/os2 directory containing os2ish.h but that does not exist either. In 5.8.2 it is a real file in CORE.

Steven Levine

2012-05-21 05:11

manager   ~0002272

I heard about the @INC issue from someone trying to use my on 5.14.2. This PERLLIB_PREFIX mapping issue seems to be specific to 5.14.2

Given a 5.14.2 setup of


the @INC truncation is obvious

>perl -e "map { print \"$_\n\" } @INC"

The same code on 5.10.0 claims @INC is OK.

>perl -e "map { print \"$_\n\" } @INC"

The type of slash does not seems to matter.


2012-05-21 18:35

administrator   ~0002273

There are no obvious differences in os2.c between perl 5.10.0 and 5.14.2 that would explain this.

Seems the easiest fix would be to change 5.14.2 to default to u:/perl5 as I'd wager that will take care of the PERLLIB_PREFIX issue

Steven Levine

2012-05-22 04:49

manager   ~0002274

I suspect the issue is the significant rewrite to S_incpush in perl.c. Near line 4432 we have

  libdir = newSVpvn(PERLLIB_MANGLE(dir, len), len);

If I am reading the code right, this will do the substitution and create a new string chopping it off at the old length. What I don't understand is why 5.10.0 and older versions seem to work correctly since the code is similar.

What I suspect will correct the behavior is something like

  const char *dir2 = PERLLIB_MANGLE(dir, len);
  libdir = newSVpvn(dir2, strlen(dir2));


2012-05-23 03:42

reporter   ~0002275

Steven - I took the liberty of copying the above to the perl NG where I am having other problems with this port and CPAN. Ben Morrow, who knows *far* more about perl than I do, says:

In 5.10.0 the code says

    if ( usesep && (s = strchr(p, PERLLIB_SEP)) != NULL ) {
        sv_setpvn(libdir, PERLLIB_MANGLE(p, (STRLEN)(s - p)),
                  (STRLEN)(s - p));
        p = s + 1;
    else {
        sv_setpv(libdir, PERLLIB_MANGLE(p, 0));
        p = NULL; /* break out */

whereas in 5.14.2 it omits the 'usesep' condition, and only has

    if (len) {
        /* I am not convinced that this is valid when PERLLIB_MANGLE is
           defined to so something (in os2/os2.c), but the code has been
           this way, ignoring any possible changed of length, since
           760ac839baf413929cd31cc32ffd6dba6b781a81 (5.003_02) so I'll leave
           it be. */
        libdir = newSVpvn(PERLLIB_MANGLE(dir, len), len);
    } else {
        libdir = newSVpv(PERLLIB_MANGLE(dir, 0), 0);

I don't know under what circumstances 'usesep' is supposed to be set,
but maybe taking the second branch prevents the truncation? The
implementation of PERLLIB_MANGLE is, um, scary; it appears to keep a
record of the old length in a global, for some reason I can't quite

Steven Levine

2012-05-23 04:13

manager   ~0002276

Hi DB1,

Taking the path that invokes

  libdir = newSVpv(PERLLIB_MANGLE(dir, 0), 0);

would avoid the truncation and that what might occur in 10.0 and older. You can think of newSVpv as a smart strcpy and newSVpvn as a smart strncpy. The SV objects are smart reference counted string objects.

usesep means that the input is a list of paths that need to be split and the 10.0 code loops to do this. In 14.2 there's a new outer function that does the split and the loop no longer exists. It needs to be tested, but I think my suggested fix is safe.

I don't see the global you are referring to. Got a file and line#?


2012-05-23 05:32

reporter   ~0002277

Sorry Steven - I posted all Ben said between the ======== lines.

Steven Levine

2012-05-23 08:15

manager   ~0002278

Does Ben have commit access to the Perl repo? If so, perhaps it makes sense for us to discuss my recommendation on comp.os.os2.misc or elsewhere.


2012-06-04 19:00

administrator   ~0002288

OK Steven's patch works with 5.16.0:
Examples of output below:

[U:\DEV]set PERLLIB_PREFIX=u:/perl5/lib;D:\usr\perl514\LIB

5.16.0 without Steven's patch:
[U:\DEV]perl -e "map { print \"$_\n\" } @INC"

5.16.0 with Steven's patch:
[U:\DEV]perl -e "map { print \"$_\n\" } @INC"


2012-06-04 19:01

administrator   ~0002289

Test build is at


2012-06-08 22:52

reporter   ~0002293

Last edited: 2012-06-08 22:55

View 2 revisions

Are, but it does not actually work :-(

  Built under os2
  Compiled at Jun 4 2012 18:56:00

[U:\]perl -MCPAN -e shell
Can't locate in @INC (@INC contains: U:u:/perl5/lib/site_perl/5.16.0/os2
U:u:/perl5/lib/site_perl/5.16.0 U:u:/perl5/lib/5.16.0/os2 U:u:/perl5/lib/5.16.0
U:u:/perl5/lib/site_perl .) at u:/perl5/lib/5.16.0/os2/File/Spec/ line 215
BEGIN failed--compilation aborted at u:/perl5/lib/5.16.0/ line 17.
Compilation failed in require.
BEGIN failed--compilation aborted.

Edit: It is putting the current drive letter on the front of each path. I just tried from t:/tmp

[T:\tmp]perl -MCPAN -e shell
Can't locate in @INC (@INC contains: T:u:/perl5/lib/site_perl/5.16.0/os2

Steven Levine

2012-06-09 00:49

manager   ~0002294

This is most likely a side-effect to the new relocatable @INC feature. Our port may be using *ix semantics to determine if the path is absolute.

I'll see it I can track this down later.

I will need a copy of the 5.16.0 .diffs for this.

Steven Levine

2012-06-09 01:23

manager   ~0002295

That's not it. Take a look at line 17

 $inc = File::Spec->rel2abs($inc) unless ref $inc;

Someone broke our rel2abs when they refactored the code for 5.16.0.

>perl -e "use File::Spec ; print File::Spec->rel2abs('d:/foo')"

It looks like they tried to add code to supply a drive letter.

Steven Levine

2012-06-09 01:47

manager   ~0002296

It should be sufficient to integrate the Win32 file_name_is_absolute(). This will add support for UNC pathnames which is a good thing.

FWIW, this fix along with any other .pm fixes should be passed upstream to the Perl maintainers.


2012-06-09 03:39

reporter   ~0002297

Absolutely, otherwise an innocently applied update to a perl module breaks the fix.


2012-06-09 08:22

administrator   ~0002298

I will take a look at the patches tonight - it's possible I broke things whilst trying to fix rel2abs for Shmuel.

On the subject of submitting patches - if the Perl guys will accept them, I'm happy to submit, but many projects make it so friggin hard to submit patches that it's not worth the effort


2012-06-09 09:31

administrator   ~0002299 has the latest diff

Steven Levine

2012-06-09 10:44

manager (7,465 bytes)

Steven Levine

2012-06-09 10:59

manager   ~0002300

Last edited: 2012-06-09 11:00

View 2 revisions

The attached can replace dist\File\Spec\ and fixes rel2abs based on my testing. Functionally all I did was merge the Win32 version of file_name_is_absolute along with the associated variable definitions into the previously patched

perl -MCPAN -e shell works, although the CPAN readline has issues that will be reported in another ticket.

Those that need it now can replace lib\5.16.0\os2\File\Spec\ with this file.


2012-06-09 20:15

reporter   ~0002302

What with readline? I am back to the "no test will run" scenario :-(

Steven Levine

2012-06-10 04:07

manager   ~0002305

The readline issue is on hold. With, I suspect, the rel2abs fixes, CPAN now claims that $term does not support history. Before this a Ctrl-R generated perl error messages.

Which ticket are you referring to with your "no test will run" comment? I've seen some of the newsgroup postings, but they contain too much cruft for me to attempt to replicate the failure here.


2012-06-11 00:26

reporter   ~0002307

I don't think I raised one here.

Basically try and install anything as soon as it gets to running the test it just skips them all. There is a problem *somewhere* in makemaker and/or Test::* things. One of the things I was trying to sort with Ben's help.

U:/PERL5/BIN/PERL.EXE "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/basic.t ............... No subtests run
t/like-exception.t ...... No subtests run
t/release-pod-syntax.t .. No subtests run

Issue History

Date Modified Username Field Change
2012-01-15 23:14 shmuel New Issue
2012-01-21 16:50 Buck Note Added: 0002182
2012-01-22 11:46 shmuel Note Added: 0002183
2012-01-22 12:16 Buck Note Added: 0002184
2012-01-22 14:13 shmuel Note Added: 0002185
2012-01-22 18:50 psmedley Note Added: 0002186
2012-01-22 22:50 shmuel Note Added: 0002188
2012-01-23 09:06 Buck Note Added: 0002190
2012-01-23 10:31 shmuel Note Added: 0002191
2012-01-27 12:58 shmuel Note Added: 0002201
2012-04-02 21:13 DB1 Note Added: 0002232
2012-04-06 00:08 DB1 Note Added: 0002233
2012-05-21 05:11 Steven Levine Note Added: 0002272
2012-05-21 18:35 psmedley Note Added: 0002273
2012-05-22 04:49 Steven Levine Note Added: 0002274
2012-05-23 03:42 DB1 Note Added: 0002275
2012-05-23 04:13 Steven Levine Note Added: 0002276
2012-05-23 05:32 DB1 Note Added: 0002277
2012-05-23 08:15 Steven Levine Note Added: 0002278
2012-06-04 19:00 psmedley Note Added: 0002288
2012-06-04 19:01 psmedley Note Added: 0002289
2012-06-08 22:52 DB1 Note Added: 0002293
2012-06-08 22:55 DB1 Note Edited: 0002293 View Revisions
2012-06-09 00:49 Steven Levine Note Added: 0002294
2012-06-09 01:23 Steven Levine Note Added: 0002295
2012-06-09 01:47 Steven Levine Note Added: 0002296
2012-06-09 03:39 DB1 Note Added: 0002297
2012-06-09 08:22 psmedley Note Added: 0002298
2012-06-09 09:31 psmedley Note Added: 0002299
2012-06-09 10:44 Steven Levine File Added:
2012-06-09 10:59 Steven Levine Note Added: 0002300
2012-06-09 11:00 Steven Levine Note Edited: 0002300 View Revisions
2012-06-09 20:15 DB1 Note Added: 0002302
2012-06-10 04:07 Steven Levine Note Added: 0002305
2012-06-11 00:26 DB1 Note Added: 0002307