Discussion:
use clone -> crash my exe
(too old to reply)
RAPPAZ Francois
2014-09-17 09:55:47 UTC
Permalink
Greetings !

My exe fails with the message
Can't locate loadable object for module Clone in @INC (@INC contains: U:/docs/perl/mod/hg_Gtk2-Ex-DbLinker/lib/ CODE(0x341594c)
C:\Windows\temp\par-rappazf\cache-9801daa9dcea9745eb0f4b316921377474933693\inc\lib
C:\Windows\temp\par-rappazf\cache-9801daa9dcea9745eb0f4b316921377474933693\inc CODE(0x2ed05a4) CODE(0x2ed08a4))
at C:/strawberry/perl/site/lib/PAR/Heavy.pm line 95
Compilation failed in require at Rose/DB/Object/Metadata/MethodMaker.pm line 7.

This line in MethodMaker.pm says
use Clone();

Thanks for any advice
François

PS:

my pp command line is
pp -x -v 3 -B -a glade -cd .\ppcache -I U:\some_dir -I C:\strawberry\c\bin\ @ppopts_rdb.txt -o in.par out

My ppopts_rdb.txt is

-M Class::Factory::Util
-M Class::Interface
-M DateTime::Format::Builder
-M DateTime::Format::MySQL
-M DateTime::Format::Strptime
-M Gtk2::Ex::DbLinker::AbDataManager
-M Params::ValidateXS
-M Rose::DB::MySQL
-a 'U:\docs\perl\lib\Forms\Dnav.bld;\lib\Forms\Dnav.bld'
-l libgobject-2.0-0.dll
-l libglib-2.0-0.dll
-l libgthread-2.0-0.dll
-l libcairo-2.dll
-l libfontconfig-1.dll
-l libexpat-1.dll
-l freetype6.dll
-l libpng12-0_.dll
-l libpng14-14.dll
-l zlib1.dll
-l libpango-1.0-0.dll
-l libgmodule-2.0-0.dll
-l libpangocairo-1.0-0.dll
-l libpangoft2-1.0-0.dll
-l libpangowin32-1.0-0.dll
-l libatk-1.0-0.dll
-l libgdk-win32-2.0-0.dll
-l libgdk_pixbuf-2.0-0.dll
-l libgio-2.0-0.dll
-l libgtk-win32-2.0-0.dll
-l intl.dll
-l libmysql_.dll
-l 'C:\strawberry\perl\site\lib\auto\Pango\Pango.dll'
-l 'C:\strawberry\perl\site\lib\auto\Glib\Glib.dll'
-l 'C:\strawberry\perl\site\lib\auto\Gtk2\Gtk2.dll'
-l 'C:\strawberry\perl\site\lib\auto\Cairo\Cairo.dll'
-X DBD::ADO
-X DBD::Gofer
-X DBD::ODBC
-X DBD::SQLite
-X DBD::File

François Rappaz
Roderich Schupp
2014-09-17 12:39:33 UTC
Permalink
That means: Clone.pm is present, but Clone.dll is missing or corrupt or
can't be loaded for some other reason.

Cheers, Roderich
Roderich Schupp
2014-09-17 17:40:07 UTC
Permalink
Please keep the maling list on CC unles you really want to talk to me in
private.
Looking in the zip that will be used to make the exe, I see the
lib\auto\clone contains
Clone.dll
Clone.bs
autosplit.ix
Looks good except for the lowercase directory "clone"
and the uppercase C(lone) on my disk versus lower case c in the zip is not
the reason ?
That might be a problem for the dynaloader intercept, as zip itself is
case-sensitive.
PAR doesn't change the case of things it packs... What about

pp -o foo.exe -e "use Clone; "

Cheers, Roderich
RAPPAZ Francois
2014-09-18 06:12:49 UTC
Permalink
Well
pp -o foo.exe -e "use Clone; "
pp –x -o foo.exe -e "use Clone; "

does not give any error

François

From: ***@gmail.com [mailto:***@gmail.com] On Behalf Of Roderich Schupp
Sent: mercredi, 17. septembre 2014 19:40
To: RAPPAZ Francois
Cc: ***@perl.org
Subject: Re: use clone -> crash my exe



