<div dir="ltr">Hi Ishii-San<div><br></div><div>Can you please have a look at the attached patch.</div><div>The reason I want your consent before committing it is because apart from using the absolute paths for pgpool.conf, pcp.conf and pool_hba.conf files,</div><div>I have also modified the behaviour of pid_file_name configuration parameter.</div><div>Now when the relative path is specified for the pid file in pgpool.conf file that relative path is calculated with reference to the location of pgpool.conf file.</div><div><br></div><div>For example:</div><div><br></div><div>if pgpool.conf file sets <font face="monospace, monospace">pid_file_name</font> parameter as</div><div><div><br></div><div><font face="monospace, monospace">pid_file_name = 'somedir/pgpool.pid'</font></div></div><div><br></div><div>And pgpool.conf file is located in the "<font face="monospace, monospace">/etc/configurations/"</font> directory than the Pgpool-II will create the pgpool.pid file </div><div>in "<font face="monospace, monospace">/etc/configurations/somedir"</font> directory</div><div><br></div><div>While if absolute path is specified than it will work as it works before</div><div><br></div><div><div><font face="monospace, monospace">pid_file_name = '/etc/mydir/pgpool.pid' # this will create the pgpool.pid in /etc/mydir/ directory</font></div></div><div><br></div><div><br></div><div>I have done this change because I think it will make the configuration of pid_file_name more intuitive and less confusing.</div><div>P.S The documentation changes are also part of the patch.</div><div><br></div><div>Thoughts and comments?</div><div><br></div><div><br></div><div>Thanks</div><div>Best regards</div><div>Muhammad Usama</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 14, 2017 at 3:27 AM, Tatsuo Ishii <span dir="ltr"><<a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@sraoss.co.jp</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Good catch! Please go ahead.<br>
<br>
Best regards,<br>
--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_<wbr>en.php</a><br>
Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.<wbr>jp</a><br>
<div class="HOEnZb"><div class="h5"><br>
> Hi<br>
><br>
> Pgpool-II does not properly handle the relative paths especially when the<br>
> pgpool.conf file is explicitly specified using the command line (-f switch)<br>
> while its patch is given relative to the current directory.<br>
><br>
> For example:<br>
><br>
> Suppose we invoke pgpool-II from "/home/work/installed/pgpool/<wbr>bin" directory<br>
><br>
> $ pwd<br>
> /home/work//installed/pgpool/<wbr>bin<br>
> $ ./pgpool -f simple_conf/pgpool.conf<br>
><br>
> Now we are expecting here is that the Pgpool-II will look for pgpool.conf<br>
> file in the<br>
> /home/work/installed/pgpool/<wbr>bin/simple_conf/ directory, which it does<br>
> correctly :-), and also latter in the startup phase when it will require<br>
> the pool_passwd file it will look in the same (<br>
> /home/work/installed/pgpool/<wbr>bin/simple_conf/)directory.<br>
> So in the code what Pgpool-II does is, it take out the directory portion<br>
> from the command line option provided to it for specifying the pgpool.conf<br>
> file and look for the pool_passwd file in that directory. which in this<br>
> case is just simple_conf/<br>
><br>
> Now the problem here is since the pgpool.conf path used in the command line<br>
> option was a relative path, so it will only be able to go to the correct<br>
> directory location if the current directory of Pgpool-II remains the same<br>
> from where it was invoked from.<br>
><br>
> And since we do not change the current directory when Pgpool-II is started<br>
> with "-n" switch ( non daemon mode) so everything works as expected in that<br>
> mode.<br>
> But when the Pgpool-II is started in the daemon mode the daemonize()<br>
> function changes the current directory to "/"<br>
><br>
> main.c:380 if(chdir("/"))<br>
><br>
> and after that all relative path becomes invalid and Pgpool-II will start<br>
> looking for files in invalid or non-existent location. which as per our<br>
> example in daemon mode it will try to find the pool_passwd file in<br>
><br>
> /simple_conf/pool_passed<br>
><br>
> instead of<br>
><br>
> /home/work//installed/pgpool/<wbr>bin/simple_conf/pool_passwd<br>
> The solution to this is to convert the relative path of the pgpool.conf to<br>
> the absolute path at the startup and later use that absolute path for all<br>
> other path calculations.<br>
><br>
> If you do not have any reservation, than I will start working on the fix.<br>
><br>
> Thanks<br>
> Best Regards<br>
> Muhammad Usama<br>
</div></div></blockquote></div><br></div>