Patch files (*.diff) for patching under FreeBSD

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Mike Sullivan
    replied
    Actually, it has to do with line 6 being "" (empty) instead of " " (a space), which was the expected value. This has to do with the fact that most of us use a text editor that trims trailing spaces on save.

    Clearly, newer versions of patch just handle this case better.

    Leave a comment:


  • Makc666
    started a topic Patch files (*.diff) for patching under FreeBSD

    Patch files (*.diff) for patching under FreeBSD

    A little question for vBulletin team.
    What soft you are using to create patch files (*.diff) to generate patch(*.diff) files?

    Today I meet with a problem under FreeBSD using
    Code:
    patch -u < ./23050.diff



    and geting error:

    Code:
    Hmm...  Looks like a unified diff to me...
    The text leading up to this was:
    --------------------------
    |Index: /admincp/blog_admin.php
    |===================================================================
    |--- /admincp/blog_admin.php (revision 17990)
    |+++ /admincp/blog_admin.php (revision 17996)
    --------------------------
    Patching file blog_admin.php using Plan A...
    [COLOR=red]patch: **** malformed patch at line 6:[/COLOR] 
    Press any key to continue...
    So I took old blog_admin.php made a new one manually and run
    Code:
    diff -crbBNu blog_admin_old.php blog_admin.php >23050_new.diff
    Then I copmared the problem line and found out that your diff has:
    Code:
    @@ -245,6 +245,9 @@
     
            // rebuild category counters
    +       $tablename = 'blog_category_count' . $vbulletin->userinfo['userid'];
    +
    +       $vbulletin->db->query_write("DROP TABLE IF EXISTS " . TABLE_PREFIX . "$tablename");
            $db->query_write("
    -       CREATE TEMPORARY TABLE " . TABLE_PREFIX . "blog_category_count
    +       CREATE TABLE " . TABLE_PREFIX . "$tablename
                    (
                            blogcategoryid INT UNSIGNED NOT NULL DEFAULT '0',
    And my new has:
    Code:
    @@ -244,8 +244,11 @@
            $tabletype = (version_compare(MYSQL_VERSION, '4.1', '<')) ? 'HEAP' : 'MEMORY';
     
            // rebuild category counters
    +       $tablename = 'blog_category_count' . $vbulletin->userinfo['userid'];
    +
    +       $vbulletin->db->query_write("DROP TABLE IF EXISTS " . TABLE_PREFIX . "$tablename");
            $db->query_write("
    -       CREATE TEMPORARY TABLE " . TABLE_PREFIX . "blog_category_count
    +       CREATE TABLE " . TABLE_PREFIX . "$tablename
                    (
                            blogcategoryid INT UNSIGNED NOT NULL DEFAULT '0',
                            total INT UNSIGNED NOT NULL DEFAULT '0',
    As you can notice your diff starts from 245 line.
    And that line is empty...

    My diff starts from 244 line.
    And that line has information.

    So I came to conclusion that diff blocks
    @@ -245,6 +245,9 @@
    must not start from the empty lines...

    P.S. I also tried a software from this thread:
    How to use Patch files (*.diff) for patching your vBulletin installation
    But it also gives me an error...

    Patch I used:
    /usr/bin/patch -v
    Patch version 2.1

    So then I go to
    /usr/ports/devel/patch
    and run 'make'

    Copied patch from
    /usr/ports/devel/patch/work/patch-2.5.4/
    directory to
    /usr/local/bin/

    /usr/local/bin/patch -v
    patch 2.5.4

    When I used this patch it patched the file OK.
    /usr/local/bin/patch -u /www/blog_admin.php /www/23050.diff

    Hope this one can help anyone.

    FreeBSD 6.1-RELEASE #2
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...