On Wednesday, September 17, 2014, RAPPAZ Francois <***@unifr.ch<mailto:***@unifr.ch>> wrote:
Looking in the zip that will be used to make the exe, I see the lib\auto\clone contains
Clone.dll
Clone.bs
autosplit.ix
Looks good except for the lowercase directory "clone"
and the uppercase C(lone) on my disk versus lower case c in the zip is not the reason ?
That might be a problem for the dynaloader intercept, as zip itself is case-sensitive.
PAR doesn't change the case of things it packs... What about

pp -o foo.exe -e "use Clone; "

Cheers, Roderich
Roderich Schupp
2014-09-18 07:22:20 UTC
Permalink
Post by Roderich Schupp
Well
pp -o foo.exe -e "use Clone; "
pp –x -o foo.exe -e "use Clone; "
does not give any error
That's beside the point. What does

unzip -l foo.exe

say wrt Clone.dll?

Cheers, Roderich
RAPPAZ Francois
2014-09-18 07:37:47 UTC
Permalink
Path to Clone.dll in foo.exe is
foo.exe\lib\auto\Clone\

From: ***@gmail.com [mailto:***@gmail.com] On Behalf Of Roderich Schupp
Sent: jeudi, 18. septembre 2014 09:22
To: RAPPAZ Francois
Cc: ***@perl.org
Subject: Re: use clone -> crash my exe


On Thu, Sep 18, 2014 at 8:12 AM, RAPPAZ Francois <***@unifr.ch<mailto:***@unifr.ch>> wrote:
Well
pp -o foo.exe -e "use Clone; "
pp –x -o foo.exe -e "use Clone; "

does not give any error

That's beside the point. What does

unzip -l foo.exe

say wrt Clone.dll?

Cheers, Roderich
Roderich Schupp
2014-09-18 08:04:18 UTC
Permalink
Post by RAPPAZ Francois
Path to Clone.dll in foo.exe is
foo.exe\lib\auto\Clone\
As it should be. IIRC you pack via an intermediate .par file that is
created by pp, but
then massaged by you. Please check if this introduces the case change.

Cheers, Roderich
RAPPAZ Francois
2014-09-18 08:25:33 UTC
Permalink
I don’t mess with the Clone folder in lib/auto.

Once the par file is created my bat file unzip it in a tmp folder, and I can see that it’s lib/auto/clone I have.

Renaming to Clone does clear the problem.
If I compare that tmp folder with other archives I made with par, I see that it’s lib/auto/Clone I have

So I wonder what on earth produce the lower case 


I did use the cd .\ppcache commands
And if I open the file I can see that there is a clone.pm module mentioned whereas other module names are Capitalized

I will try to make the archive without the cache.

François


From: ***@gmail.com [mailto:***@gmail.com] On Behalf Of Roderich Schupp
Sent: jeudi, 18. septembre 2014 10:04
To: RAPPAZ Francois
Cc: ***@perl.org
Subject: Re: use clone -> crash my exe

On Thu, Sep 18, 2014 at 9:37 AM, RAPPAZ Francois <***@unifr.ch<mailto:***@unifr.ch>> wrote:
Path to Clone.dll in foo.exe is
foo.exe\lib\auto\Clone\

As it should be. IIRC you pack via an intermediate .par file that is created by pp, but
then massaged by you. Please check if this introduces the case change.

Cheers, Roderich
Ch Lamprecht
2014-09-19 09:19:43 UTC
Permalink
Post by RAPPAZ Francois
If I compare that tmp folder with other archives I made with par, I see that
it’s lib/auto/Clone I have
So I wonder what on earth produce the lower case …
Hi Francois,

did you check for a 'use clone;' in your sources?

Cheers Christoph
RAPPAZ Francois
2014-09-19 13:12:17 UTC
Permalink
Hi there,

I search for use clone without success:

C:\strawberry\perl\site\lib>findstr /B /S /C:"use clone;" *.*
Does not give any output, but

C:\strawberry\perl\site\lib>findstr /B /S /C:"use Clone;" *.*
gives
DBIx\Class\CDBICompat\Relationships.pm:use Clone;

