home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / GCC / GCC258_3.LHA / gcc / info / diff.info-3 < prev    next >
Encoding:
GNU Info File  |  1993-12-07  |  45.8 KB  |  1,322 lines

  1. This is Info file diff.info, produced by Makeinfo-1.55 from the input
  2. file ./diff.texi.
  3.  
  4.    This file documents the the GNU `diff', `diff3', `sdiff', and `cmp'
  5. commands for showing the differences between text files and the `patch'
  6. command for using their output to update files.
  7.  
  8.    Copyright (C) 1992, 1993 Free Software Foundation, Inc.
  9.  
  10.    Permission is granted to make and distribute verbatim copies of this
  11. manual provided the copyright notice and this permission notice are
  12. preserved on all copies.
  13.  
  14.    Permission is granted to copy and distribute modified versions of
  15. this manual under the conditions for verbatim copying, provided that
  16. the entire resulting derived work is distributed under the terms of a
  17. permission notice identical to this one.
  18.  
  19.    Permission is granted to copy and distribute translations of this
  20. manual into another language, under the above conditions for modified
  21. versions, except that this permission notice may be stated in a
  22. translation approved by the Foundation.
  23.  
  24. 
  25. File: diff.info,  Node: Making Patches,  Next: Invoking cmp,  Prev: Merging with patch,  Up: Top
  26.  
  27. Tips for Making Patch Distributions
  28. ***********************************
  29.  
  30.    Here are some things you should keep in mind if you are going to
  31. distribute patches for updating a software package.
  32.  
  33.    Make sure you have specified the file names correctly, either in a
  34. context diff header or with an `Index:' line.  If you are patching
  35. files in a subdirectory, be sure to tell the patch user to specify a
  36. `-p' or `--strip' option as needed.  Take care to not send out reversed
  37. patches, since these make people wonder whether they have already
  38. applied the patch.
  39.  
  40.    To save people from partially applying a patch before other patches
  41. that should have gone before it, you can make the first patch in the
  42. patch file update a file with a name like `patchlevel.h' or
  43. `version.c', which contains a patch level or version number.  If the
  44. input file contains the wrong version number, `patch' will complain
  45. immediately.
  46.  
  47.    An even clearer way to prevent this problem is to put a `Prereq:'
  48. line before the patch.  If the leading text in the patch file contains a
  49. line that starts with `Prereq:', `patch' takes the next word from that
  50. line (normally a version number) and checks whether the next input file
  51. contains that word, preceded and followed by either white space or a
  52. newline.  If not, `patch' prompts you for confirmation before
  53. proceeding.  This makes it difficult to accidentally apply patches in
  54. the wrong order.
  55.  
  56.    Since `patch' does not handle incomplete lines properly, make sure
  57. that all the source files in your program end with a newline whenever
  58. you release a version.
  59.  
  60.    To create a patch that changes an older version of a package into a
  61. newer version, first make a copy of the older version in a scratch
  62. directory.  Typically you do that by unpacking a `tar' or `shar'
  63. archive of the older version.
  64.  
  65.    You might be able to reduce the size of the patch by renaming or
  66. removing some files before making the patch.  If the older version of
  67. the package contains any files that the newer version does not, or if
  68. any files have been renamed between the two versions, make a list of
  69. `rm' and `mv' commands for the user to execute in the old version
  70. directory before applying the patch.  Then run those commands yourself
  71. in the scratch directory.
  72.  
  73.    If there are any files that you don't need to include in the patch
  74. because they can easily be rebuilt from other files (for example,
  75. `TAGS' and output from `yacc' and `makeinfo'), replace the versions in
  76. the scratch directory with the newer versions, using `rm' and `ln' or
  77. `cp'.
  78.  
  79.    Now you can create the patch.  The de-facto standard `diff' format
  80. for patch distributions is context format with two lines of context,
  81. produced by giving `diff' the `-C 2' option.  Do not use less than two
  82. lines of context, because `patch' typically needs at least two lines
  83. for proper operation.  Give `diff' the `-P' option in case the newer
  84. version of the package contains any files that the older one does not.
  85. Make sure to specify the scratch directory first and the newer
  86. directory second.
  87.  
  88.    Add to the top of the patch a note telling the user any `rm' and
  89. `mv' commands to run before applying the patch.  Then you can remove
  90. the scratch directory.
  91.  
  92. 
  93. File: diff.info,  Node: Invoking cmp,  Next: Invoking diff,  Prev: Making Patches,  Up: Top
  94.  
  95. Invoking `cmp'
  96. **************
  97.  
  98.    The `cmp' command compares two files, and if they differ, tells the
  99. first byte and line number where they differ.  Its arguments are as
  100. follows:
  101.  
  102.      cmp OPTIONS... FROM-FILE [TO-FILE]
  103.  
  104.    The file name `-' is always the standard input.  `cmp' also uses the
  105. standard input if one file name is omitted.
  106.  
  107.    An exit status of 0 means no differences were found, 1 means some
  108. differences were found, and 2 means trouble.
  109.  
  110. * Menu:
  111.  
  112. * cmp Options::        Summary of options to `cmp'.
  113.  
  114. 
  115. File: diff.info,  Node: cmp Options,  Up: Invoking cmp
  116.  
  117. Options to `cmp'
  118. ================
  119.  
  120.    Below is a summary of all of the options that GNU `cmp' accepts.
  121. Most options have two equivalent names, one of which is a single letter
  122. preceded by `-', and the other of which is a long name preceded by
  123. `--'.  Multiple single letter options (unless they take an argument)
  124. can be combined into a single command line word: `-cl' is equivalent to
  125. `-c -l'.
  126.  
  127. `-c'
  128.      Print the differing characters.  Display control characters as a
  129.      `^' followed by a letter of the alphabet and precede characters
  130.      that have the high bit set with `M-' (which stands for "meta").
  131.  
  132. `--ignore-initial=BYTES'
  133.      Ignore any differences in the the first BYTES bytes of the input
  134.      files.  Treat files with fewer than BYTES bytes as if they are
  135.      empty.
  136.  
  137. `-l'
  138.      Print the (decimal) offsets and (octal) values of all differing
  139.      bytes.
  140.  
  141. `--print-chars'
  142.      Print the differing characters.  Display control characters as a
  143.      `^' followed by a letter of the alphabet and precede characters
  144.      that have the high bit set with `M-' (which stands for "meta").
  145.  
  146. `--quiet'
  147. `-s'
  148. `--silent'
  149.      Do not print anything; only return an exit status indicating
  150.      whether the files differ.
  151.  
  152. `--verbose'
  153.      Print the (decimal) offsets and (octal) values of all differing
  154.      bytes.
  155.  
  156. 
  157. File: diff.info,  Node: Invoking diff,  Next: Invoking diff3,  Prev: Invoking cmp,  Up: Top
  158.  
  159. Invoking `diff'
  160. ***************
  161.  
  162.    The format for running the `diff' command is:
  163.  
  164.      diff OPTIONS... FROM-FILE TO-FILE
  165.  
  166.    In the simplest case, `diff' compares the contents of the two files
  167. FROM-FILE and TO-FILE.  A file name of `-' stands for text read from
  168. the standard input.  As a special case, `diff - -' compares a copy of
  169. standard input to itself.
  170.  
  171.    If FROM-FILE is a directory and TO-FILE is not, `diff' compares the
  172. file in FROM-FILE whose file name is that of TO-FILE, and vice versa.
  173. The non-directory file must not be `-'.
  174.  
  175.    If both FROM-FILE and TO-FILE are directories, `diff' compares
  176. corresponding files in both directories, in alphabetical order; this
  177. comparison is not recursive unless the `-r' or `--recursive' option is
  178. given.  `diff' never compares the actual contents of a directory as if
  179. it were a file.  The file that is fully specified may not be standard
  180. input, because standard input is nameless and the notion of "file with
  181. the same name" does not apply.
  182.  
  183.    `diff' options begin with `-', so normally FROM-FILE and TO-FILE may
  184. not begin with `-'.  However, `--' as an argument by itself treats the
  185. remaining arguments as file names even if they begin with `-'.
  186.  
  187.    An exit status of 0 means no differences were found, 1 means some
  188. differences were found, and 2 means trouble.
  189.  
  190. * Menu:
  191.  
  192. * diff Options::    Summary of options to `diff'.
  193.  
  194. 
  195. File: diff.info,  Node: diff Options,  Up: Invoking diff
  196.  
  197. Options to `diff'
  198. =================
  199.  
  200.    Below is a summary of all of the options that GNU `diff' accepts.
  201. Most options have two equivalent names, one of which is a single letter
  202. preceded by `-', and the other of which is a long name preceded by
  203. `--'.  Multiple single letter options (unless they take an argument)
  204. can be combined into a single command line word: `-ac' is equivalent to
  205. `-a -c'.  Long named options can be abbreviated to any unique prefix of
  206. their name.  Brackets ([ and ]) indicate that an option takes an
  207. optional argument.
  208.  
  209. `-LINES'
  210.      Show LINES (an integer) lines of context.  This option does not
  211.      specify an output format by itself; it has no effect unless it is
  212.      combined with `-c' (*note Context Format::.) or `-u' (*note
  213.      Unified Format::.).  This option is obsolete.  For proper
  214.      operation, `patch' typically needs at least two lines of context.
  215.  
  216. `-a'
  217.      Treat all files as text and compare them line-by-line, even if they
  218.      do not seem to be text.  *Note Binary::.
  219.  
  220. `-b'
  221.      Ignore changes in amount of white space.  *Note White Space::.
  222.  
  223. `-B'
  224.      Ignore changes that just insert or delete blank lines.  *Note
  225.      Blank Lines::.
  226.  
  227. `--brief'
  228.      Report only whether the files differ, not the details of the
  229.      differences.  *Note Brief::.
  230.  
  231. `-c'
  232.      Use the context output format.  *Note Context Format::.
  233.  
  234. `-C LINES'
  235. `--context[=LINES]'
  236.      Use the context output format, showing LINES (an integer) lines of
  237.      context, or three if LINES is not given.  *Note Context Format::.
  238.      For proper operation, `patch' typically needs at least two lines of
  239.      context.
  240.  
  241. `--changed-group-format=FORMAT'
  242.      Use FORMAT to output a line group containing differing lines from
  243.      both files in if-then-else format.  *Note Line Group Formats::.
  244.  
  245. `-d'
  246.      Change the algorithm perhaps find a smaller set of changes.  This
  247.      makes `diff' slower (sometimes much slower).  *Note diff
  248.      Performance::.
  249.  
  250. `-D NAME'
  251.      Make merged `#ifdef' format output, conditional on the preprocessor
  252.      macro NAME.  *Note If-then-else::.
  253.  
  254. `-e'
  255. `--ed'
  256.      Make output that is a valid `ed' script.  *Note ed Scripts::.
  257.  
  258. `--exclude=PATTERN'
  259.      When comparing directories, ignore files and subdirectories whose
  260.      basenames match PATTERN.  *Note Comparing Directories::.
  261.  
  262. `--exclude-from=FILE'
  263.      When comparing directories, ignore files and subdirectories whose
  264.      basenames match any pattern contained in FILE.  *Note Comparing
  265.      Directories::.
  266.  
  267. `--expand-tabs'
  268.      Expand tabs to spaces in the output, to preserve the alignment of
  269.      tabs in the input files.  *Note Tabs::.
  270.  
  271. `-f'
  272.      Make output that looks vaguely like an `ed' script but has changes
  273.      in the order they appear in the file.  *Note Forward ed::.
  274.  
  275. `-F REGEXP'
  276.      In context and unified format, for each hunk of differences, show
  277.      some of the last preceding line that matches REGEXP.  *Note
  278.      Specified Headings::.
  279.  
  280. `--forward-ed'
  281.      Make output that looks vaguely like an `ed' script but has changes
  282.      in the order they appear in the file.  *Note Forward ed::.
  283.  
  284. `-h'
  285.      This option currently has no effect; it is present for Unix
  286.      compatibility.
  287.  
  288. `-H'
  289.      Use heuristics to speed handling of large files that have numerous
  290.      scattered small changes.  *Note diff Performance::.
  291.  
  292. `--horizon-lines=LINES'
  293.      Do not discard the last LINES lines of the common prefix and the
  294.      first LINES lines of the common suffix.  *Note diff Performance::.
  295.  
  296. `-i'
  297.      Ignore changes in case; consider upper- and lower-case letters
  298.      equivalent.  *Note Case Folding::.
  299.  
  300. `-I REGEXP'
  301.      Ignore changes that just insert or delete lines that match REGEXP.
  302.      *Note Specified Folding::.
  303.  
  304. `--ifdef=NAME'
  305.      Make merged if-then-else output using FORMAT.  *Note
  306.      If-then-else::.
  307.  
  308. `--ignore-all-space'
  309.      Ignore white space when comparing lines.  *Note White Space::.
  310.  
  311. `--ignore-blank-lines'
  312.      Ignore changes that just insert or delete blank lines.  *Note
  313.      Blank Lines::.
  314.  
  315. `--ignore-case'
  316.      Ignore changes in case; consider upper- and lower-case to be the
  317.      same.  *Note Case Folding::.
  318.  
  319. `--ignore-matching-lines=REGEXP'
  320.      Ignore changes that just insert or delete lines that match REGEXP.
  321.      *Note Specified Folding::.
  322.  
  323. `--ignore-space-change'
  324.      Ignore changes in amount of white space.  *Note White Space::.
  325.  
  326. `--initial-tab'
  327.      Output a tab rather than a space before the text of a line in
  328.      normal or context format.  This causes the alignment of tabs in
  329.      the line to look normal.  *Note Tabs::.
  330.  
  331. `-l'
  332.      Pass the output through `pr' to paginate it.  *Note Pagination::.
  333.  
  334. `-L LABEL'
  335.      Use LABEL instead of the file name in the context format (*note
  336.      Context Format::.) and unified format (*note Unified Format::.)
  337.      headers.  *Note RCS::.
  338.  
  339. `--label=LABEL'
  340.      Use LABEL instead of the file name in the context format (*note
  341.      Context Format::.) and unified format (*note Unified Format::.)
  342.      headers.
  343.  
  344. `--left-column'
  345.      Print only the left column of two common lines in side by side
  346.      format.  *Note Side by Side Format::.
  347.  
  348. `--line-format=FORMAT'
  349.      Use FORMAT to output all input lines in if-then-else format.
  350.      *Note Line Formats::.
  351.  
  352. `--minimal'
  353.      Change the algorithm to perhaps find a smaller set of changes.
  354.      This makes `diff' slower (sometimes much slower).  *Note diff
  355.      Performance::.
  356.  
  357. `-n'
  358.      Output RCS-format diffs; like `-f' except that each command
  359.      specifies the number of lines affected.  *Note RCS::.
  360.  
  361. `-N'
  362. `--new-file'
  363.      In directory comparison, if a file is found in only one directory,
  364.      treat it as present but empty in the other directory.  *Note
  365.      Comparing Directories::.
  366.  
  367. `--new-group-format=FORMAT'
  368.      Use FORMAT to output a group of lines taken from just the second
  369.      file in if-then-else format.  *Note Line Group Formats::.
  370.  
  371. `--new-line-format=FORMAT'
  372.      Use FORMAT to output a line taken from just the second file in
  373.      if-then-else format.  *Note Line Formats::.
  374.  
  375. `--old-group-format=FORMAT'
  376.      Use FORMAT to output a group of lines taken from just the first
  377.      file in if-then-else format.  *Note Line Group Formats::.
  378.  
  379. `--old-line-format=FORMAT'
  380.      Use FORMAT to output a line taken from just the first file in
  381.      if-then-else format.  *Note Line Formats::.
  382.  
  383. `-p'
  384.      Show which C function each change is in.  *Note C Function
  385.      Headings::.
  386.  
  387. `-P'
  388.      When comparing directories, if a file appears only in the second
  389.      directory of the two, treat it as present but empty in the other.
  390.      *Note Comparing Directories::.
  391.  
  392. `--paginate'
  393.      Pass the output through `pr' to paginate it.  *Note Pagination::.
  394.  
  395. `-q'
  396.      Report only whether the files differ, not the details of the
  397.      differences.  *Note Brief::.
  398.  
  399. `-r'
  400.      When comparing directories, recursively compare any subdirectories
  401.      found.  *Note Comparing Directories::.
  402.  
  403. `--rcs'
  404.      Output RCS-format diffs; like `-f' except that each command
  405.      specifies the number of lines affected.  *Note RCS::.
  406.  
  407. `--recursive'
  408.      When comparing directories, recursively compare any subdirectories
  409.      found.  *Note Comparing Directories::.
  410.  
  411. `--report-identical-files'
  412.      Report when two files are the same.  *Note Comparing Directories::.
  413.  
  414. `-s'
  415.      Report when two files are the same.  *Note Comparing Directories::.
  416.  
  417. `-S FILE'
  418.      When comparing directories, start with the file FILE.  This is
  419.      used for resuming an aborted comparison.  *Note Comparing
  420.      Directories::.
  421.  
  422. `--sdiff-merge-assist'
  423.      Print extra information to help `sdiff'.  `sdiff' uses this option
  424.      when it runs `diff'.  This option is not intended for users to use
  425.      directly.
  426.  
  427. `--show-c-function'
  428.      Show which C function each change is in.  *Note C Function
  429.      Headings::.
  430.  
  431. `--show-function-line=REGEXP'
  432.      In context and unified format, for each hunk of differences, show
  433.      some of the last preceding line that matches REGEXP.  *Note
  434.      Specified Headings::.
  435.  
  436. `--side-by-side'
  437.      Use the side by side output format.  *Note Side by Side Format::.
  438.  
  439. `--speed-large-files'
  440.      Use heuristics to speed handling of large files that have numerous
  441.      scattered small changes.  *Note diff Performance::.
  442.  
  443. `--starting-file=FILE'
  444.      When comparing directories, start with the file FILE.  This is
  445.      used for resuming an aborted comparison.  *Note Comparing
  446.      Directories::.
  447.  
  448. `--suppress-common-lines'
  449.      Do not print common lines in side by side format.  *Note Side by
  450.      Side Format::.
  451.  
  452. `-t'
  453.      Expand tabs to spaces in the output, to preserve the alignment of
  454.      tabs in the input files.  *Note Tabs::.
  455.  
  456. `-T'
  457.      Output a tab rather than a space before the text of a line in
  458.      normal or context format.  This causes the alignment of tabs in
  459.      the line to look normal.  *Note Tabs::.
  460.  
  461. `--text'
  462.      Treat all files as text and compare them line-by-line, even if they
  463.      do not appear to be text.  *Note Binary::.
  464.  
  465. `-u'
  466.      Use the unified output format.  *Note Unified Format::.
  467.  
  468. `--unchanged-group-format=FORMAT'
  469.      Use FORMAT to output a group of common lines taken from both files
  470.      in if-then-else format.  *Note Line Group Formats::.
  471.  
  472. `--unchanged-line-format=FORMAT'
  473.      Use FORMAT to output a line common to both files in if-then-else
  474.      format.  *Note Line Formats::.
  475.  
  476. `--unidirectional-new-file'
  477.      When comparing directories, if a file appears only in the second
  478.      directory of the two, treat it as present but empty in the other.
  479.      *Note Comparing Directories::.
  480.  
  481. `-U LINES'
  482. `--unified[=LINES]'
  483.      Use the unified output format, showing LINES (an integer) lines of
  484.      context, or three if LINES is not given.  *Note Unified Format::.
  485.      For proper operation, `patch' typically needs at least two lines of
  486.      context.
  487.  
  488. `-v'
  489. `--version'
  490.      Output the version number of `diff'.
  491.  
  492. `-w'
  493.      Ignore white space when comparing lines.  *Note White Space::.
  494.  
  495. `-W COLUMNS'
  496. `--width=COLUMNS'
  497.      Use an output width of COLUMNS in side by side format.  *Note Side
  498.      by Side Format::.
  499.  
  500. `-x PATTERN'
  501.      When comparing directories, ignore files and subdirectories whose
  502.      basenames match PATTERN.  *Note Comparing Directories::.
  503.  
  504. `-X FILE'
  505.      When comparing directories, ignore files and subdirectories whose
  506.      basenames match any pattern contained in FILE.  *Note Comparing
  507.      Directories::.
  508.  
  509. `-y'
  510.      Use the side by side output format.  *Note Side by Side Format::.
  511.  
  512. 
  513. File: diff.info,  Node: Invoking diff3,  Next: Invoking patch,  Prev: Invoking diff,  Up: Top
  514.  
  515. Invoking `diff3'
  516. ****************
  517.  
  518.    The `diff3' command compares three files and outputs descriptions of
  519. their differences.  Its arguments are as follows:
  520.  
  521.      diff3 OPTIONS... MINE OLDER YOURS
  522.  
  523.    The files to compare are MINE, OLDER, and YOURS.  At most one of
  524. these three file names may be `-', which tells `diff3' to read the
  525. standard input for that file.
  526.  
  527.    An exit status of 0 means `diff3' was successful, 1 means some
  528. conflicts were found, and 2 means trouble.
  529.  
  530. * Menu:
  531.  
  532. * diff3 Options::        Summary of options to `diff3'.
  533.  
  534. 
  535. File: diff.info,  Node: diff3 Options,  Up: Invoking diff3
  536.  
  537. Options to `diff3'
  538. ==================
  539.  
  540.    Below is a summary of all of the options that GNU `diff3' accepts.
  541. Multiple single letter options (unless they take an argument) can be
  542. combined into a single command line argument.
  543.  
  544. `-a'
  545.      Treat all files as text and compare them line-by-line, even if they
  546.      do not appear to be text.  *Note Binary::.
  547.  
  548. `-A'
  549.      Incorporate all changes from OLDER to YOURS into MINE, surrounding
  550.      all conflicts with bracket lines.  *Note Marking Conflicts::.
  551.  
  552. `-e'
  553.      Generate an `ed' script that incorporates all the changes from
  554.      OLDER to YOURS into MINE.  *Note Which Changes::.
  555.  
  556. `-E'
  557.      Like `-e', except bracket lines from overlapping changes' first
  558.      and third files.  *Note Marking Conflicts::.  With `-e', an
  559.      overlapping change looks like this:
  560.  
  561.           <<<<<<< MINE
  562.           lines from MINE
  563.           =======
  564.           lines from YOURS
  565.           >>>>>>> YOURS
  566.  
  567. `--ed'
  568.      Generate an `ed' script that incorporates all the changes from
  569.      OLDER to YOURS into MINE.  *Note Which Changes::.
  570.  
  571. `--easy-only'
  572.      Like `-e', except output only the nonoverlapping changes.  *Note
  573.      Which Changes::.
  574.  
  575. `-i'
  576.      Generate `w' and `q' commands at the end of the `ed' script for
  577.      System V compatibility.  This option must be combined with one of
  578.      the `-AeExX3' options, and may not be combined with `-m'.  *Note
  579.      Saving the Changed File::.
  580.  
  581. `--initial-tab'
  582.      Output a tab rather than two spaces before the text of a line in
  583.      normal format.  This causes the alignment of tabs in the line to
  584.      look normal.  *Note Tabs::.
  585.  
  586. `-L LABEL'
  587. `--label=LABEL'
  588.      Use the label LABEL for the brackets output by the `-A', `-E' and
  589.      `-X' options.  This option may be given up to three times, one for
  590.      each input file.  The default labels are the names of the input
  591.      files.  Thus `diff3 -L X -L Y -L Z -m A B C' acts like `diff3 -m A
  592.      B C', except that the output looks like it came from files named
  593.      `X', `Y' and `Z' rather than from files named `A', `B' and `C'.
  594.      *Note Marking Conflicts::.
  595.  
  596. `-m'
  597. `--merge'
  598.      Apply the edit script to the first file and send the result to
  599.      standard output.  Unlike piping the output from `diff3' to `ed',
  600.      this works even for binary files and incomplete lines.  `-A' is
  601.      assumed if no edit script option is specified.  *Note Bypassing
  602.      ed::.
  603.  
  604. `--overlap-only'
  605.      Like `-e', except output only the overlapping changes.  *Note
  606.      Which Changes::.
  607.  
  608. `--show-all'
  609.      Incorporate all unmerged changes from OLDER to YOURS into MINE,
  610.      surrounding all overlapping changes with bracket lines.  *Note
  611.      Marking Conflicts::.
  612.  
  613. `--show-overlap'
  614.      Like `-e', except bracket lines from overlapping changes' first
  615.      and third files.  *Note Marking Conflicts::.
  616.  
  617. `-T'
  618.      Output a tab rather than two spaces before the text of a line in
  619.      normal format.  This causes the alignment of tabs in the line to
  620.      look normal.  *Note Tabs::.
  621.  
  622. `--text'
  623.      Treat all files as text and compare them line-by-line, even if they
  624.      do not appear to be text.  *Note Binary::.
  625.  
  626. `-v'
  627. `--version'
  628.      Output the version number of `diff3'.
  629.  
  630. `-x'
  631.      Like `-e', except output only the overlapping changes.  *Note
  632.      Which Changes::.
  633.  
  634. `-X'
  635.      Like `-E', except output only the overlapping changes.  In other
  636.      words, like `-x', except bracket changes as in `-E'.  *Note
  637.      Marking Conflicts::.
  638.  
  639. `-3'
  640.      Like `-e', except output only the nonoverlapping changes.  *Note
  641.      Which Changes::.
  642.  
  643. 
  644. File: diff.info,  Node: Invoking patch,  Next: Invoking sdiff,  Prev: Invoking diff3,  Up: Top
  645.  
  646. Invoking `patch'
  647. ****************
  648.  
  649.    Normally `patch' is invoked like this:
  650.  
  651.      patch <PATCHFILE
  652.  
  653.    The full format for invoking `patch' is:
  654.  
  655.      patch OPTIONS... [ORIGFILE [PATCHFILE]] [+ OPTIONS... [ORIGFILE]]...
  656.  
  657.    If you do not specify PATCHFILE, or if PATCHFILE is `-', `patch'
  658. reads the patch (that is, the `diff' output) from the standard input.
  659.  
  660.    You can specify one or more of the original files as ORIG arguments;
  661. each one and options for interpreting it is separated from the others
  662. with a `+'.  *Note Multiple Patches::, for more information.
  663.  
  664.    If you do not specify an input file on the command line, `patch'
  665. tries to figure out from the "leading text" (any text in the patch that
  666. comes before the `diff' output) which file to edit.  In the header of a
  667. context or unified diff, `patch' looks in lines beginning with `***',
  668. `---', or `+++'; among those, it chooses the shortest name of an
  669. existing file.  Otherwise, if there is an `Index:' line in the leading
  670. text, `patch' tries to use the file name from that line.  If `patch'
  671. cannot figure out the name of an existing file from the leading text,
  672. it prompts you for the name of the file to patch.
  673.  
  674.    If the input file does not exist or is read-only, and a suitable RCS
  675. or SCCS file exists, `patch' attempts to check out or get the file
  676. before proceeding.
  677.  
  678.    By default, `patch' replaces the original input file with the
  679. patched version, after renaming the original file into a backup file
  680. (*note Backups::., for a description of how `patch' names backup
  681. files).  You can also specify where to put the output with the `-o
  682. OUTPUT-FILE' or `--output=OUTPUT-FILE' option.
  683.  
  684. * Menu:
  685.  
  686. * patch Directories::    Changing directory and stripping paths.
  687. * Backups::        Backup file names.
  688. * Rejects::        Reject file names.
  689. * patch Options::    Summary table of options to `patch'.
  690.  
  691. 
  692. File: diff.info,  Node: patch Directories,  Next: Backups,  Up: Invoking patch
  693.  
  694. Applying Patches in Other Directories
  695. =====================================
  696.  
  697.    The `-d DIRECTORY' or `--directory=DIRECTORY' option to `patch'
  698. makes directory DIRECTORY the current directory for interpreting both
  699. file names in the patch file, and file names given as arguments to
  700. other options (such as `-B' and `-o').  For example, while in a news
  701. reading program, you can patch a file in the `/usr/src/emacs' directory
  702. directly from the article containing the patch like this:
  703.  
  704.      | patch -d /usr/src/emacs
  705.  
  706.    Sometimes the file names given in a patch contain leading
  707. directories, but you keep your files in a directory different from the
  708. one given in the patch.  In those cases, you can use the `-p[NUMBER]'
  709. or `--strip[=NUMBER]' option to set the file name strip count to
  710. NUMBER.  The strip count tells `patch' how many slashes, along with the
  711. directory names between them, to strip from the front of file names.
  712. `-p' with no NUMBER given is equivalent to `-p0'.  By default, `patch'
  713. strips off all leading paths, leaving just the base file names, except
  714. that when a file name given in the patch is a relative path and all of
  715. its leading directories already exist, `patch' does not strip off the
  716. leading path.  (A "relative" path is one that does not start with a
  717. slash.)
  718.  
  719.    `patch' looks for each file (after any slashes have been stripped)
  720. in the current directory, or if you used the `-d DIRECTORY' option, in
  721. that directory.
  722.  
  723.    For example, suppose the file name in the patch file is
  724. `/gnu/src/emacs/etc/NEWS'.  Using `-p' or `-p0' gives the entire file
  725. name unmodified, `-p1' gives `gnu/src/emacs/etc/NEWS' (no leading
  726. slash), `-p4' gives `etc/NEWS', and not specifying `-p' at all gives
  727. `NEWS'.
  728.  
  729. 
  730. File: diff.info,  Node: Backups,  Next: Rejects,  Prev: patch Directories,  Up: Invoking patch
  731.  
  732. Backup File Names
  733. =================
  734.  
  735.    Normally, `patch' renames an original input file into a backup file
  736. by appending to its name the extension `.orig', or `~' on systems that
  737. do not support long file names.  The `-b BACKUP-SUFFIX' or
  738. `--suffix=BACKUP-SUFFIX' option uses BACKUP-SUFFIX as the backup
  739. extension instead.
  740.  
  741.    Alternately, you can specify the extension for backup files with the
  742. `SIMPLE_BACKUP_SUFFIX' environment variable, which the options override.
  743.  
  744.    `patch' can also create numbered backup files the way GNU Emacs
  745. does.  With this method, instead of having a single backup of each file,
  746. `patch' makes a new backup file name each time it patches a file.  For
  747. example, the backups of a file named `sink' would be called,
  748. successively, `sink.~1~', `sink.~2~', `sink.~3~', etc.
  749.  
  750.    The `-V BACKUP-STYLE' or `--version-control=BACKUP-STYLE' option
  751. takes as an argument a method for creating backup file names.  You can
  752. alternately control the type of backups that `patch' makes with the
  753. `VERSION_CONTROL' environment variable, which the `-V' option
  754. overrides.  The value of the `VERSION_CONTROL' environment variable and
  755. the argument to the `-V' option are like the GNU Emacs
  756. `version-control' variable (*note emacs: Backups., for more information
  757. on backup versions in Emacs).  They also recognize synonyms that are
  758. more descriptive.  The valid values are listed below; unique
  759. abbreviations are acceptable.
  760.  
  761. `t'
  762. `numbered'
  763.      Always make numbered backups.
  764.  
  765. `nil'
  766. `existing'
  767.      Make numbered backups of files that already have them, simple
  768.      backups of the others.  This is the default.
  769.  
  770. `never'
  771. `simple'
  772.      Always make simple backups.
  773.  
  774.    Alternately, you can tell `patch' to prepend a prefix, such as a
  775. directory name, to produce backup file names.  The `-B BACKUP-PREFIX'
  776. or `--prefix=BACKUP-PREFIX' option makes backup files by prepending
  777. BACKUP-PREFIX to them.  If you use this option, `patch' ignores any
  778. `-b' option that you give.
  779.  
  780.    If the backup file already exists, `patch' creates a new backup file
  781. name by changing the first lowercase letter in the last component of
  782. the file name into uppercase.  If there are no more lowercase letters
  783. in the name, it removes the first character from the name.  It repeats
  784. this process until it comes up with a backup file name that does not
  785. already exist.
  786.  
  787.    If you specify the output file with the `-o' option, that file is
  788. the one that is backed up, not the input file.
  789.  
  790. 
  791. File: diff.info,  Node: Rejects,  Next: patch Options,  Prev: Backups,  Up: Invoking patch
  792.  
  793. Reject File Names
  794. =================
  795.  
  796.    The names for reject files (files containing patches that `patch'
  797. could not find a place to apply) are normally the name of the output
  798. file with `.rej' appended (or `#' on systems that do not support long
  799. file names).
  800.  
  801.    Alternatively, you can tell `patch' to place all of the rejected
  802. patches in a single file.  The `-r REJECT-FILE' or
  803. `--reject-file=REJECT-FILE' option uses REJECT-FILE as the reject file
  804. name.
  805.  
  806. 
  807. File: diff.info,  Node: patch Options,  Prev: Rejects,  Up: Invoking patch
  808.  
  809. Options to `patch'
  810. ==================
  811.  
  812.    Here is a summary of all of the options that `patch' accepts.  Older
  813. versions of `patch' do not accept long-named options or the `-t', `-E',
  814. or `-V' options.
  815.  
  816.    Multiple single-letter options that do not take an argument can be
  817. combined into a single command line argument (with only one dash).
  818. Brackets ([ and ]) indicate that an option takes an optional argument.
  819.  
  820. `-b BACKUP-SUFFIX'
  821.      Use BACKUP-SUFFIX as the backup extension instead of `.orig' or
  822.      `~'.  *Note Backups::.
  823.  
  824. `-B BACKUP-PREFIX'
  825.      Use BACKUP-PREFIX as a prefix to the backup file name.  If this
  826.      option is specified, any `-b' option is ignored.  *Note Backups::.
  827.  
  828. `--batch'
  829.      Do not ask any questions.  *Note patch Messages::.
  830.  
  831. `-c'
  832. `--context'
  833.      Interpret the patch file as a context diff.  *Note patch Input::.
  834.  
  835. `-d DIRECTORY'
  836. `--directory=DIRECTORY'
  837.      Makes directory DIRECTORY the current directory for interpreting
  838.      both file names in the patch file, and file names given as
  839.      arguments to other options.  *Note patch Directories::.
  840.  
  841. `-D NAME'
  842.      Make merged if-then-else output using FORMAT.  *Note
  843.      If-then-else::.
  844.  
  845. `--debug=NUMBER'
  846.      Set internal debugging flags.  Of interest only to `patch'
  847.      patchers.
  848.  
  849. `-e'
  850. `--ed'
  851.      Interpret the patch file as an `ed' script.  *Note patch Input::.
  852.  
  853. `-E'
  854.      Remove output files that are empty after the patches have been
  855.      applied.  *Note Empty Files::.
  856.  
  857. `-f'
  858.      Assume that the user knows exactly what he or she is doing, and do
  859.      not ask any questions.  *Note patch Messages::.
  860.  
  861. `-F LINES'
  862.      Set the maximum fuzz factor to LINES.  *Note Inexact::.
  863.  
  864. `--force'
  865.      Assume that the user knows exactly what he or she is doing, and do
  866.      not ask any questions.  *Note patch Messages::.
  867.  
  868. `--forward'
  869.      Ignore patches that `patch' thinks are reversed or already applied.
  870.      See also `-R'.  *Note Reversed Patches::.
  871.  
  872. `--fuzz=LINES'
  873.      Set the maximum fuzz factor to LINES.  *Note Inexact::.
  874.  
  875. `--help'
  876.      Print a summary of the options that `patch' recognizes, then exit.
  877.  
  878. `--ifdef=NAME'
  879.      Make merged if-then-else output using FORMAT.  *Note
  880.      If-then-else::.
  881.  
  882. `--ignore-white-space'
  883. `-l'
  884.      Let any sequence of white space in the patch file match any
  885.      sequence of white space in the input file.  *Note Changed White
  886.      Space::.
  887.  
  888. `-n'
  889. `--normal'
  890.      Interpret the patch file as a normal diff.  *Note patch Input::.
  891.  
  892. `-N'
  893.      Ignore patches that `patch' thinks are reversed or already applied.
  894.      See also `-R'.  *Note Reversed Patches::.
  895.  
  896. `-o OUTPUT-FILE'
  897. `--output=OUTPUT-FILE'
  898.      Use OUTPUT-FILE as the output file name.  *Note patch Options::.
  899.  
  900. `-p[NUMBER]'
  901.      Set the file name strip count to NUMBER.  *Note patch
  902.      Directories::.
  903.  
  904. `--prefix=BACKUP-PREFIX'
  905.      Use BACKUP-PREFIX as a prefix to the backup file name.  If this
  906.      option is specified, any `-b' option is ignored.  *Note Backups::.
  907.  
  908. `--quiet'
  909.      Work silently unless an error occurs.  *Note patch Messages::.
  910.  
  911. `-r REJECT-FILE'
  912.      Use REJECT-FILE as the reject file name.  *Note Rejects::.
  913.  
  914. `-R'
  915.      Assume that this patch was created with the old and new files
  916.      swapped.  *Note Reversed Patches::.
  917.  
  918. `--reject-file=REJECT-FILE'
  919.      Use REJECT-FILE as the reject file name.  *Note Rejects::.
  920.  
  921. `--remove-empty-files'
  922.      Remove output files that are empty after the patches have been
  923.      applied.  *Note Empty Files::.
  924.  
  925. `--reverse'
  926.      Assume that this patch was created with the old and new files
  927.      swapped.  *Note Reversed Patches::.
  928.  
  929. `-s'
  930.      Work silently unless an error occurs.  *Note patch Messages::.
  931.  
  932. `-S'
  933.      Ignore this patch from the patch file, but continue looking for
  934.      the next patch in the file.  *Note Multiple Patches::.
  935.  
  936. `--silent'
  937.      Work silently unless an error occurs.  *Note patch Messages::.
  938.  
  939. `--skip'
  940.      Ignore this patch from the patch file, but continue looking for
  941.      the next patch in the file.  *Note Multiple Patches::.
  942.  
  943. `--strip[=NUMBER]'
  944.      Set the file name strip count to NUMBER.  *Note patch
  945.      Directories::.
  946.  
  947. `--suffix=BACKUP-SUFFIX'
  948.      Use BACKUP-SUFFIX as the backup extension instead of `.orig' or
  949.      `~'.  *Note Backups::.
  950.  
  951. `-t'
  952.      Do not ask any questions.  *Note patch Messages::.
  953.  
  954. `-u'
  955. `--unified'
  956.      Interpret the patch file as a unified diff.  *Note patch Input::.
  957.  
  958. `-v'
  959.      Output the revision header and patch level of `patch'.
  960.  
  961. `-V BACKUP-STYLE'
  962.      Select the kind of backups to make.  *Note Backups::.
  963.  
  964. `--version'
  965.      Output the revision header and patch level of `patch', then exit.
  966.  
  967. `--version=control=BACKUP-STYLE'
  968.      Select the kind of backups to make.  *Note Backups::.
  969.  
  970. `-x NUMBER'
  971.      Set internal debugging flags.  Of interest only to `patch'
  972.      patchers.
  973.  
  974. 
  975. File: diff.info,  Node: Invoking sdiff,  Next: Incomplete Lines,  Prev: Invoking patch,  Up: Top
  976.  
  977. Invoking `sdiff'
  978. ****************
  979.  
  980.    The `sdiff' command merges two files and interactively outputs the
  981. results.  Its arguments are as follows:
  982.  
  983.      sdiff -o OUTFILE OPTIONS... FROM-FILE TO-FILE
  984.  
  985.    This merges FROM-FILE with TO-FILE, with output to OUTFILE.  If
  986. FROM-FILE is a directory and TO-FILE is not, `sdiff' compares the file
  987. in FROM-FILE whose file name is that of TO-FILE, and vice versa.
  988. fROM-FILE and TO-FILE may not both be directories.
  989.  
  990.    `sdiff' options begin with `-', so normally FROM-FILE and TO-FILE
  991. may not begin with `-'.  However, `--' as an argument by itself treats
  992. the remaining arguments as file names even if they begin with `-'.  You
  993. may not use `-' as an input file.
  994.  
  995.    An exit status of 0 means no differences were found, 1 means some
  996. differences were found, and 2 means trouble.
  997.  
  998.    `sdiff' without `-o' (or `--output') produces a side-by-side
  999. difference.  This usage is obsolete; use `diff --side-by-side' instead.
  1000.  
  1001. * Menu:
  1002.  
  1003. * sdiff Options::    Summary of options to `diff'.
  1004.  
  1005. 
  1006. File: diff.info,  Node: sdiff Options,  Up: Invoking sdiff
  1007.  
  1008. Options to `sdiff'
  1009. ==================
  1010.  
  1011.    Below is a summary of all of the options that GNU `sdiff' accepts.
  1012. Each option has two equivalent names, one of which is a single letter
  1013. preceded by `-', and the other of which is a long name preceded by
  1014. `--'.  Multiple single letter options (unless they take an argument)
  1015. can be combined into a single command line argument.  Long named
  1016. options can be abbreviated to any unique prefix of their name.
  1017.  
  1018. `-a'
  1019.      Treat all files as text and compare them line-by-line, even if they
  1020.      do not appear to be text.  *Note Binary::.
  1021.  
  1022. `-b'
  1023.      Ignore changes in amount of white space.  *Note White Space::.
  1024.  
  1025. `-B'
  1026.      Ignore changes that just insert or delete blank lines.  *Note
  1027.      Blank Lines::.
  1028.  
  1029. `-d'
  1030.      Change the algorithm to perhaps find a smaller set of changes.
  1031.      This makes `sdiff' slower (sometimes much slower).  *Note diff
  1032.      Performance::.
  1033.  
  1034. `-H'
  1035.      Use heuristics to speed handling of large files that have numerous
  1036.      scattered small changes.  *Note diff Performance::.
  1037.  
  1038. `--expand-tabs'
  1039.      Expand tabs to spaces in the output, to preserve the alignment of
  1040.      tabs in the input files.  *Note Tabs::.
  1041.  
  1042. `-i'
  1043.      Ignore changes in case; consider upper- and lower-case to be the
  1044.      same.  *Note Case Folding::.
  1045.  
  1046. `-I REGEXP'
  1047.      Ignore changes that just insert or delete lines that match REGEXP.
  1048.      *Note Specified Folding::.
  1049.  
  1050. `--ignore-all-space'
  1051.      Ignore white space when comparing lines.  *Note White Space::.
  1052.  
  1053. `--ignore-blank-lines'
  1054.      Ignore changes that just insert or delete blank lines.  *Note
  1055.      Blank Lines::.
  1056.  
  1057. `--ignore-case'
  1058.      Ignore changes in case; consider upper- and lower-case to be the
  1059.      same.  *Note Case Folding::.
  1060.  
  1061. `--ignore-matching-lines=REGEXP'
  1062.      Ignore changes that just insert or delete lines that match REGEXP.
  1063.      *Note Specified Folding::.
  1064.  
  1065. `--ignore-space-change'
  1066.      Ignore changes in amount of white space.  *Note White Space::.
  1067.  
  1068. `-l'
  1069. `--left-column'
  1070.      Print only the left column of two common lines.  *Note Side by
  1071.      Side Format::.
  1072.  
  1073. `--minimal'
  1074.      Change the algorithm to perhaps find a smaller set of changes.
  1075.      This makes `sdiff' slower (sometimes much slower).  *Note diff
  1076.      Performance::.
  1077.  
  1078. `-o FILE'
  1079. `--output=FILE'
  1080.      Put merged output into FILE.  This option is required for merging.
  1081.  
  1082. `-s'
  1083. `--suppress-common-lines'
  1084.      Do not print common lines.  *Note Side by Side Format::.
  1085.  
  1086. `--speed-large-files'
  1087.      Use heuristics to speed handling of large files that have numerous
  1088.      scattered small changes.  *Note diff Performance::.
  1089.  
  1090. `-t'
  1091.      Expand tabs to spaces in the output, to preserve the alignment of
  1092.      tabs in the input files.  *Note Tabs::.
  1093.  
  1094. `--text'
  1095.      Treat all files as text and compare them line-by-line, even if they
  1096.      do not appear to be text.  *Note Binary::.
  1097.  
  1098. `-v'
  1099. `--version'
  1100.      Output the version number of `sdiff'.
  1101.  
  1102. `-w COLUMNS'
  1103. `--width=COLUMNS'
  1104.      Use an output width of COLUMNS.  *Note Side by Side Format::.
  1105.      Note that for historical reasons, this option is `-W' in `diff',
  1106.      `-w' in `sdiff'.
  1107.  
  1108. `-W'
  1109.      Ignore horizontal white space when comparing lines.  *Note White
  1110.      Space::.  Note that for historical reasons, this option is `-w' in
  1111.      `diff', `-W' in `sdiff'.
  1112.  
  1113. 
  1114. File: diff.info,  Node: Incomplete Lines,  Next: Projects,  Prev: Invoking sdiff,  Up: Top
  1115.  
  1116. Incomplete Lines
  1117. ****************
  1118.  
  1119.    When an input file ends in a non-newline character, its last line is
  1120. called an "incomplete line" because its last character is not a
  1121. newline.  All other lines are called "full lines" and end in a newline
  1122. character.  Incomplete lines do not match full lines unless differences
  1123. in blank lines are ignored (*note Blank Lines::.).
  1124.  
  1125.    An incomplete line is normally distinguished on output from a full
  1126. line by a following line that starts with `\'.  However, the RCS format
  1127. (*note RCS::.) outputs the incomplete line as-is, without any trailing
  1128. newline or following line.  The side by side format normally represents
  1129. incomplete lines as-is, but in some cases uses a `\' or `/' gutter
  1130. marker; *Note Side by Side::.  The if-then-else line format preserves a
  1131. line's incompleteness with `%L', and discards the newline with `%l';
  1132. *Note Line Formats::.  Finally, with the `ed' and forward `ed' output
  1133. formats (*note Output Formats::.) `diff' cannot represent an incomplete
  1134. line, so it pretends there was a newline and reports an error.
  1135.  
  1136.    For example, suppose `F' and `G' are one-byte files that contain
  1137. just `f' and `g', respectively.  Then `diff F G' outputs
  1138.  
  1139.      1c1
  1140.      < f
  1141.      \ No newline at end of file
  1142.      ---
  1143.      > g
  1144.      \ No newline at end of file
  1145.  
  1146. (The exact message may differ in non-English locales.) `diff -n F G'
  1147. outputs the following without a trailing newline:
  1148.  
  1149.      d1 1
  1150.      a1 1
  1151.      g
  1152.  
  1153.    `diff -e F G' reports two errors and outputs the following:
  1154.  
  1155.      1c
  1156.      g
  1157.      .
  1158.  
  1159. 
  1160. File: diff.info,  Node: Projects,  Next: Concept Index,  Prev: Incomplete Lines,  Up: Top
  1161.  
  1162. Future Projects
  1163. ***************
  1164.  
  1165.    Here are some ideas for improving GNU `diff' and `patch'.  The GNU
  1166. project has identified some improvements as potential programming
  1167. projects for volunteers.  You can also help by reporting any bugs that
  1168. you find.
  1169.  
  1170.    If you are a programmer and would like to contribute something to the
  1171. GNU project, please consider volunteering for one of these projects.  If
  1172. you are seriously contemplating work, please write to
  1173. `gnu@prep.ai.mit.edu' to coordinate with other volunteers.
  1174.  
  1175. * Menu:
  1176.  
  1177. * Shortcomings::    Suggested projects for improvements.
  1178. * Bugs::        Reporting bugs.
  1179.  
  1180. 
  1181. File: diff.info,  Node: Shortcomings,  Next: Bugs,  Up: Projects
  1182.  
  1183. Suggested Projects for Improving GNU `diff' and `patch'
  1184. =======================================================
  1185.  
  1186.    One should be able to use GNU `diff' to generate a patch from any
  1187. pair of directory trees, and given the patch and a copy of one such
  1188. tree, use `patch' to generate a faithful copy of the other.
  1189. Unfortunately, some changes to directory trees cannot be expressed using
  1190. current patch formats; also, `patch' does not handle some of the
  1191. existing formats.  These shortcomings motivate the following suggested
  1192. projects.
  1193.  
  1194. * Menu:
  1195.  
  1196. * Changing Structure::    Handling changes to the directory structure.
  1197. * Special Files::    Handling symbolic links, device special files, etc.
  1198. * Unusual File Names::    Handling file names that contain unusual characters.
  1199. * Arbitrary Limits::    Patching non-text files.
  1200. * Large Files::        Handling files that do not fit in memory.
  1201. * Ignoring Changes::    Ignoring certain changes while showing others.
  1202.  
  1203. 
  1204. File: diff.info,  Node: Changing Structure,  Next: Special Files,  Up: Shortcomings
  1205.  
  1206. Handling Changes to the Directory Structure
  1207. -------------------------------------------
  1208.  
  1209.    `diff' and `patch' do not handle some changes to directory
  1210. structure.  For example, suppose one directory tree contains a directory
  1211. named `D' with some subsidiary files, and another contains a file with
  1212. the same name `D'.  `diff -r' does not output enough information for
  1213. `patch' to transform the the directory subtree into the file.
  1214.  
  1215.    There should be a way to specify that a file has been deleted without
  1216. having to include its entire contents in the patch file.  There should
  1217. also be a way to tell `patch' that a file was renamed, even if there is
  1218. no way for `diff' to generate such information.
  1219.  
  1220.    These problems can be fixed by extending the `diff' output format to
  1221. represent changes in directory structure, and extending `patch' to
  1222. understand these extensions.
  1223.  
  1224. 
  1225. File: diff.info,  Node: Special Files,  Next: Unusual File Names,  Prev: Changing Structure,  Up: Shortcomings
  1226.  
  1227. Files that are Neither Directories Nor Regular Files
  1228. ----------------------------------------------------
  1229.  
  1230.    Some files are neither directories nor regular files: they are
  1231. unusual files like symbolic links, device special files, named pipes,
  1232. and sockets.  Currently, `diff' treats symbolic links like regular
  1233. files; it treats other special files like regular files if they are
  1234. specified at the top level, but simply reports their presence when
  1235. comparing directories.  This means that `patch' cannot represent changes
  1236. to such files.  For example, if you change which file a symbolic link
  1237. points to, `diff' outputs the difference between the two files, instead
  1238. of the change to the symbolic link.
  1239.  
  1240.    `diff' should optionally report changes to special files specially,
  1241. and `patch' should be extended to understand these extensions.
  1242.  
  1243. 
  1244. File: diff.info,  Node: Unusual File Names,  Next: Arbitrary Limits,  Prev: Special Files,  Up: Shortcomings
  1245.  
  1246. File Names that Contain Unusual Characters
  1247. ------------------------------------------
  1248.  
  1249.    When a file name contains an unusual character like a newline or
  1250. white space, `diff -r' generates a patch that `patch' cannot parse.
  1251. The problem is with format of `diff' output, not just with `patch',
  1252. because with odd enough file names one can cause `diff' to generate a
  1253. patch that is syntactically correct but patches the wrong files.  The
  1254. format of `diff' output should be extended to handle all possible file
  1255. names.
  1256.  
  1257. 
  1258. File: diff.info,  Node: Arbitrary Limits,  Next: Large Files,  Prev: Unusual File Names,  Up: Shortcomings
  1259.  
  1260. Arbitrary Limits
  1261. ----------------
  1262.  
  1263.    GNU `diff' can analyze files with arbitrarily long lines and files
  1264. that end in incomplete lines.  However, `patch' cannot patch such
  1265. files.  The `patch' internal limits on line lengths should be removed,
  1266. and `patch' should be extended to parse `diff' reports of incomplete
  1267. lines.
  1268.  
  1269. 
  1270. File: diff.info,  Node: Large Files,  Next: Ignoring Changes,  Prev: Arbitrary Limits,  Up: Shortcomings
  1271.  
  1272. Handling Files that Do Not Fit in Memory
  1273. ----------------------------------------
  1274.  
  1275.    `diff' operates by reading both files into memory.  This method
  1276. fails if the files are too large, and `diff' should have a fallback.
  1277.  
  1278.    One way to do this is to scan the files sequentially to compute hash
  1279. codes of the lines and put the lines in equivalence classes based only
  1280. on hash code.  Then compare the files normally.  This does produce some
  1281. false matches.
  1282.  
  1283.    Then scan the two files sequentially again, checking each match to
  1284. see whether it is real.  When a match is not real, mark both the
  1285. "matching" lines as changed.  Then build an edit script as usual.
  1286.  
  1287.    The output routines would have to be changed to scan the files
  1288. sequentially looking for the text to print.
  1289.  
  1290. 
  1291. File: diff.info,  Node: Ignoring Changes,  Prev: Large Files,  Up: Shortcomings
  1292.  
  1293. Ignoring Certain Changes
  1294. ------------------------
  1295.  
  1296.    It would be nice to have a feature for specifying two strings, one in
  1297. FROM-FILE and one in TO-FILE, which should be considered to match.
  1298. Thus, if the two strings are `foo' and `bar', then if two lines differ
  1299. only in that `foo' in file 1 corresponds to `bar' in file 2, the lines
  1300. are treated as identical.
  1301.  
  1302.    It is not clear how general this feature can or should be, or what
  1303. syntax should be used for it.
  1304.  
  1305. 
  1306. File: diff.info,  Node: Bugs,  Prev: Shortcomings,  Up: Projects
  1307.  
  1308. Reporting Bugs
  1309. ==============
  1310.  
  1311.    If you think you have found a bug in GNU `cmp', `diff', `diff3',
  1312. `sdiff', or `patch', please report it by electronic mail to
  1313. `bug-gnu-utils@prep.ai.mit.edu'.  Send as precise a description of the
  1314. problem as you can, including sample input files that produce the bug,
  1315. if applicable.
  1316.  
  1317.    Because Larry Wall has not released a new version of `patch' since
  1318. mid 1988 and the GNU version of `patch' has been changed since then,
  1319. please send bug reports for `patch' by electronic mail to both
  1320. `bug-gnu-utils@prep.ai.mit.edu' and `lwall@netlabs.com'.
  1321.  
  1322.