[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: use base or use parent?



We released a fixed version, debian packages not updated yet.  But I would be happy to merge a patch.

I agree we should probably make that move but the best immediate fix is to add to the main request handlers.

The emergency fix (poorly thought out) can be seen at:
https://github.com/ledgersmb/LedgerSMB/commit/83bdaf38ef03add07f8dd6348eb01c5dbdca94e7
https://github.com/ledgersmb/LedgerSMB/commit/cbcb220d24e2260b3e29db2be04634c62f8a3ea6

These are in the current 1.4 version.  They are not recommended because use lib '.' is pretty dangerous.  We aren't vulnerable in any use cases I know of but that does not mean people are not doing crazy things.

The following replaces those with a safer version:

https://github.com/ledgersmb/LedgerSMB/pull/1912.patch


use FindBin;
use lib $FindBin::$Bin . "/..";

On Thu, Aug 4, 2016 at 2:02 PM, Nick Prater <..hidden..> wrote:
ledgersmb has stopped working on my Debian system. Substituting "use
parent" for "use base" in two modules has 'fixed' the problem.

I believe this is since a recent perl update, but only discovered the
problem on restarting Starman after upgrading ledgersmb. The problem is
not specific to one version of ledgersmb - I see the same issue with
1.3.26 and 1.3.31.

I am running Debian GNU/Linux 8.5 (jessie) with perl 5.20.2 and
ledgersmb 1.3.31

I try to start ledgersmb with:
# starman --preload-app tools/starman.psgi

But I get an error:

> Error while loading /srv/ledgersmb-1.4.31/tools/starman.psgi:
> Base class package "LedgerSMB::DBObject" is empty.
> (Perhaps you need to 'use' the module which defines that package first,
> or make that module available in @INC... [snip]
> at LedgerSMB/Setting.pm line 53

http://perldoc.perl.org/perlobj.html says:

> ...Much older code also uses the base pragma.
> For new code, we recommend that you use the parent pragma to
> declare your parents. This pragma will take care of setting @ISA.
> It will also load the parent classes and make sure that the
> package doesn't inherit from itself.

changing "use base" for "use parent" in Setting.pm fixes this error.

I then get another error:

> Error while loading /srv/ledgersmb-1.4.31/tools/starman.psgi:
> Base class package "LedgerSMB::Request" is empty.
> (Perhaps you need to 'use' the module which defines that package first,
> or make that module available in @INC... [snip]
> at LedgerSMB.pm line 182.

changing "use base" for "use parent" in LedgerSMB.pm fixes this error.
Starman then starts and I can use ledgersmb normally.

Frankly I don't understand why "use base" is failing in these two
locations and why "use parent" behaves differently. I wonder if this
problem is unique to my setup, or it affects others also. For now I'm up
and running. I document my steps here in case anybody else encounters a
similar problem, but I'd also appreciate any words of wisdom to help me
understand what is happening.

Many thanks,

Nick


------------------------------------------------------------------------------
_______________________________________________
Ledger-smb-devel mailing list
Ledger-smb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel



--
Best Wishes,
Chris Travers

Efficito:  Hosted Accounting and ERP.  Robust and Flexible.  No vendor lock-in.
http://www.efficito.com/learn_more
------------------------------------------------------------------------------
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel