<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 = &#39;somedir/pgpool.pid&#39;</font></div></div><div><br></div><div>And pgpool.conf file is located in the &quot;<font face="monospace, monospace">/etc/configurations/&quot;</font> directory than the Pgpool-II will create the pgpool.pid file </div><div>in &quot;<font face="monospace, monospace">/etc/configurations/somedir&quot;</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 = &#39;/etc/mydir/pgpool.pid&#39; # 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">&lt;<a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@sraoss.co.jp</a>&gt;</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>
&gt; Hi<br>
&gt;<br>
&gt; Pgpool-II does not properly handle the relative paths especially when the<br>
&gt; pgpool.conf file is explicitly specified using the command line (-f switch)<br>
&gt; while its patch is given relative to the current directory.<br>
&gt;<br>
&gt; For example:<br>
&gt;<br>
&gt; Suppose we invoke pgpool-II from &quot;/home/work/installed/pgpool/<wbr>bin&quot; directory<br>
&gt;<br>
&gt; $ pwd<br>
&gt; /home/work//installed/pgpool/<wbr>bin<br>
&gt; $ ./pgpool -f simple_conf/pgpool.conf<br>
&gt;<br>
&gt; Now we are expecting here is that the Pgpool-II will look for pgpool.conf<br>
&gt; file in the<br>
&gt; /home/work/installed/pgpool/<wbr>bin/simple_conf/ directory, which it does<br>
&gt; correctly :-), and also latter in the startup phase when it will require<br>
&gt; the pool_passwd file it will look in the same (<br>
&gt; /home/work/installed/pgpool/<wbr>bin/simple_conf/)directory.<br>
&gt; So in the code what Pgpool-II does is, it take out the directory portion<br>
&gt; from the command line option provided to it for specifying the pgpool.conf<br>
&gt; file and look for the pool_passwd file in that directory. which in this<br>
&gt; case is just simple_conf/<br>
&gt;<br>
&gt; Now the problem here is since the pgpool.conf path used in the command line<br>
&gt; option was a relative path, so it will only be able to go to the correct<br>
&gt; directory location if the current directory of Pgpool-II remains the same<br>
&gt; from where it was invoked from.<br>
&gt;<br>
&gt; And since we do not change the current directory when Pgpool-II is started<br>
&gt; with &quot;-n&quot; switch ( non daemon mode) so everything works as expected in that<br>
&gt; mode.<br>
&gt; But when the Pgpool-II is started in the daemon mode the daemonize()<br>
&gt; function changes the current directory to &quot;/&quot;<br>
&gt;<br>
&gt; main.c:380 if(chdir(&quot;/&quot;))<br>
&gt;<br>
&gt; and after that all relative path becomes invalid and Pgpool-II will start<br>
&gt; looking for files in invalid or non-existent location. which as per our<br>
&gt; example in daemon mode it will try to find the pool_passwd file in<br>
&gt;<br>
&gt; /simple_conf/pool_passed<br>
&gt;<br>
&gt; instead of<br>
&gt;<br>
&gt; /home/work//installed/pgpool/<wbr>bin/simple_conf/pool_passwd<br>
&gt; The solution to this is to convert the relative path of the pgpool.conf to<br>
&gt; the absolute path at the startup and later use that absolute path for all<br>
&gt; other path calculations.<br>
&gt;<br>
&gt; If you do not have any reservation, than I will start working on the fix.<br>
&gt;<br>
&gt; Thanks<br>
&gt; Best Regards<br>
&gt; Muhammad Usama<br>
</div></div></blockquote></div><br></div>