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

Re: Failed setup due to missing path



Erik,

Yes, your patch resolved my problem.  Thanks.

I'll write up my experience installing on Slackware and the steps I followed.

Joe




On Friday, September 11, 2015 1:23 AM, Erik Huelsmann <..hidden..> wrote:


Hi Joe,


Thanks for reporting (I had to dig your mail out of my spam box, due to GMail failing to validate if it was sent by Yahoo's mail servers, hence my somewhat late answer).

On Mon, Sep 7, 2015 at 2:21 AM, Joe Hunt <..hidden..> wrote:
I've been trying to install LedgerSMB 1.4.15 on Slackware Linux.

Slackware64 14.1 patched
Linux kernel 3.10.17
perl v5.18.1
Apache httpd 2.4.16
PostgreSQL 9.4.4

I entered http://localhost/ledgersmb/setup.pl in my web browser address box.  The initial page displayed and I entered the postgresql superuser name and password and the database name and clicked the login button.  The "confirm operation" page displays with "Logged in as postgres" "Database does not exist" and "Create database?" and I click the yes button.

Very nice! Could you write up the steps you had to take on Slackware to get to this point?
 
This results in the error
"Base schema failed to load at /usr/local/share/perl5/LedgerSMB/Database.pm line 622.
dbversion: 1.4.15, company: "

Looking at the log file, I see "sh: psql: command not found".  This clearly indicates a problem with the path setting.

My ledgersmb.conf does contain in the [environment] section the correct

PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/pgsql/bin

setting which includes the correct location of the psql binary.

So, looking at the source files, I see that the pertinent files are ledgersmb/LedgerSMB/Sysconfig.pm and ledgersmb/LedgerSMB/Database.pm.

In Database.pm, in the definition of exec_script is the statement

local %ENV;

My understanding is that this has the effect of clobbering the PATH environment variable.  The code proceeds to define environment variables for PGUSER, PGPASSWORD, PGDATABASE, PGHOST, and PGPORT (the latter 2 having been saved in variables in Sysconfig.pm.  But, the PATH has never been recovered.  This can be tested within the exec_script definition in Database.pm by saving the PATH and then printing the values to the log file.

(/usr/local/ledgersmb/LedgerSMB/Database.pm is the patched version which I also copied to
/usr/local/share/perl5/LedgerSMB and to /usr/local/ledgersmb/blib/lib/LedgerSMB)


Yup. It completely empties the environment. This wasn't the intention of the change when it was put in place, though.

I have the following patch ready to be committed and included into 1.4.16:

diff -r 1acaae026188 LedgerSMB/Database.pm
--- a/LedgerSMB/Database.pm Sun Aug 30 19:30:09 2015 +0200
+++ b/LedgerSMB/Database.pm Fri Sep 11 08:14:10 2015 +0000
@@ -139,12 +139,11 @@
 sub base_backup {
     my $self = shift @_;
 
-    local %ENV; # Make sure that - when leaving the scope - %ENV is restored
-    $ENV{PGUSER} = $self->{username};
-    $ENV{PGPASSWORD} = $self->{password};
-    $ENV{PGDATABASE} = $self->{company_name};
-    $ENV{PGHOST} = $LedgerSMB::Sysconfig::db_host;
-    $ENV{PGPORT} = $LedgerSMB::Sysconfig::db_port;
+    local $ENV{PGUSER} = $self->{username};
+    local $ENV{PGPASSWORD} = $self->{password};
+    local $ENV{PGDATABASE} = $self->{company_name};
+    local $ENV{PGHOST} = $LedgerSMB::Sysconfig::db_host;
+    local $ENV{PGPORT} = $LedgerSMB::Sysconfig::db_port;
 
     my @t = localtime(time);
     $t[4]++;
@@ -185,12 +184,11 @@
 sub db_backup {
     my $self = shift @_;
 
-    local %ENV; # Make sure that - when leaving the scope - %ENV is restored
-    $ENV{PGUSER} = $self->{username};
-    $ENV{PGPASSWORD} = $self->{password};
-    $ENV{PGDATABASE} = $self->{company_name};
-    $ENV{PGHOST} = $LedgerSMB::Sysconfig::db_host;
-    $ENV{PGPORT} = $LedgerSMB::Sysconfig::db_port;
+    local $ENV{PGUSER} = $self->{username};
+    local $ENV{PGPASSWORD} = $self->{password};
+    local $ENV{PGDATABASE} = $self->{company_name};
+    local $ENV{PGHOST} = $LedgerSMB::Sysconfig::db_host;
+    local $ENV{PGPORT} = $LedgerSMB::Sysconfig::db_port;
 
     my @t = localtime(time);
     $t[4]++;
@@ -695,14 +693,11 @@
 sub exec_script {
     my ($self, $args) = @_;
 
-
-    local %ENV;
-
-    $ENV{PGUSER} = $self->{username};
-    $ENV{PGPASSWORD} = $self->{password};
-    $ENV{PGDATABASE} = $self->{company_name};
-    $ENV{PGHOST} = $LedgerSMB::Sysconfig::db_host;
-    $ENV{PGPORT} = $LedgerSMB::Sysconfig::db_port;
+    local $ENV{PGUSER} = $self->{username};
+    local $ENV{PGPASSWORD} = $self->{password};
+    local $ENV{PGDATABASE} = $self->{company_name};
+    local $ENV{PGHOST} = $LedgerSMB::Sysconfig::db_host;
+    local $ENV{PGPORT} = $LedgerSMB::Sysconfig::db_port;
 
     open (LOG, '>>', $args->{log});
     if ($args->{errlog}) {


Could you verify that this fixes your problem?


Thanks!




--
Bye,

Erik.

http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.

------------------------------------------------------------------------------

_______________________________________________
Ledger-smb-users mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-users


------------------------------------------------------------------------------
_______________________________________________
Ledger-smb-users mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-users