[rrd-developers] rrd_graph and flush behavior
kevin brintnall
kbrint at rufus.net
Wed May 26 00:15:58 CEST 2010
It looks like you're exactly right.. I'll submit a patch shortly.
Thanks!
-kb
On Tue, May 25, 2010 at 4:53 PM, Eduardo Bragatto <eduardo at bragatto.com>wrote:
> On May 25, 2010, at 6:14 PM, Eduardo Bragatto wrote:
>
> On May 25, 2010, at 5:28 PM, kevin brintnall wrote:
>>
>> The symbolic link should work. Can you verify whether realpath(2)
>>> on your system reports the correct path in the symlink case? If
>>> realpath(2) is right and the client is still not providing the right
>>> file name, then there is definitely a problem.
>>>
>>
>> realpath(3) does work.
>>
>> I have used this little wrapper:
>>
>> http://yost.com/computers/compileAndGo/realpath.html
>>
>> And after compiling and running it, I do get the real path:
>>
>> # ./test_realpath /usr/local/rrd/stable-crm2/repository/manager.nbg/
>> switches/whk2s1/10146.rrd
>> /usr/local/rrd/stable-crm2/rrd/switches/whk2s1/10146.rrd
>>
>> However calling "rrd_graph" to read "/usr/local/rrd/stable-crm2/
>> repository/manager.nbg/switches/whk2s1/10146.rrd" does not cause it to
>> flush to disk.
>>
>
> Hi,
>
> I have checked the code from rrd_client.c and indeed there was a problem
> there, starting on line #75 (rrdtool 1.4.3 stable):
>
> if (*path == '/') /* absolute path */
> {
> if (! is_unix)
> {
> rrd_set_error ("absolute path names not allowed when talking "
> "to a remote daemon");
> return (NULL);
> }
> }
> else /* relative path */
> {
> if (is_unix)
> {
> realpath (path, resolved_path);
> ret = resolved_path;
> }
> /* else: nothing to do */
> }
> return (ret);
>
> As we can see there, realpath is only called if using relative paths.
>
> realpath should also be called if it's an absolute path AND we are talking
> to a unix socket. Patching the code as follows has resolved the issue with
> symlinks:
>
> if (*path == '/') /* absolute path */
> {
> if (! is_unix)
> {
> rrd_set_error ("absolute path names not allowed when talking "
> "to a remote daemon");
> return (NULL);
> }
> /**** started adding here ***/
> else
> {
> realpath (path, resolved_path);
> ret = resolved_path;
> }
> /**** stopped adding here ***/
> }
> else /* relative path */
> {
> if (is_unix)
> {
> realpath (path, resolved_path);
> ret = resolved_path;
> }
> /* else: nothing to do */
> }
>
> Thank you all for your assistance. I hope to see this fix in a future
> stable release.
>
> - Eduardo Bragatto.
>
--
kevin brintnall =~ /kbrint at rufus.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20100525/38a369cd/attachment.html
More information about the rrd-developers
mailing list