C:\strawberry\perl\site\lib>findstr /B /S /C:"use Clone();" *.*
gives
Rose\DB\Object\Metadata\MethodMaker.pm:use Clone();
Rose\DB\Object\Metadata\Object.pm:use Clone();
Rose\DB\Object\Metadata.pm:use Clone(); # This is the backup clone method

I then tried

pp -v 3 -B -o test1.par mycript.pl
pp -v 3 -B -o test2.par -l Clone.dll myscript.p

and it does not change the case in lib/auto/Clone in the par archive.

Now, with
pp -v 3 -B -o test3.par @ppopts_test.txt invtot_rdb.pl

and the ppopts_test.txt being:
-M Class::Factory::Util
-M Class::Interface
-M DateTime::Format::Builder
-M DateTime::Format::MySQL
-M DateTime::Format::Strptime
-M Params::ValidateXS
-M Rose::DB::MySQL
-M Rose::DB::Object::Metadata::Column::Serial
-M Rose::DB::Object::Metadata::Column::Boolean
-M Rose::DB::Object::Metadata::Column::Character
-M Rose::DB::Object::Metadata::Column::Date
-M Rose::DB::Object::Metadata::Column::Enum
-M Rose::DB::Object::Metadata::Column::Integer
-M Rose::DB::Object::Metadata::Column::Set
-M Rose::DB::Object::Metadata::Column::Varchar
-M Rose::DB::Object::MakeMethods::Date
-M Rose::DB::Object::Metadata::Relationship::OneToMany

I have a lower case clone folder in lib/auto

So this is the way one of these module call clone... that produce the change in case


François
-----Original Message-----
Sent: vendredi, 19. septembre 2014 11:20
Subject: Re: use clone -> crash my exe
Post by RAPPAZ Francois
If I compare that tmp folder with other archives I made with par, I
see that it’s lib/auto/Clone I have
So I wonder what on earth produce the lower case …
Hi Francois,
did you check for a 'use clone;' in your sou
RAPPAZ Francois
2014-09-19 13:22:09 UTC
Permalink
One more thing: I piped the output of pp in a file and I can read

C:\strawberry\perl\site\bin/pp: ... adding C:/strawberry/perl/site/lib/auto/clone/Clone.bs as lib/auto/clone/Clone.bs
C:\strawberry\perl\site\bin/pp: ... adding C:/strawberry/perl/site/lib/auto/clone/Clone.dll as lib/auto/clone/Clone.dll
C:\strawberry\perl\site\bin/pp: ... adding <string> as lib/auto/clone/autosplit.ix

