[pgpool-hackers: 2390] Problems with the relative paths in daemon mode
m.usama at gmail.com
Wed Jun 14 06:44:45 JST 2017
Pgpool-II does not properly handle the relative paths especially when the
pgpool.conf file is explicitly specified using the command line (-f switch)
while its patch is given relative to the current directory.
Suppose we invoke pgpool-II from "/home/work/installed/pgpool/bin" directory
$ ./pgpool -f simple_conf/pgpool.conf
Now we are expecting here is that the Pgpool-II will look for pgpool.conf
file in the
/home/work/installed/pgpool/bin/simple_conf/ directory, which it does
correctly :-), and also latter in the startup phase when it will require
the pool_passwd file it will look in the same (
So in the code what Pgpool-II does is, it take out the directory portion
from the command line option provided to it for specifying the pgpool.conf
file and look for the pool_passwd file in that directory. which in this
case is just simple_conf/
Now the problem here is since the pgpool.conf path used in the command line
option was a relative path, so it will only be able to go to the correct
directory location if the current directory of Pgpool-II remains the same
from where it was invoked from.
And since we do not change the current directory when Pgpool-II is started
with "-n" switch ( non daemon mode) so everything works as expected in that
But when the Pgpool-II is started in the daemon mode the daemonize()
function changes the current directory to "/"
and after that all relative path becomes invalid and Pgpool-II will start
looking for files in invalid or non-existent location. which as per our
example in daemon mode it will try to find the pool_passwd file in
The solution to this is to convert the relative path of the pgpool.conf to
the absolute path at the startup and later use that absolute path for all
other path calculations.
If you do not have any reservation, than I will start working on the fix.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pgpool-hackers