67 Commits

Author SHA1 Message Date
Jim Meyering
5ac64141ed version 3.4
* NEWS: Record release date.
2016-08-08 10:10:51 -07:00
Jim Meyering
7346a03010 maint: update copyright year, bootstrap, init.sh
Run "make update-copyright" and then...

* gnulib: Update to latest.
* tests/init.sh: Update from gnulib.
* bootstrap: Likewise.
2016-01-01 18:00:08 -08:00
Jim Meyering
a3ea9cd5cb diff --brief no longer mistakenly reports diff. with 0-sized /proc/ files
Normally, it is safe to assume two regular files are different when
their st_size values are different.  However, that assumption may
be invalid if either value is zero, as happens with files on Linux
/proc and /sys file systems. Since skipping this optimization will
usually cost very little (one read syscall, to read zero bytes),
it is fine to accommodate those unusual files.
* src/analyze.c (diff_2_files): Do not assume regular files differ
just because their st_size values differ when one or more is 0.
* src/diff.c (compare_files): Likewise.
* tests/brief-vs-proc-stat-zero: New test.
* tests/Makefile.am: Add it.
* NEWS (Bug fixes): Describe it.
Reported by Stephan Müller in http://debbugs.gnu.org/21942
2015-12-06 11:37:44 -08:00
Giuseppe Scrivano
0e72de4795 doc: mention --color and --palette in NEWS 2015-11-29 08:20:53 -08:00
Jim Meyering
29e8de4885 maint: update copyright year ranges to include 2015; update gnulib 2015-01-01 22:31:27 -08:00
Paul Eggert
df3af29627 doc: mention diff -B fix in NEWS 2014-09-03 16:02:35 -07:00
Paul Eggert
9b48bf3d3e diff: remove TOO_EXPENSIVE heuristic
Problem reported by Vincent Lefevre in <http://bugs.gnu.org/16848>.
The simplest solution is to remove the TOO_EXPENSIVE heuristic
that I added to GNU diff in 1993.  Although appropriate for
circa-1993 hardware, these days the heuristic seems to be more
trouble than it's worth.
* NEWS: Document this.
* doc/diffutils.texi (Overview): Modernize citations.
Remove mention of TOO_EXPENSIVE heuristic.
* src/analyze.c (diff_2_files): Adjust to TOO_EXPENSIVE-related
API changes in gnulib's diffseq module.
2014-02-23 22:50:37 -08:00
Paul Eggert
bc4b4b2bbf diff: exit with status 1, not 2, when binary files differ
Problem reported by Vincent Lefevre in <http://bugs.gnu.org/16608>.
* NEWS:
* doc/diffutils.texi (Binary, Invoking diff): Document this.
* src/analyze.c (briefly_report): Return void, not int.
All uses changed.  Do not futz with exit status.  Simplify.
* tests/binary: Adjust to match new behavior.
2014-01-31 17:15:54 -08:00
Paul Eggert
4825b8d70c diff: fix bug with Asian file names
Problem reported by Errembault Philippe in:
http://lists.gnu.org/archive/html/bug-diffutils/2013-03/msg00012.html
* NEWS: Document this.
* src/dir.c (compare_names): Fall back on file_name_cmp if
compare_collated returns 0, unless ignoring file name case.
(diff_dirs): Don't bother with the O(N**2) stuff unless ignoring
file name case.
* tests/Makefile.am (TESTS): Add strcoll-0-names.
* tests/strcoll-0-names: New file.
2013-04-03 08:22:40 -07:00
Jim Meyering
417363e4ce doc: mention new option, --no-dereference in 3.3's NEWS
* NEWS (New feeatures): Update 3.3's news to mention --no-dereference.
Reported by Denis Excoffier.
* Makefile.am (old_NEWS_hash): Update, since this modifies old, and
normally-immutable NEWS.
2013-03-30 14:04:56 -07:00
Jim Meyering
3667192611 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-03-24 11:09:13 -07:00
Jim Meyering
4544aa68fd version 3.3
* NEWS: Record release date.
2013-03-24 11:00:34 -07:00
Jim Meyering
a0483cb2fc maint: update all copyright year number ranges
Run "make update-copyright".
2013-01-04 11:13:02 +01:00
Andreas Gruenbacher
e17295dc55 diff: encode file names with special characters
* src/util.c (c_escape_char): New function.
(c_escape): New function.
(begin_output): Escape file names when needed.
* src/context.c (print_context_header): New names parameter.
(print_context_label): New name parameter.
* src/diff.h (print_context_header): Change prototype.
* tests/filename-quoting: New file.
* NEWS: Document this change.
2012-09-10 14:31:23 +02:00
Paul Eggert
1f281b3680 maint: remove ms subdirectory
diffutils is now designed to build with Cygwin or MinGW.
The old DJGPP stuff probably doesn't work anyway.
* Makefile.am (SUBDIRS): Remove ms.
* NEWS: Document this.
* configure.ac (AC_CONFIG_FILES): Remove ms/Makefile.
* ms/Makefile.am, ms/README, ms/config.bat, ms/config.sed:
* ms/config.site: Remove.
2012-05-15 14:01:53 -07:00
Paul Eggert
7f2f4bb365 diff: -N, --unidirectional-new-file now compare to "-" too
* NEWS: Document this.
* doc/diffutils.texi (Comparing Directories): Likewise.
Also, document that these options work at the top level.
* src/diff.c (compare_files): Treat EBADF like ENOENT, to handle
the case where "-" is closed.  Allow the other file to be
STDIN_FILENO, in case it's "-".
* tests/Makefile.am (TESTS): Add new-file.
* tests/new-file: New file.
2012-02-04 22:13:48 -08:00
Paul Eggert
62ca21c8c1 maint: quote 'like this' or "like this", not `like this'
This is in response to a recent change in the GNU coding standards,
which now suggest quoting 'like this' or "like this", instead of
`like this' or ``like this''.
* HACKING, NEWS, README, README-hacking, TODO, doc/diagmeet.note:
* doc/diffutils.texi, ms/config.bat, ms/config.site:
* src/analyze.c, src/cmp.c, src/context.c, src/diff.c:
* src/diff.h, src/diff3.c, src/dir.c, src/ifdef.c, src/io.c:
* src/sdiff.c, src/side.c, src/system.h, src/util.c:
* tests/help-version:
Quote 'like this' or "like this" in commentary.
* cfg.mk (old_NEWS_hash): Adjust to reflect new NEWS quoting.
* man/help2man: Update to 1.40.4 version, with quoting fixed as above.
* po/en.po: Remove translation involving `, as it's no longer needed.
* src/cmp.c (try_help, specify_ignore_initial, usage, main):
* src/diff.c (main, try_help, option_help_msgid, specify_value)
(compare_files):
* src/diff3.c (main, try_help, option_help_msgid, usage)
(read_diff):
* src/dir.c (compare_names):
* src/sdiff.c (try_help, usage, check_child_status, main):
* src/util.c (finish_output):
* tests/help-version:
Quote 'like this' in output.
2012-01-25 23:54:38 -08:00
Jim Meyering
45110a7927 maint: update all copyright year number ranges
Run "make update-copyright".
2012-01-01 09:32:41 +01:00
Jim Meyering
57a09576e8 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-09-02 17:21:07 +02:00
Jim Meyering
8f14bb9095 version 3.2
* NEWS: Record release date.
2011-09-02 17:18:34 +02:00
Jim Meyering
77bcc326cc doc: diffutils' texi-derived doc may now be in debian's "main" section
* NEWS (Packaging): Mention the "no front/back-cover" change.
2011-09-02 00:36:16 +02:00
Roland McGrath
86a40dd6ac diff, sdiff: new option --ignore-trailing-space (-Z)
Derived from Roland McGrath's patch (dated June 2004!) in:
http://lists.gnu.org/archive/html/bug-gnu-utils/2004-07/msg00000.html
* NEWS:
* doc/diffutils.texi (White Space, Blank Lines)
(sdiff Option Summary, diff Options, sdiff Options): Document -Z.
* src/diff.h (IGNORE_TRAILING_SPACE)
(IGNORE_TAB_EXPANSION_AND_TRAILING_SPACE): New constants, for -Z.
* src/diff.c (shortopts, longopts, main, option_help_msgid):
* src/sdiff.c (longopts, option_help_msgid, main):
* src/io.c (find_and_hash_each_line):
* src/util.c (lines_differ, analyze_hunk): Support -Z.
2011-08-14 22:09:21 -07:00
Tim Waugh
70febebfe5 diff: --ignore-file-name-case now applies at top level too
Derived from Tim Waugh's patch in:
http://lists.gnu.org/archive/html/bug-diffutils/2011-08/msg00034.html
* NEWS, doc/diffutils.texi (diff Options): Document this.
* src/diff.c (compare_files): Implement this, by using
find_dir_file_pathname.
* src/diff.h (find_dir_file_pathname): New decl.
* src/dir.c: Include filenamecat.h.
(find_dir_file_pathname): New function.
2011-08-13 13:17:40 -07:00
Jim Meyering
1e340def24 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-08-10 12:38:04 +02:00
Jim Meyering
78524ae4ba version 3.1
* NEWS: Record release date.
2011-08-10 12:33:36 +02:00
Jim Meyering
ce5367b6b3 maint: update copyright year ranges to include 2011
Run "make update-copyright", so "make syntax-check" works in 2011.
2011-01-03 22:13:35 +01:00
Paul Eggert
f2ad578b24 diff: avoid spurious diffs when two distinct dir entries compare equal
Problem reported by Christoph Anton Mitterer in:
http://lists.gnu.org/archive/html/bug-diffutils/2010-08/msg00000.html

* NEWS: Mention this bug fix.
* src/dir.c (compare_names_for_qsort): Fall back on file_name_cmp
if two distinct entries in the same directory compare equal.
(diff_dirs): Prefer a file_name_cmp match when available.
* tests/Makefile.am (TESTS): New test colliding-file-names.
* tests/colliding-file-names: New file.
2010-08-12 17:55:38 -07:00
Jim Meyering
d03317ad6a post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-05-03 18:52:56 +02:00
Jim Meyering
022cd5c5eb version 3.0
* NEWS: Record release date.
2010-05-03 18:49:55 +02:00
Jim Meyering
f444711a26 diff: fix a regression when at least one input lacks a newline-at-EOF,
and the final hunk plus context-length aligns exactly with the end
of the newline-lacking file.  Diff would fail to output the required
"\ No newline at end of file" line, thus rendering the output invalid.
This bug appears to have been introduced by 2006-05-07
commit 58d0483b, "(find_identical_ends): Fix huge performance bug...",
at least to the extent that reverting that change fixes the bug.
Considering the stated effect of that change and lack of metrics,
reverting it is not an option, so here we take a more direct approach.

Given these inputs,

    printf '\n1'>a; printf '\n0\n\n1'>b

and running diff like this:

    ./diff -U1 a b

for input file "b", the pointer, files[1].linbuf[4][-1], to
the last byte on the final line was mistakenly pointing at the
sentinel newline at EOF, rather than at the preceding byte.

  (gdb) p files[1].linbuf[4][-1]
  $3 = 10 '\n'

Thus, this test in the final print_1_line call:

  if ((!line_flag || line_flag[0]) && limit[-1] != '\n')
    fprintf (out, "\n\\ %s\n", _("No newline at end of file"));

would fail, because limit[-1] (which is files[1].linbuf[4][-1])
was mistakenly '\n', rather than the desired '1'.

My first thought was simply to adjust the final linbuf[line] setting,
at the end of io.c's find_and_hash_each_line function function:

       if (p == bufend)
-       break;
+       {
+         if (current->missing_newline)
+           --linbuf[line];
+         break;
+       }

But that would make diff misbehave with this input
(same as above, but with a newline appended to "a"),

    printf '\n1\n'>a; printf '\n0\n\n1'>b
    ./diff -U1 a b

due to the block (100 lines above) that is triggered in that case
(but not in the both-files-missing-newline case):

      if (p == bufend
          && current->missing_newline
          && ROBUST_OUTPUT_STYLE (output_style))
        {
          /* This line is incomplete.  If this is significant,
             put the line into buckets[-1].  */
          if (ignore_white_space < IGNORE_SPACE_CHANGE)
            bucket = &buckets[-1];

          /* Omit the inserted newline when computing linbuf later.  */
          p--;
          bufend = suffix_begin = p;
        }

Note how "p" is decremented and "bufend" adjusted.
When that happens, we certainly don't want to decrement
"bufend" yet again.

Since there is no other way to determine at the end whether "bufend"
was already decremented, add a new variable to serve as witness.

* NEWS (Bug fixes): Mention it.
Reported by Timo Juhani Lindfors in http://bugs.debian.org/577832.
Forwarded by Santiago Vila.
2010-04-16 11:28:04 +02:00
Yannick Moy
24cc227fa1 with -F or -p, emit better function lines: no leading white space
* src/diff.c (print_context_function): For languages like Ada
that allow local functions and procedures, the plain context
function line may start with enough blank characters that the
function name does not get completely printed in the 40
characters limit.  This patch solves this problem by removing
these useless initial blank characters.
* NEWS (Changes in behavior): Mention this change.
2010-03-18 17:35:38 +01:00
Jim Meyering
3f591f4bb5 revert 2002 change that removed "Binary " from "files A and B differ"
With this change, "printf '\0'|diff - /dev/null" now prints
"Binary files - and /dev/null differ" once again.
This reverts 2002-06-28 commit a352f0980,
"(briefly_report): Don't say "Binary files differ", ...".
* src/analyze.c (briefly_report): Do include the "Binary " prefix
in the diagnostic, when !brief.
* NEWS (Changes in behavior): Mention the diagnostic change.
Reported by Andreas Hoenen in http://bugs.debian.org/570064.
2010-02-23 09:28:19 +01:00
Jim Meyering
9999d0b8df post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-02-11 11:09:01 +01:00
Jim Meyering
66f2f2d60a version 2.9
* NEWS: Record release date.
2010-02-11 10:45:20 +01:00
Jim Meyering
6a44886e24 maint: update all FSF copyright year lists to include 2010
Use this command:
git ls-files |grep -vE '^(\..*|COPYING|gnulib)$' |xargs \
env UPDATE_COPYRIGHT_USE_INTERVALS=1 build-aux/update-copyright
2010-01-01 16:18:27 +01:00
Jim Meyering
3850429db6 maint: bug-diffutils@gnu.org is the new bug-reporting address
* configure.ac (AC_INIT): Use bug-diffutils@..., not bug-gnu-utils
as the bug-reporting address.
* NEWS (Administrivia): Mention this.
* src/cmp.c (usage): Remove hard-coded address.
Instead, use gnulib's emit_bug_reporting_address function.
* src/diff.c (usage, option_help_msgid): Likewise.
* src/diff3.c (usage): Likewise.
* src/sdiff.c (usage): Likewise.
2009-11-16 22:40:43 +01:00
Jim Meyering
943b8a4383 sdiff, diff3: exec diff, not $(bindir)/diff
* src/Makefile.am (paths.h): Emit a definition of DEFAULT_DIFF_PROGRAM
that is simply "diff" (or whatever $(transform) would convert that to,
e.g., "gdiff").  This makes it so that tests can work without first
installing diff, and so that the binaries do not hard-code $(prefix).
* NEWS (Changes in behavior): Mention this.
2009-11-16 22:39:58 +01:00
Jim Meyering
9bfafb33a6 admin: update all copyright notices to include the year 2009 2009-11-11 22:18:37 +01:00
Jim Meyering
21ebf6648e maint/sc: enable check for duplicate "the"; fix one
* NEWS: s/the the/the/.
Adjust style to fit what some of the hooks and release tools expect.
* cfg.mk (local-checks-to-skip): Remove sc_the_the.
(old_NEWS_hash): Update.
2009-11-11 22:18:36 +01:00
Paul Eggert
e1820a76c0 * NEWS: New diff option --suppress-blank-empty (no longer -u default).
* doc/diff.texi (Detailed Unified): Trailing spaces are no longer
omitted.
(Trailing Blanks): New section.
(diff Options) Mention new option.
* src/diff.h (suppress_blank_entry): New decl.
* src/context.c (pr_unidiff_hunk): Support --suppress-blank-empty.
* src/util.c (print_1_line): Likewise.
* src/diff.c (longopts, main, option_help_msgid): Likewise.
(SUPPRESS_BLANK_EMPTY_OPTION): New constant.
2009-11-11 14:08:06 +01:00
Paul Eggert
43e4846f11 * COPYING: New file.
* AUTHORS: Update from GPLv2 to GPLv3.
* Makefile.am: Likewise.
* NEWS: Likewise.
* README: Likewise.
* README-hacking: Likewise.
* bootstrap: Likewise.
* bootstrap.conf: Likewise.
* configure.ac: Likewise.
* exgettext: Likewise.
* doc/Makefile.am: Likewise.
* lib/Makefile.am: Likewise.
* lib/cmpbuf.c: Likewise.
* lib/cmpbuf.h: Likewise.
* lib/prepargs.c: Likewise.
* m4/vararrays.m4: Likewise.
* man/Makefile.am: Likewise.
* ms/Makefile.am: Likewise.
* ms/README: Likewise.
* ms/config.bat: Likewise.
* ms/config.sed: Likewise.
* ms/config.site: Likewise.
* po/POTFILES.in: Likewise.
* src/Makefile.am: Likewise.
* src/analyze.c: Likewise.
* src/cmp.c: Likewise.
* src/context.c: Likewise.
* src/diff.c: Likewise.
* src/diff.h: Likewise.
* src/diff3.c: Likewise.
* src/dir.c: Likewise.
* src/ed.c: Likewise.
* src/io.c: Likewise.
* src/normal.c: Likewise.
* src/sdiff.c: Likewise.
* src/system.h: Likewise.
* src/util.c: Likewise.
2007-07-19 17:45:29 +00:00
Paul Eggert
b8c8ac122f * NEWS: Mention new sdiff aliases 1 and 2 for l and r.
* doc/diff.texi (Merge Commands): Likewise.
* src/sdiff.c (give_help): Give help for them.
(edit): Support them.
2007-06-06 23:40:16 +00:00
Paul Eggert
10892a2dcc * NEWS: diff -u no longer outputs trailing white space unless the
input data has it.
2006-09-05 23:02:32 +00:00
Paul Eggert
f5c7610983 Update FSF address. 2006-01-05 07:23:55 +00:00
Paul Eggert
91b8605708 * src/cmp.c: Don't include <setmode.h>.
(specify_ignore_initial): Reword to avoid gcc -W warnings.
(main): Use freopen instead of setmode, since freopen is in POSIX.
* src/context.c: Revert most 2004-09-01 changes.  Then:
(TIMESPEC_NS): Remove.  All uses replaced by
get_stat_mtime_ns.
Include stat-time.h, strftime.h.
(nstrtime): Remove decl.
* src/diff.c: Revert most 2004-09-01 changes.  Then:
Don't include <posixver.h>, <quotesys.h>, <setmode.h>.
Include <sh-quote.h>, <stat-time.h>, <timespec.h>.
All uses of quotesys replaced by sh-quote.
(main, compare_files):
Use freopen instead of setmode, since freopen is in POSIX.
(main): Don't complain about "diff -NUM'.
(main, set_mtime_to_now):
Adjust to stat-time.h macros when accessing nanoseconds.
* src/diff3.c: Include sh-quote.h rather than quotesys.  All uses
changed.
* src/dir.c (dir_read): excluded_filename renamed to
excluded_file_name.
* src/io.c: Don't include <setmode.h>.
(sip, read_files): Remove binary file stuff, leaving a FIXME behind.
A DOS expert needs to look at this.
* src/diff.c: Include sh-quote.h rather than quotesys.h.
All uses changed.
* src/system.h: Include verify.h.
(verify): Remove.  All uses changed to verify.h version.
Include <intprops.h>.
(TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove.  Now uses
intprops.h versions.
(O_BINARY): New defns, taken from coreutils.
* src/util.c: Include sh-quote.h rather than quotesys.h.
All uses changed.
2006-01-05 07:08:23 +00:00
Paul Eggert
4a1de90b3c Version 2.8.7. 2004-04-13 06:56:18 +00:00
Paul Eggert
477cd3074a Add news for 2.8.4, 2.8.6. 2004-04-12 07:44:35 +00:00
Paul Eggert
932176da4c Version 2.8.3. 2002-06-17 07:19:01 +00:00
Paul Eggert
d67b77f430 Version 2.8.2. 2002-06-11 05:53:54 +00:00
Paul Eggert
4921a4ab37 Doc fixes in 2.8.1. 2002-04-05 20:37:31 +00:00