Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I generated a patchfile of 2 directories using this command:

diff -ur source-20110125 source > mailpatch3.patch

Now I would like to apply the patch, doing this:

patch -p1 < mailpatch3.patch

But it then asks me for the file to patch. Why?

Something that looks strange to me in the patch file: there are a lot of "common subdirectories" lines. Like this:

Common subdirectories: source-20110125/ac_depository and source/ac_depository
Common subdirectories: source-20110125/ac_depository_jar and source/ac_depository_jar
Common subdirectories: source-20110125/_backoffice and source/_backoffice
Common subdirectories: source-20110125/_csvexport and source/_csvexport
Common subdirectories: source-20110125/_foundation and source/_foundation
Common subdirectories: source-20110125/_impex and source/_impex

And I don't really know why they're there.

The rest of the patch looks normal.

share|improve this question

Most likely you have the wrong -p setting for trimming prefixes from your paths. If you were below the two source directories when generating the patch, then you should be inside the source directory to apply the patch with -p1.

share|improve this answer
I should only have to strip one. However, for the sake of making sure, I've tested -p 0 to 9. Nothing worked. – skerit Feb 9 '11 at 9:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.