How to apply patches

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Moderators, Developers

Post Reply
Posts: 7
Joined: Sat Oct 23, 2004 10:03 am

How to apply patches

#1 Post by bilbo » Thu Nov 25, 2004 3:26 am

Where do you get the patches?
You can get the patches at Choose your current version and download the patch(es) to your running cacti directory.

Where to place the patches?
Have a look at the patch file. You will see something like

Code: Select all

--- cacti-release-0.8.6/user_admin.php  2004-08-29 11:36:04.000000000 -0400
+++ cacti-unstable/user_admin.php       2004-11-02 00:28:15.000000000 -0500
This patch goes to the cacti main directory.
Often you will see something like

Code: Select all

--- cacti-0.8.6b/lib/functions.php      2004-10-06 22:20:35.000000000 -0400
+++ cacti-0.8.6b-new/lib/functions.php  2004-11-14 20:49:56.000000000 -0500
Put this patch into cacti ./lib/ directory.

How to apply the patch?
Ok, I only know how to patch for linux. There is (or at least: should be) a programm called patch. cd to the requested directory, e.g. the cacti ./lib/ directory. Then apply the patch via

Code: Select all

patch < filename_of_the_patch_you_want_to_apply
What will look strange?
Sometimes, you will see
  • # patch < xml_import_error_reporting.patch
    patching file config_arrays.php
    can't find file to patch at input line 26
    Perhaps you should have used the -p or --strip option?
    The text leading up to this was:
    |diff -ruBbd cacti-0.8.6b/lib/import.php cacti-0.8.6b-new/lib/import.php
    |--- cacti-0.8.6b/lib/import.php 2004-10-06 22:20:35.000000000 -0400
    |+++ cacti-0.8.6b-new/lib/import.php 2004-11-17 17:55:28.000000000 -0500
    File to patch:
Answer with the requested filename
  • File to patch: ../lib/import.php
    patching file ../lib/import.php
(All file names in italics will vary according to the specific patch)

What, if patch applied in incorrect order?
If there are 2 or more patches going to the same file, the line numbers used may not match exactly. You will see
  • # patch < cdef_similar_data_sources.patch
    patching file rrd.php
    Hunk #1 succeeded at 802 (offset 4 lines).
    Hunk #3 succeeded at 823 (offset 4 lines).
    Hunk #5 succeeded at 847 (offset 4 lines).
That's fine, you should not be worried.


Post Reply