⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 patch.man

📁 制作2.6内核的CLFS时 patch包
💻 MAN
📖 第 1 页 / 共 3 页
字号:
.BR ed (1).SpMarshall T. Rose and Einar A. Stefferud,Proposed Standard for Message Encapsulation,Internet RFC 934 <URL:ftp://ftp.isi.edu/in-notes/rfc934.txt> (1985-01)..SH "NOTES FOR PATCH SENDERS"There are several things you should bear in mind if you are going tobe sending out patches..PPCreate your patch systematically.A good method is the command.BI "diff\ \-Naur\ " "old\ new"where.I oldand.I newidentify the old and new directories.The names.I oldand.I newshould not contain any slashes.The.B diffcommand's headers should have datesand times in Universal Time using traditional Unix format,so that patch recipients can use the.B \-Zor.B \*=set\-utcoption.Here is an example command, using Bourne shell syntax:.Sp	\fBLC_ALL=C TZ=UTC0 diff \-Naur gcc\-2.7 gcc\-2.8\fP.PPTell your recipients how to apply the patchby telling them which directory to.B cdto, and which.B patchoptions to use.  The option string.B "\-Np1"is recommended.Test your procedure by pretending to be a recipient and applyingyour patch to a copy of the original files..PPYou can save people a lot of grief by keeping a.B patchlevel.hfile which is patched to increment the patch levelas the first diff in the patch file you send out.If you put a.B Prereq:\&line in with the patch, it won't let them applypatches out of order without some warning..PPYou can create a file by sending out a diff that compares.B /dev/nullor an empty file dated the Epoch (1970-01-01 00:00:00 \s-1UTC\s0)to the file you want to create.This only works if the file you want to create doesn't exist already inthe target directory.Conversely, you can remove a file by sending out a context diff that comparesthe file to be deleted with an empty file dated the Epoch.The file will be removed unless.B patchis conforming to \s-1POSIX\s0 and the.B \-Eor.B \*=remove\-empty\-filesoption is not given.An easy way to generate patches that create and remove filesis to use \s-1GNU\s0.BR diff 's.B \-Nor.B \*=new\-fileoption..PPIf the recipient is supposed to use the.BI \-p Noption, do not send output that looks like this:.Sp.ft B.ne 3	diff \-Naur v2.0.29/prog/README prog/README.br	\-\^\-\^\- v2.0.29/prog/README   Mon Mar 10 15:13:12 1997.br	+\^+\^+ prog/README   Mon Mar 17 14:58:22 1997.ft.Spbecause the two file names have different numbers of slashes,and different versions of.B patchinterpret the file names differently.To avoid confusion, send output that looks like this instead:.Sp.ft B.ne 3	diff \-Naur v2.0.29/prog/README v2.0.30/prog/README.br	\-\^\-\^\- v2.0.29/prog/README   Mon Mar 10 15:13:12 1997.br	+\^+\^+ v2.0.30/prog/README   Mon Mar 17 14:58:22 1997.ft.Sp.PPAvoid sending patches that compare backup file names like.BR README.orig ,since this might confuse.B patchinto patching a backup file instead of the real file.Instead, send patches that compare the same base file namesin different directories, e.g.\&.B old/READMEand.BR new/README ..PPTake care not to send out reversed patches, since it makes people wonderwhether they already applied the patch..PPTry not to have your patch modify derived files(e.g. the file.B configurewhere there is a line.B "configure: configure.in"in your makefile), since the recipient should beable to regenerate the derived files anyway.If you must send diffs of derived files,generate the diffs using \s-1UTC\s0,have the recipients apply the patch with the.B \-Zor.B \*=set\-utcoption, and have them remove any unpatched files that depend on patched files(e.g. with.BR "make\ clean" )..PPWhile you may be able to get away with putting 582 diff listings intoone file, it may be wiser to group related patches into separate files incase something goes haywire..SH DIAGNOSTICSDiagnostics generally indicate that.B patchcouldn't parse your patch file..PPIf the.B \*=verboseoption is given, the message.B Hmm.\|.\|.\&indicates that there is unprocessed text inthe patch file and that.B patchis attempting to intuit whether there is a patch in that text and, if so,what kind of patch it is..PP.BR patch 'sexit status is0 if all hunks are applied successfully,1 if some hunks cannot be applied,and 2 if there is more serious trouble.When applying a set of patches in a loop it behooves you to check thisexit status so you don't apply a later patch to a partially patched file..SH CAVEATSContext diffs cannot reliably represent the creation or deletion ofempty files, empty directories, or special files such as symbolic links.Nor can they represent changes to file metadata like ownership, permissions,or whether one file is a hard link to another.If changes like these are also required, separate instructions(e.g. a shell script) to accomplish them should accompany the patch..PP.B patchcannot tell if the line numbers are off in an.B edscript, and can detectbad line numbers in a normal diff only when it finds a change or deletion.A context diff using fuzz factor 3 may have the same problem.Until a suitable interactive interface is added, you should probably doa context diff in these cases to see if the changes made sense.Of course, compiling without errors is a pretty good indication that the patchworked, but not always..PP.B patchusually produces the correct results, even when it has to do a lot ofguessing.However, the results are guaranteed to be correct only when the patch isapplied to exactly the same version of the file that the patch wasgenerated from..SH "COMPATIBILITY ISSUES"The \s-1POSIX\s0 standard specifies behavior that differs from.BR patch 'straditional behavior.You should be aware of these differences if you must interoperate with.B patchversions 2.1 and earlier, which do not conform to \s-1POSIX\s0..TP 3.B " \(bu"In traditional.BR patch ,the.B \-poption's operand was optional, and a bare.B \-pwas equivalent to.BR \-p0.The.B \-poption now requires an operand, and.B "\-p\ 0"is now equivalent to.BR \-p0 .For maximum compatibility, use options like.B \-p0and.BR \-p1 ..SpAlso,traditional.B patchsimply counted slashes when stripping path prefixes;.B patchnow counts pathname components.That is, a sequence of one or more adjacent slashesnow counts as a single slash.For maximum portability, avoid sending patches containing.B //in file names..TP.B " \(bu"In traditional.BR patch ,backups were enabled by default.This behavior is now enabled with the.B \-bor.B \*=backupoption..SpConversely, in \s-1POSIX\s0.BR patch ,backups are never made, even when there is a mismatch.In \s-1GNU\s0.BR patch ,this behavior is enabled with the.B \*=no\-backup\-if\-mismatchoption, or by conforming to \s-1POSIX\s0 with the.B \*=posixoption or by setting the.B POSIXLY_CORRECTenvironment variable..SpThe.BI \-b "\ suffix"optionof traditional.B patchis equivalent to the.BI "\-b\ \-z" "\ suffix"options of \s-1GNU\s0.BR patch ..TP.B " \(bu"Traditional.B patchused a complicated (and incompletely documented) methodto intuit the name of the file to be patched from the patch header.This method did not conform to \s-1POSIX\s0, and had a few gotchas.Now.B patchuses a different, equally complicated (but better documented) methodthat is optionally \s-1POSIX\s0-conforming; we hope it hasfewer gotchas.  The two methods are compatible if thefile names in the context diff header and the.B Index:\&line are all identical after prefix-stripping.Your patch is normally compatible if each header's file namesall contain the same number of slashes..TP.B " \(bu"When traditional.B patchasked the user a question, it sent the question to standard errorand looked for an answer fromthe first file in the following list that was a terminal:standard error, standard output,.BR /dev/tty ,and standard input.Now.B patchsends questions to standard output and gets answers from.BR /dev/tty .Defaults for some answers have been changed so that.B patchnever goes into an infinite loop when using default answers..TP.B " \(bu"Traditional.B patchexited with a status value that counted the number of bad hunks,or with status 1 if there was real trouble.Now.B patchexits with status 1 if some hunks failed,or with 2 if there was real trouble..TP.B " \(bu"Limit yourself to the following options when sending instructionsmeant to be executed by anyone running \s-1GNU\s0.BR patch ,traditional.BR patch ,or a.B patchthat conforms to \s-1POSIX\s0.Spaces are significant in the following list, and operands are required..Sp.nf.in +3.ne 11.B \-c.BI \-d " dir".BI \-D " define".B \-e.B \-l.B \-n.B \-N.BI \-o " outfile".BI \-p num.B \-R.BI \-r " rejectfile".in.fi.SH BUGSPlease report bugs via email to.BR <bug-patch@gnu.org> ..PP.B patchcould be smarter about partial matches, excessively deviant offsets andswapped code, but that would take an extra pass..PPIf code has been duplicated (for instance with\fB#ifdef OLDCODE\fP .\|.\|. \fB#else .\|.\|. #endif\fP),.B patchis incapable of patching both versions, and, if it works at all, will likelypatch the wrong one, and tell you that it succeeded to boot..PPIf you apply a patch you've already applied,.B patchthinks it is a reversed patch, and offers to un-apply the patch.This could be construed as a feature..SH COPYINGCopyright.ie t \(co.el (C)1984, 1985, 1986, 1988 Larry Wall..brCopyright.ie t \(co.el (C)1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,2000, 2001, 2002 Free Software Foundation, Inc..PPPermission is granted to make and distribute verbatim copies ofthis manual provided the copyright notice and this permission noticeare preserved on all copies..PPPermission is granted to copy and distribute modified versions of thismanual under the conditions for verbatim copying, provided that theentire resulting derived work is distributed under the terms of apermission notice identical to this one..PPPermission is granted to copy and distribute translations of thismanual into another language, under the above conditions for modifiedversions, except that this permission notice may be included intranslations approved by the copyright holders instead of inthe original English..SH AUTHORSLarry Wall wrote the original version of.BR patch .Paul Eggert removed.BR patch 'sarbitrary limits; added support for binary files,setting file times, and deleting files;and made it conform better to \s-1POSIX\s0.Other contributors include Wayne Davison, who added unidiff support,and David MacKenzie, who added configuration and backup support.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -