patch/diff Plugin Architecture 2.9 with cacti 0.8.7g failed

Support for the Plugin Architecture

Moderators: Developers, Moderators

Post Reply
Perry
Posts: 5
Joined: Thu Feb 02, 2006 5:48 am

patch/diff Plugin Architecture 2.9 with cacti 0.8.7g failed

Post by Perry »

Hallo,

I tried the new announced Plugin architecture diff file with a new unpack cati 0.8.7g.

I got the following errors:

[color=#40BF00]
/opt/source/cacti/cacti-0.8.7g_diff# patch -p1 -N --dry-run < cacti-plugin-0.8.7g-PA-v2.9.diff
patching file auth_changepassword.php
patching file auth_login.php
patching file cli/add_graph_template.php
patching file cli/add_tree.php
patching file cli/host_update_template.php
patching file data_sources.php
Hunk #6 FAILED at 1323.
1 out of 6 hunks FAILED -- saving rejects to file data_sources.php.rej
patching file graph_image.php
patching file graph.php
patching file graphs_new.php
patching file graphs.php
patching file host.php
patching file images/disable_icon.png
patching file images/enable_icon_disabled.png
patching file images/enable_icon.png
patching file images/install_icon_disabled.png
patching file images/install_icon.png
patching file images/uninstall_icon.gif
patching file images/view_none.gif
patching file include/auth.php
patching file include/bottom_footer.php
patching file include/config.php
patching file include/global_arrays.php
patching file include/global_constants.php
patching file include/global_form.php
patching file include/global.php
patching file include/global_settings.php
patching file include/plugins.php
patching file include/top_graph_header.php
patching file include/top_header.php
patching file index.php
patching file lib/api_automation_tools.php
patching file lib/api_device.php
patching file lib/api_graph.php
patching file lib/api_tree.php
patching file lib/auth.php
patching file lib/data_query.php
patching file lib/functions.php
patching file lib/html_form.php
patching file lib/html.php
patching file lib/html_tree.php
patching file lib/plugins.php
patching file lib/poller.php
patching file lib/rrd.php
patching file lib/template.php
patching file lib/variables.php
patching file plugins/index.php
patching file plugins.php
patching file poller.php
Hunk #1 succeeded at 108 with fuzz 2.
Hunk #2 succeeded at 306 (offset 1 line).
Hunk #3 FAILED at 432.
Hunk #4 FAILED at 451.
Hunk #5 succeeded at 501 (offset 2 lines).
2 out of 5 hunks FAILED -- saving rejects to file poller.php.rej
patching file user_admin.php
patching file utilities.php
[/color]

Any soloutions for this Problem?
joltman
Posts: 16
Joined: Fri May 15, 2009 10:10 am
Location: Bloomington, IL
Contact:

Re: patch/diff Plugin Architecture 2.9 with cacti 0.8.7g fai

Post by joltman »

I'm having this same issue...Any help would be appreciated.
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: patch/diff Plugin Architecture 2.9 with cacti 0.8.7g fai

Post by noname »

There are several similar posts since PIA2.9 was released (first, etc, etc).

You may patch 'data_sources.php' & 'poller.php' by hand, or overwrite with patched file inside archive by following documentation.

- Installing the Plugin Architecture (PIA)
If you receive and FAILED errors, then you know that you will run into a few problems.
These problems can usually be addressed by posting in the forums.
If you have not modified your Cacti install by using any other mods, then it is usually fairly safe to override the file that “FAILED” with a pre-patched file that is also provided in the archive


I tried to fix diff file, but it seems that this was not from files in the provided archive...

Descriptions in 'cacti-plugin-0.8.7g-PA-v2.9.diff':
diff -Naur cacti-0.8.7g/data_sources.php cacti-0.8.7g-PA-v2.9/data_sources.php
--- cacti-0.8.7g/data_sources.php 2010-09-19 21:39:05.000000000 -0400
+++ cacti-0.8.7g-PA-v2.9/data_sources.php 2010-10-17 20:09:52.000000000 -0400
But in the archive:

Code: Select all

% tar ztvf cacti-plugin-0.8.7g-PA-v2.9.tar.gz | grep data_sources.php
-rw-r--r-- roman/users   58716 2010-09-20 10:52 cacti-plugin-arch/files-0.8.7g/data_sources.php
doiggl
Cacti User
Posts: 222
Joined: Wed Dec 16, 2009 6:32 am

Re: patch/diff Plugin Architecture 2.9 with cacti 0.8.7g fai

Post by doiggl »

I got this result - the errors can be reproduced.
PIA failed to update data_sources.php and poller.php on fresh cacti install
How can it be fixed ?
Glenn


#commands used
rm -rf cacti-0.8.7g
tar -xf cacti-0.8.7g.tar
cd cacti-0.8.7g
patch -p1 < ../cacti-plugin-0.8.7g-PA-v2.9.diff

#result
patching file auth_changepassword.php
patching file auth_login.php
patching file cli/add_graph_template.php
patching file cli/add_tree.php
patching file cli/host_update_template.php
patching file data_sources.php
Hunk #6 FAILED at 1323.
1 out of 6 hunks FAILED -- saving rejects to file data_sources.php.rej
patching file graph_image.php
patching file graph.php
patching file graphs_new.php
patching file graphs.php
patching file host.php
patching file images/disable_icon.png
patching file images/enable_icon_disabled.png
patching file images/enable_icon.png
patching file images/install_icon_disabled.png
patching file images/install_icon.png
patching file images/uninstall_icon.gif
patching file images/view_none.gif
patching file include/auth.php
patching file include/bottom_footer.php
patching file include/config.php
patching file include/global_arrays.php
patching file include/global_constants.php
patching file include/global_form.php
patching file include/global.php
patching file include/global_settings.php
patching file include/plugins.php
patching file include/top_graph_header.php
patching file include/top_header.php
patching file index.php
patching file lib/api_automation_tools.php
patching file lib/api_device.php
patching file lib/api_graph.php
patching file lib/api_tree.php
patching file lib/auth.php
patching file lib/data_query.php
patching file lib/functions.php
patching file lib/html_form.php
patching file lib/html.php
patching file lib/html_tree.php
patching file lib/plugins.php
patching file lib/poller.php
patching file lib/rrd.php
patching file lib/template.php
patching file lib/variables.php
patching file plugins/index.php
patching file plugins.php
patching file poller.php
Hunk #1 succeeded at 108 with fuzz 2.
Hunk #2 succeeded at 306 (offset 1 line).
Hunk #3 FAILED at 431.
Hunk #4 FAILED at 450.
Hunk #5 succeeded at 499 (offset 2 lines).
2 out of 5 hunks FAILED -- saving rejects to file poller.php.rej
patching file user_admin.php
patching file utilities.php

# cat data_sources.php.rej
--- data_sources.php 2010-09-19 21:39:05.000000000 -0400
+++ data_sources.php 2010-10-17 20:09:52.000000000 -0400
@@ -1323,8 +1336,10 @@
$i = 0;
if (sizeof($data_sources) > 0) {
foreach ($data_sources as $data_source) {
+ $data_source["data_template_name"] = htmlspecialchars($data_source["data_template_name"]);
+ $data_source = api_plugin_hook_function('data_sources_table', $data_source);
/* we're escaping strings here, so no need to escape them on form_selectable_cell */
- $data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : htmlspecialchars($data_source["data_template_name"]));
+ $data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);
$data_input_name = ((empty($data_source["data_input_name"])) ? "<em>External</em>" : htmlspecialchars($data_source["data_input_name"]));
$poller_interval = ((isset($poller_intervals[$data_source["local_data_id"]])) ? $poller_intervals[$data_source["local_data_id"]] : 0);
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $data_source["local_data_id"]); $i++;
#
# cat poller.php.rej
--- poller.php 2010-09-19 21:39:06.000000000 -0400
+++ poller.php 2010-10-17 20:09:52.000000000 -0400
@@ -431,7 +435,7 @@

