Is this a bad patch, or am I doing something wrong?

Patch tells you exactly what you're doing wrong.

Here is a short patch tutorial for you in the form of a shell/batch file

md tmp cd tmp md old md old1 md old2 md old3 md new echo >old/f1 echo >old1/f1 echo >old2/f1 echo >old3/f1 echo >new/f1 echo >>new/f1 diff -ruN old new >temp.patch patch -p0 -dold1 < temp.patch patch -p1 -dold1 < temp.patch cd old2 patch < ../temp.patch cd ../old3 patch -p0 < ../temp.patch patch -p1 < ../temp.patch cd .. cat old/f1 cat old1/f1 cat old2/f1 cat old3/f1 cat new/f1 cat temp.patch
Here is the output of the run (notice the same error message)
$ md tmp $ cd tmp $ md old $ md old1 $ md old2 $ md old3 $ md new $ echo >old\f1 $ echo >old1\f1 $ echo >old2\f1 $ echo >old3\f1 $ $ echo >new\f1 $ echo >>new\f1 $ $ diff -ruN old new >temp.patch $ $ patch -p0 -dold1 < temp.patch can't find file to patch at input line 4 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |diff -ruN old/f1 new/f1 |--- old/f1 2010-04-22 23:57:33.843750000 -0700 |+++ new/f1 2010-04-22 23:57:33.859375000 -0700 -------------------------- File to patch: patch -p1 -dold1 < temp.patch patch: No such file or directory Skip this patch? [y] Skipping patch. 1 out of 1 hunk ignored $ cd old2 $ patch < ../temp.patch patching file f1 $ cd ../old3 $ patch -p0 < ../temp.patch can't find file to patch at input line 4 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |diff -ruN old/f1 new/f1 |--- old/f1 2010-04-22 23:57:33.843750000 -0700 |+++ new/f1 2010-04-22 23:57:33.859375000 -0700 -------------------------- File to patch: patch -p1 < ../temp.patch patch: No such file or directory Skip this patch? [y] Skipping patch. 1 out of 1 hunk ignored $ cd .. $ cat old\f1 ECHO is on. $ cat old1\f1 ECHO is on. $ cat old2\f1 ECHO is on. ECHO is on. $ cat old3\f1 ECHO is on. $ cat new\f1 ECHO is on. ECHO is on. $ cat temp.patch diff -ruN old/f1 new/f1 --- old/f1 2010-04-22 23:57:33.843750000 -0700 +++ new/f1 2010-04-22 23:57:33.859375000 -0700 @@ -1 +1,2 @@ ECHO is on. +ECHO is on. $ cd .. $ rm -rf tmp $ sscite snap.bat $ pwd D:\tmp $ call snap.bat $ md tmp $ cd tmp $ md old $ md old1 $ md old2 $ md old3 $ md new $ echo 1>old/f1 $ echo 1>old1/f1 $ echo 1>old2/f1 $ echo 1>old3/f1 $ echo 1>new/f1 $ echo 1>>new/f1 $ diff -ruN old new 1>temp.patch $ patch -p0 -dold1 0<temp.patch can't find file to patch at input line 4 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |diff -ruN old/f1 new/f1 |--- old/f1 2010-04-22 23:59:47.968750000 -0700 |+++ new/f1 2010-04-22 23:59:47.968750000 -0700 -------------------------- File to patch: Skip this patch? [y] Skipping patch. 1 out of 1 hunk ignored $ patch -p1 -dold1 0<temp.patch patching file f1 $ cd old2 $ patch 0<../temp.patch patching file f1 $ cd ../old3 $ patch -p0 0<../temp.patch can't find file to patch at input line 4 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |diff -ruN old/f1 new/f1 |--- old/f1 2010-04-22 23:59:47.968750000 -0700 |+++ new/f1 2010-04-22 23:59:47.968750000 -0700 -------------------------- File to patch: Skip this patch? [y] Skipping patch. 1 out of 1 hunk ignored $ patch -p1 0<../temp.patch patching file f1 $ cd .. $ cat old/f1 ECHO is on. $ cat old1/f1 ECHO is on. ECHO is on. $ cat old2/f1 ECHO is on. ECHO is on. $ cat old3/f1 ECHO is on. ECHO is on. $ cat new/f1 ECHO is on. ECHO is on. $ cat temp.patch diff -ruN old/f1 new/f1 --- old/f1 2010-04-22 23:59:47.968750000 -0700 +++ new/f1 2010-04-22 23:59:47.968750000 -0700 @@ -1 +1,2 @@ ECHO is on. +ECHO is on. $

In reply to Re: How to apply a patch on Windows? by Anonymous Monk
in thread How to apply a patch on Windows? by mnooning

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.