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