RE: embarrassing patch question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 28, 2002 at 11:46 AM, John F Davis wrote:
> Put another way, in your step 2.2, what is the implied 
> directory name used for the patch?  What is the p1 or 
> p0 bit?  Is that supposed to somehow strip the leading 
> directory name or something? 

Yes, the digit after the "-p" tells patch how many leading 
directory names to ignore. These are the directory names 
that are found inside the patch.file itself. Most kernel 
patches are designed to be used with "-p1" because it 
allows the author to have a completely bogus top level 
directory that labels what version is to be patched.

For example, the top three lines of one of my patches:

diff -urN -X dontdiff.txt linux-2.4.18-rc1/drivers/pci/pci.ids
rc1-ml/drivers/pci/pci.ids
--- linux-2.4.18-rc1/drivers/pci/pci.ids	Fri Feb 15 14:24:19 2002
+++ rc1-ml/drivers/pci/pci.ids	Fri Feb 15 14:49:07 2002

I would expect the user of the patch to execute patch in his top 
level source tree directory, perhaps named /usr/src/my-linux, with 
the -p1 specified so patch ignores the "linux-2.4.18-rc1" directory 
specified on the "---" line, and the "rc1-ml" directory specified on 
the "+++" line of my patch.file. Thus patch is looking for directory 
drivers/pci ... which it will find in its current directory, 
/usr/src/my-linux. The directory where patch will look for the file 
to be patched, pci.ids, is /usr/src/my-linux/drivers/pci. My leading 
directory name was chosen to inform the user that this patch was 
created from the version 2.4.18-rc1 kernel files.

>                               When you issue that
> command, are you in the parent directory which owns
> the kernel directory to be patched or are you in the 
> directory to be patched?

Is it clearer now? Patch ignores the leading directories that you 
tell it to ignore, and looks for the rest of the specified path in 
it's current directory.

Best regards,
---------------------------------------------------------------- 
Ed Vance              edv@macrolink.com
Macrolink, Inc.       1500 N. Kellogg Dr  Anaheim, CA  92807
----------------------------------------------------------------

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux