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

Failed setup due to missing path



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.

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)

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

--- Database.pm 2015-08-16 03:21:46.000000000 -0700
+++ /usr/local/ledgersmb/LedgerSMB/Database.pm  2015-09-06 16:54:59.309734686 -0700
@@ -696,6 +696,7 @@
     my ($self, $args) = @_;


+    my $prevpath = $ENV{PATH};
     local %ENV;

     $ENV{PGUSER} = $self->{username};
@@ -705,6 +706,9 @@
     $ENV{PGPORT} = $LedgerSMB::Sysconfig::db_port;

     open (LOG, '>>', $args->{log});
+    print LOG "Previous path is $prevpath\n";
+    print LOG "Current path is $ENV{'PATH'}\n";
+
     if ($args->{errlog}) {
        open (PSQL, '-|', "psql -f $args->{script} 2>>$args->{errlog}");
     } else {

------------------------------------------------------------------------------------------------------------
  
When I patch with this code, the stdout log file in /tmp/ledgersmb correctly shows the previous path and shows the current path as empty.

I don't know enough about perl or LedgerSMB to know what is the best way to fix this, but wanted to point out the problem.
------------------------------------------------------------------------------
_______________________________________________
Ledger-smb-users mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-users