/* record the start time for this loop */
list($micro,$seconds) = explode(" ", microtime());
- $loop_end = $seconds + $micro;
+ $loop_end = $seconds + $micro;
$loop_time = $loop_end - $loop_start;

if ($loop_time < $poller_interval) {
@@ -450,7 +454,9 @@

/* sleep the appripriate amount of time */
if ($poller_runs_completed < $poller_runs) {
+ api_plugin_hook('poller_bottom');
usleep($sleep_time * 1000000);
+ api_plugin_hook('poller_top');
}
}else if (read_config_option('log_verbosity') >= POLLER_VERBOSITY_MEDIUM || $debug) {
cacti_log("WARNING: Cacti Polling Cycle Exceeded Poller Interval by " . $loop_end-$loop_start-$poller_interval . " seconds", TRUE, "POLLER");
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: patch/diff Plugin Architecture 2.9 with cacti 0.8.7g fai

Post by gandalf »

I "guess" that installing all known patches first _may_ be the root cause
R.
doiggl
Cacti User
Posts: 222
Joined: Wed Dec 16, 2009 6:32 am

Re: patch/diff Plugin Architecture 2.9 with cacti 0.8.7g fai

Post by doiggl »

I did a fresh catci test install no patches used at all
When trying to parch cacti with cacti-plugin-0.8.7g-PA-v2.9.diff
I got some patch failures [1] see data_sources.php.rej and poller.php.rej

Question: How can the cacti-plugin-0.8.7g-PA-v2.9.diff be adusted to fix the rejected lines ?
Contents of data_sources.php.rej and poller.php.rej at [2]
Thanks Glenn

tar -xvf cacti-0.8.7g.tar
cd cacti-0.8.7g
patch -p1 -N < ../cacti-plugin-0.8.7g-PA-v2.9.diff
cd ..
mv cacti-0.8.7g/*.rej .
ls -la *.rej
cat data_sources.php.rej
cat poller.php.rej

[1]
patching file data_sources.php
Hunk #6 FAILED at 1323.
1 out of 6 hunks FAILED -- saving rejects to file data_sources.php.rej

patching file poller.php
Hunk #1 succeeded at 108 with fuzz 2.
Hunk #2 succeeded at 306 (offset 1 line).
Hunk #3 FAILED at 431.
Hunk #4 FAILED at 450.
Hunk #5 succeeded at 499 (offset 2 lines).
2 out of 5 hunks FAILED -- saving rejects to file poller.php.rej


[2]

# cat data_sources.php.rej
--- data_sources.php 2010-09-19 21:39:05.000000000 -0400
+++ data_sources.php 2010-10-17 20:09:52.000000000 -0400
@@ -1323,8 +1336,10 @@
$i = 0;
if (sizeof($data_sources) > 0) {
foreach ($data_sources as $data_source) {
+ $data_source["data_template_name"] = htmlspecialchars($data_source["data_template_name"]);
+ $data_source = api_plugin_hook_function('data_sources_table', $data_source);
/* we're escaping strings here, so no need to escape them on form_selectable_cell */
- $data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : htmlspecialchars($data_source["data_template_name"]));
+ $data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);
$data_input_name = ((empty($data_source["data_input_name"])) ? "<em>External</em>" : htmlspecialchars($data_source["data_input_name"]));
$poller_interval = ((isset($poller_intervals[$data_source["local_data_id"]])) ? $poller_intervals[$data_source["local_data_id"]] : 0);
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $data_source["local_data_id"]); $i++;