That the clone with lower case is outputted here (I did check that it is C:/strawberry/perl/site/lib/auto/Clone that I have on my disk

François
-----Original Message-----
Sent: vendredi, 19. septembre 2014 15:12
To: Ch Lamprecht; Roderich Schupp
Subject: RE: use clone -> crash my exe
Hi there,
C:\strawberry\perl\site\lib>findstr /B /S /C:"use clone;" *.* Does not
give any output, but
C:\strawberry\perl\site\lib>findstr /B /S /C:"use Clone;" *.* gives
DBIx\Class\CDBICompat\Relationships.pm:use Clone;
C:\strawberry\perl\site\lib>findstr /B /S /C:"use Clone();" *.* gives
Rose\DB\Object\Metadata\MethodMaker.pm:use Clone();
Rose\DB\Object\Metadata\Object.pm:use Clone();
Rose\DB\Object\Metadata.pm:use Clone(); # This is the backup clone method
I then tried
pp -v 3 -B -o test1.par mycript.pl
pp -v 3 -B -o test2.par -l Clone.dll myscript.p
and it does not change the case in lib/auto/Clone in the par archive.
Now, with
-M Class::Factory::Util
-M Class::Interface
-M DateTime::Format::Builder
-M DateTime::Format::MySQL
-M DateTime::Format::Strptime
-M Params::ValidateXS
-M Rose::DB::MySQL
-M Rose::DB::Object::Metadata::Column::Serial
-M Rose::DB::Object::Metadata::Column::Boolean
-M Rose::DB::Object::Metadata::Column::Character
-M Rose::DB::Object::Metadata::Column::Date
-M Rose::DB::Object::Metadata::Column::Enum
-M Rose::DB::Object::Metadata::Column::Integer
-M Rose::DB::Object::Metadata::Column::Set
-M Rose::DB::Object::Metadata::Column::Varchar
-M Rose::DB::Object::MakeMethods::Date
-M Rose::DB::Object::Metadata::Relationship::OneToMany
I have a lower case clone folder in lib/auto
So this is the way one of these module call clone... that produce the change in case
François
-----Original Message-----
Sent: vendredi, 19. septembre 2014 11:20
Subject: Re: use clone -> crash my exe
Post by RAPPAZ Francois
If I compare that tmp folder with other archives I made with par, I
see that it’s lib/auto/Clone I have
So I wonder what on earth produce the lower case …
Hi Francois,
did you check for a 'use clone;' i
Roderich Schupp
2014-09-20 14:31:44 UTC
Permalink
Post by RAPPAZ Francois
One more thing: I piped the output of pp in a file and I can read
C:\strawberry\perl\site\bin/pp: ... adding
C:/strawberry/perl/site/lib/auto/clone/Clone.bs as lib/auto/clone/Clone.bs
C:\strawberry\perl\site\bin/pp: ... adding
C:/strawberry/perl/site/lib/auto/clone/Clone.dll as lib/auto/clone/Clone.dll
C:\strawberry\perl\site\bin/pp: ... adding <string> as
lib/auto/clone/autosplit.ix
That the clone with lower case is outputted here (I did check that it is
C:/strawberry/perl/site/lib/auto/Clone that I have on my disk
A stray "use clone" would have the same effect:

C:\temp>pp -vvv -p -o foo.par -E "use clone;"
E:\strawberry\perl\site\bin/pp: Packing
C:\DOKUME~1\roderich\LOKALE~1\Temp\pp2G6Eh.pl
E:\strawberry\perl\site\bin/pp: Writing PAR on foo.par
E:\strawberry\perl\site\bin/pp: ... adding
E:/strawberry/perl/vendor/lib/auto/clone/Clone.dll as
lib/auto/clone/Clone.dll
E:\strawberry\perl\site\bin/pp: ... adding <string> as
lib/auto/clone/autosplit.ix
E:\strawberry\perl\site\bin/pp: ... adding <string> as lib/clone.pm

or even

C:\temp>pp -vvv -p -o foo.par -E "clone::wtf();"
E:\strawberry\perl\site\bin/pp: Packing
C:\DOKUME~1\roderich\LOKALE~1\Temp\pp213vD.pl
E:\strawberry\perl\site\bin/pp: Writing PAR on foo.par
E:\strawberry\perl\site\bin/pp: ... adding
E:/strawberry/perl/vendor/lib/auto/clone/Clone.dll as
lib/auto/clone/Clone.dll
E:\strawberry\perl\site\bin/pp: ... adding
E:/strawberry/perl/vendor/lib/auto/clone/autosplit.ix as
lib/auto/clone/autosplit.ix
E:\strawberry\perl\site\bin/pp: ... adding E:/strawberry/perl/vendor/lib/
clone.pm as lib/clone.pm

That's because Module::ScanDeps has the following (mis?)feature: if it sees
a fully qualified function call
like "... Foo::Bar::frobnicate(...)..." ANYWHERE in a file it goes looking
for a module Foo::Bar.

Cheers, Roderich
Roderich Schupp
2014-09-23 09:20:39 UTC
Permalink
C:\strawberry\perl\site\lib>findstr /NS ::clone *.pm
I'd rather search for "clone::" and also "clone->" instead, eg. a
statement like "$var = clone::whatever()" can trigger your problem.

Or you can instrument Module/ScanDeps.pm:

at line ~761 (in sub scan_file) add

sub scan_file{
my $file = shift;
print STDERR "scan_file($file)\n"; # <---

at line ~1000 (in sub scan_chunk) add

return unless defined($module);
{ my $m = ref($module) ? "@$module" : $module; print STDERR
"scan_chunk($chunk) => $m\n" if $m =~ /\bclone\b/; } # <---
return wantarray ? @$module : $module->[0] if ref($module);

and re-run scandeps.pl or pp on your script (w/o cache).


Cheers, Roderich
RAPPAZ Francois
2014-09-23 13:02:17 UTC
Permalink
I did change ScanDeps.pm as you suggest, you may find the output (together with pp listing) here:

http://homeweb3.unifr.ch/rappazf/Pub/listing_pp_test5.zip

but all are of the form $var->clone();
and not clone::xxx


François

From: ***@gmail.com [mailto:***@gmail.com] On Behalf Of Roderich Schupp
Sent: mardi, 23. septembre 2014 11:21
To: RAPPAZ Francois
Cc: ***@perl.org
Subject: Re: use clone -> crash my exe

On Tue, Sep 23, 2014 at 9:53 AM, RAPPAZ Francois <***@unifr.ch<mailto:***@unifr.ch>> wrote:
C:\strawberry\perl\site\lib>findstr /NS ::clone *.pm

I'd rather search for "clone::" and also "clone->" instead, eg. a statement like "$var = clone::whatever()" can trigger your problem.

Or you can instrument Module/ScanDeps.pm:

at line ~761 (in sub scan_file) add

sub scan_file{
my $file = shift;
print STDERR "scan_file($file)\n"; # <---

at line ~1000 (in sub scan_chunk) add

return unless defined($module);
{ my $m = ref($module) ? "@$module" : $module; print STDERR "scan_chunk($chunk) => $m\n" if $m =~ /\bclone\b/; } # <---
return wantarray ? @$module : $module->[0] if ref($module);

and re-run scandeps.pl<http://scandeps.pl> or pp on your script (w/o cache).


Cheers, Roderich
Roderich Schupp
2014-09-23 16:14:34 UTC
Permalink
Post by RAPPAZ Francois
I did change ScanDeps.pm as you suggest, you may find the output (together
Ouch:

# the line below is from dateTime.pm (but there are similar ones in other
modules)
$ ~/perl5/bin/scandeps.pl -B -e '$dt2 = $dt2->clone->set_time_zone(
$dt1->time_zone );'
...
'clone' => '0.37',

It's actually caused by

return $1 if /[^\$]\b([\w:]+)->\w/ and $1 ne 'Tk' and $1 ne 'shift';

in Module::ScanDeps::scan_chunk(). I guess it was meant to detect something
like

Foo::Bar->new

and infer the use of module Foo::Bar. I'll yank that silly heuristic in the
next release of M::SD.

Thanks for following thru with this.

Cheers, Roderich

RAPPAZ Francois
2014-09-18 14:21:45 UTC
Permalink
Well I still have lib/auto/clone without the cache

François

From: RAPPAZ Francois [mailto:***@unifr.ch]
Sent: jeudi, 18. septembre 2014 10:26
To: Roderich Schupp
Cc: ***@perl.org
Subject: RE: use clone -> crash my exe

I don’t mess with the Clone folder in lib/auto.

Once the par file is created my bat file unzip it in a tmp folder, and I can see that it’s lib/auto/clone I have.

Renaming to Clone does clear the problem.
If I compare that tmp folder with other archives I made with par, I see that it’s lib/auto/Clone I have

So I wonder what on earth produce the lower case 


I did use the cd .\ppcache commands
And if I open the file I can see that there is a clone.pm module mentioned whereas other module names are Capitalized

I will try to make the archive without the cache.

François


From: ***@gmail.com<mailto:***@gmail.com> [mailto:***@gmail.com] On Behalf Of Roderich Schupp
Sent: jeudi, 18. septembre 2014 10:04
To: RAPPAZ Francois
Cc: ***@perl.org<mailto:***@perl.org>
Subject: Re: use clone -> crash my exe

On Thu, Sep 18, 2014 at 9:37 AM, RAPPAZ Francois <***@unifr.ch<mailto:***@unifr.ch>> wrote:
Path to Clone.dll in foo.exe is
foo.exe\lib\auto\Clone\

As it should be. IIRC you pack via an intermediate .par file that is created by pp, but
then massaged by you. Please check if this introduces the case change.

Cheers, Roderich
Loading...