Linux patch usage

Source: Internet
Author: User
Document directory
  • Create a patch file:
  • -P0 or-P1? Directory level of the patch command:

Maybe I am a stupid person. Every time I encounter a bug, although someone provides a patch, I don't know how to use it. Manual page (man patch) only provides the usage of patch-P (Num) <patchfile, and does not know how to determine num. If you have such doubts, please continue reading. The following content is from here

Create a patch file:

Diff-Naur olddir newdir> New-patch
-Or-
Diff-Naur oldfile newfile> New-patch

-P0 or-P1? Directory level of the patch command:

The-P option can selectively intercept the directory hierarchy of the patchfile. For example, if your patchfile header is like the following:

--- Old/modules/pcitable mon Sep 27 11:03:56 1999
++ New/modules/pcitable Tue Dec 19 20:05:41 2000

Use-P0 to search for a new sub-folder under your current path, search for "modules" under "new", and then find "pcitable" under it ".

Use-P1 to truncate the first directory, that is, the patch will directly search for "modules" in the current path, and then "pcitable"

And so on.

It is actually very simple.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.