# cat poller.php.rej
--- poller.php 2010-09-19 21:39:06.000000000 -0400
+++ poller.php 2010-10-17 20:09:52.000000000 -0400
@@ -431,7 +435,7 @@

/* record the start time for this loop */
list($micro,$seconds) = explode(" ", microtime());
- $loop_end = $seconds + $micro;
+ $loop_end = $seconds + $micro;
$loop_time = $loop_end - $loop_start;

if ($loop_time < $poller_interval) {
@@ -450,7 +454,9 @@

/* sleep the appripriate amount of time */
if ($poller_runs_completed < $poller_runs) {
+ api_plugin_hook('poller_bottom');
usleep($sleep_time * 1000000);
+ api_plugin_hook('poller_top');
}
}else if (read_config_option('log_verbosity') >= POLLER_VERBOSITY_MEDIUM || $debug) {
cacti_log("WARNING: Cacti Polling Cycle Exceeded Poller Interval by " . $loop_end-$loop_start-$poller_interval . " seconds", TRUE, "POLLER");
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: patch/diff Plugin Architecture 2.9 with cacti 0.8.7g fai

Post by noname »

If you want to use PA2.9 (not 2.8) on Cacti0.8.7g, please apply official patches before installing PA.
http://forums.cacti.net/viewtopic.php?p=208022#p208022
Firefig
Posts: 2
Joined: Thu Oct 13, 2011 1:48 am

Re: patch/diff Plugin Architecture 2.9 with cacti 0.8.7g fai

Post by Firefig »

As far as I understand you squashed all the patches provided by cacti into one, which we don't want to do, because when they will put out a new patch we will have to do it again instead of just adding it to the
patch list.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests