summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* bootstrapped repositoryRichard Maw2012-01-091-0/+1428
|
* New option --no-dereference.Bruno Haible2012-01-082-4/+74
| | | | | | | | | | | | | | | * src/diff.h (no_dereference_symlinks): New variable. * src/diff.c: Include xreadlink.h. (longopts): Add --no-dereference option. (main): Accept --no-dereference option. (option_help_msgid): Mention the --no-dereference option. (compare_files): If no_dereference_symlinks is true, use lstat() instead of stat(). Compare symbolic links by comparing their values. * bootstrap.conf (gnulib_modules): Add lstat, stat, xreadlink. * doc/diffutils.texi (Comparing Directories, diff Options): Mention the --no-dereference option. * tests/no-dereference: New file. * tests/Makefile.am (TESTS): Add it.
* maint: update all copyright year number rangesJim Meyering2012-01-0116-16/+16
| | | | Run "make update-copyright".
* build: update to latest gnulib and adaptJim Meyering2011-12-146-8/+8
| | | | | | | | | | | | | | | | | * tests/binary: Reverse arguments to compare to avoid failure of new syntax-check rule. * configure.ac: Use -Wno-format-nonliteral. Mark functions as pure of const, per recommendations enabled by new gcc -W options. Use _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST. * lib/cmpbuf.h (buffer_lcm, block_compare): Apply pure and/or const attributes. * src/cmp.c (block_compare): Likewise. * src/context.c (find_hunk): Likewise. * src/diff.h (lines_differ): Likewise. * src/diff3.c (skipwhite): Likewise. * src/dir.c (dir_loop): Likewise. * src/util.c (find_change, find_reverse_change): Likewise. (translate_line_number): Likewise.
* portability: use SET_BINARY rather than xfreopen (NULL, ...Claudio Bley2011-10-042-5/+5
| | | | | | | * src/diff.c: Include binary-io.h, not xfreopen.h. (main): Use SET_BINARY (...) rather than xfreopen (NULL, X, ...), because the latter doesn't work on MinGW and crashes using MSVC. * src/cmp.c (main): Likewise.
* maint: avoid new "make sytnax-check" failure.Jim Meyering2011-08-151-1/+1
| | | | | * src/diff.h (find_dir_file_pathname): Mark declaration with "extern" keyword, in order to placate the tight-scope syntax check.
* * src/io.c (find_and_hash_each_line): Refactor for brevity.Paul Eggert2011-08-141-158/+77
|
* diff, sdiff: new option --ignore-trailing-space (-Z)Roland McGrath2011-08-145-55/+150
| | | | | | | | | | | | | | 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.
* diff: --ignore-file-name-case now applies at top level tooTim Waugh2011-08-133-1/+48
| | | | | | | | | | | 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.
* doc: insert comma in --help line for --ignore-space-change (-b)Santiago Vila2011-08-081-1/+1
| | | | | * src/diff.c (option_help_msgid): Insert omitted comma between "-b" and "--ignore-space-change". (tiny change)
* maint: remove inclusion of unused header, for "make syntax-check"Jim Meyering2011-07-032-2/+0
| | | | | * src/diff3.c: Don't include <inttostr.h>. Not used. * src/context.c: Likewise.
* build: ccache works better without embedded version stringsJim Meyering2011-06-136-4/+27
| | | | | | | | | | | | | * src/Makefile.am: Generate version.c and version.h and put the new symbol in a tiny library to be used by each program. (LDADD): Add the new library. * src/cmp.c (main): Use Version, not PACKAGE_VERSION, so the .o file does not change with each commit-derived version increment. * src/diff.c (main): Likewise. * src/diff3.c (main): Likewise. * src/sdiff.c (main): Likewise. * src/system.h: Include "version.h". * .gitignore: Add version.[ch]
* cmp, diff, diff3, sdiff: edit and align --help text.Karl Berry2011-06-084-103/+146
| | | | | | | | * cmp.c (option_help_msgid, usage), * diff.c (option_help_msgid, usage), * diff3.c (option_help_msgid, usage), * sdiff.c (option_help_msgid, usage): align descriptions in the --help output and slightly edit content.
* diff: don't use locales after local-specific sorting failsPaul Eggert2011-05-271-3/+1
| | | | | | | * src/dir.c (compare_names): Don't invoke strcasecmp if locale-specific sorting fails, because POSIX.1-2008 says strcasecmp has unspecified behavior outside the POSIX locale. See: http://lists.gnu.org/archive/html/bug-diffutils/2011-05/msg00008.html
* maint: prepare for the tight-scope checkJim Meyering2011-05-182-39/+45
| | | | | | | | | | * src/diff.h: Mark function declarations with "extern" in preparation for the tight-scope check. (ignore_white_space): Separate enum decl from declaration of this variable. * src/Makefile.am (diff_SOURCES): Move diff.h from here to ... (noinst_HEADERS): ...here. For convenience, since the tight-scope rule uses $(noinst_HEADERS).
* docs: diff --help should mention -LEric Blake2011-03-181-1/+1
| | | | * src/diff.c (option_help_msgid): Document -L.
* maint: remove all uses of vfork: use fork insteadJim Meyering2011-01-244-52/+14
| | | | | | | | | | | | | Our use of vfork now provokes warnings from gcc-4.6.0. Also, vfork is no longer even specified by POSIX.1-2008. * src/diff3.c (read_diff): Change each use of vfork to "fork". Remove #ifdef'd code. * src/util.c (begin_output, finish_output): Likewise. * src/sdiff.c (cleanup, main, edit): Likewise. (handler_index_of_SIGPIPE): Remove now-unused definition. * src/system.h: Don't include <vfork.h>. (vfork): Remove definition. * ms/config.site: Remove reference to vfork cache variable.
* maint: avoid new syntax-check failureJim Meyering2011-01-232-2/+2
| | | | | * src/diff.c (specify_value): Use !STREQ(...), not strcmp(...) != 0. * src/diff3.c (main): Likewise.
* maint: update copyright year ranges to include 2011Jim Meyering2011-01-0316-16/+16
| | | | Run "make update-copyright", so "make syntax-check" works in 2011.
* maint: avoid shadowing warningJim Meyering2010-09-041-3/+3
| | | | * src/dir.c (diff_dirs): Rename shadowed local cmp to "c".
* diff -r: avoid printing excess slashes in concatenated file namesJim Meyering2010-08-143-16/+4
| | | | | | | | | | | | * bootstrap.conf (gnulib_modules): Add filenamecat. * src/diff.c: Include "filenamecat.h". (compare_files): Use file_name_concat, rather than dir_file_pathname. * src/util.c (dir_file_pathname): Remove now-unused function. * src/diff.h: Remove its declaration. * tests/excess-slash: New script to test for this. * tests/Makefile.am (TESTS): Add it. Forwarded by Santiago Vila from <bugs.debian.org/586301a>, reported by Jari Aalto.
* diff: avoid spurious diffs when two distinct dir entries compare equalPaul Eggert2010-08-121-2/+39
| | | | | | | | | | | | 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.
* build: don't define macros that gnulib providesJim Meyering2010-05-091-13/+0
| | | | | | | | | * bootstrap.conf (gnulib_modules): Add signal, stdint. * lib/cmpbuf.c (SA_RESTART, SA_INTERRUPT): Remove definitions. (SIZE_MAX, PTRDIFF_MAX): Likewise. Include <stdint.h>. * src/system.h (WEXITSTATUS, WIFEXITED): Remove definitions. (SA_RESTART, SA_INTERRUPT): Likewise.
* build: rely on gnulib's sigprocmask moduleJim Meyering2010-05-091-23/+0
| | | | | * src/sdiff.c: Remove #if-!HAVE_SIGPROCMASK-guarded code. * bootstrap.conf (gnulib_modules): Add sigprocmask.
* maint: remove now-useless #if HAVE_HEADER_H guardsJim Meyering2010-04-301-3/+1
| | | | | | * src/system.h: Include <sys/wait.h> unconditionally, now that gnulib guarantees its presence. * lib/cmpbuf.c: Likewise for <unistd.h> and <inttypes.h>.
* Followon improvements for the fix for Debian bug 577832.Paul Eggert2010-04-161-13/+9
| | | | | | | * src/io.c (find_and_hash_each_line): Omit the inserted newline in a simpler way. * tests/no-newline-at-eof: Fix the test case so that it rejects the old, buggy behavior.
* diff: fix a regression when at least one input lacks a newline-at-EOF,Jim Meyering2010-04-161-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* diff -F/-p: don't depend on locale-specific white-space definitionJim Meyering2010-04-051-2/+3
| | | | | * src/context.c: Include "c-ctype.h". Use c_isspace, not isspace.
* with -F or -p, emit better function lines: no leading white spaceYannick Moy2010-03-181-5/+7
| | | | | | | | | | * 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.
* revert 2002 change that removed "Binary " from "files A and B differ"Jim Meyering2010-02-231-3/+8
| | | | | | | | | | | 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.
* avoid compilation failure on systems lacking both fork and vforkJuan Manuel Guerrero2010-02-142-2/+2
| | | | | | | * src/sdiff.c [!HAVE_WORKING_FORK && !HAVE_WORKING_VFORK] (main): Pass the right number of arguments to shell_quote_copy. * src/util.c [!HAVE_WORKING_FORK && !HAVE_WORKING_VFORK] (begin_output): Likewise.
* maint: change use of "|" to more maintainable "||" (no semantic change)Jim Meyering2010-02-101-1/+1
| | | | | | | | * src/analyze.c (diff_2_files): Using the "||" operator happens to be equivalent to using "|" in this case. It is also clearer and less prone to inadvertent bug introduction, in case the variable, "changes" were ever to take on a value not in {0,1}. Patch by Tim Waugh, via Mike Frysinger.
* portability: avoid "diff - ..." failure at least on *BSD and SolarisJim Meyering2010-02-101-1/+1
| | | | | | | The new "stdin" test was failing on many types of systems. * src/diff.c (compare_files): Guard use of xfreopen (NULL, "rb", ... also with O_BINARY, so as to avoid this unnecessary call on systems where it's not needed (on some it fails with "Bad address".
* build: allow compilation on cygwinEric Blake2010-01-041-1/+2
| | | | | * src/Makefile.am (cmp_LDADD): Move LIBICONV... (LDADD): ...into global flags, since all programs need it.
* maint: update all FSF copyright year lists to include 2010Jim Meyering2010-01-0116-18/+18
| | | | | | Use this command: git ls-files |grep -vE '^(\..*|COPYING|gnulib)$' |xargs \ env UPDATE_COPYRIGHT_USE_INTERVALS=1 build-aux/update-copyright
* build: enable warnings and -Werror.Jim Meyering2009-11-221-0/+1
| | | | | | | | * src/Makefile.am (AM_CFLAGS): Enable warnings and -Werror. Set to this: $(WARN_CFLAGS) $(WERROR_CFLAGS) * lib/Makefile.am (AM_CFLAGS): Similarly, but use this: $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS) * configure.ac (GNULIB_WARN_CFLAGS): Don't turn off -Wuninitialized.
* build: fix test run on cygwinEric Blake2009-11-201-1/+1
| | | | | | | | This, plus a gnulib update for xalloc-die-tests, are necessary for make check to pass on cygwin. * tests/Makefile.am (built_programs): Ignore $(EXEEXT). * src/Makefile.am (paths.h): Add missing dependency.
* maint: remove vestiges of nanosleepJim Meyering2009-11-201-2/+1
| | | | | | * src/Makefile.am (LDADD): Remove $(LIB_NANOSLEEP), now that we no longer use the nanosleep module. Spotted by Eric Blake.
* build: link with now-required librariesJim Meyering2009-11-201-2/+12
| | | | | * src/Makefile.am (LDADD): Add gnulib-required libraries. (cmp_LDADD): Add $(LIBICONV), for cmp's use of proper_name_utf8.
* build: suppress warnings about bindtextdomain and textdomainJim Meyering2009-11-201-0/+6
| | | | * src/system.h (bindtextdomain, textdomain) [!ENABLE_NLS]: Define away.
* use xfreopen rather than freopenJim Meyering2009-11-203-7/+9
| | | | | | | | | * src/cmp.c: Include "xfreopen.h". Use xfreopen in place of freopen. * src/diff.c Likewise, and... (main): Set exit_failure to EXIT_TROUBLE, rather than to 2. * src/diff3.c: Likewise. * bootstrap.conf (gnulib_modules): Add xfreopen.
* maint: add an assertion to suppress clang-detected warningJim Meyering2009-11-201-2/+6
| | | | | | | | The clang static analyzer reported that a NULL parent could be dereferenced. However, that cannot happen, because for all callers, the parameter, parent, is always non-NULL at that point. * src/diff.c: Include <assert.h>. Assert that parent is not NULL.
* maint: remove dead assignment from diff3.cJim Meyering2009-11-201-1/+0
| | | | * src/diff3.c (make_3way_diff): Remove dead assignment.
* maint: hide build commands behind $(AM_V_GEN)Jim Meyering2009-11-181-3/+5
| | | | | * src/Makefile.am (paths.h): Use $(AM_V_GEN), and split a long line. * man/Makefile.am ($(dist_man1_MANS)): Use $(AM_V_GEN) here, too.
* build: avoid link failure when libsigsegv is usedEric Blake2009-11-161-1/+1
| | | | * src/Makefile.am (LDADD): Link against LIBSIGSEGV.
* maint: define/use PROGRAM_NAME and AUTHORS; use propername moduleJim Meyering2009-11-165-12/+38
| | | | | | | | | | * bootstrap.conf (gnulib_modules): Add propername. * src/cmp.c (PROGRAM_NAME, AUTHORS): Define. (main): Use them in use of version_etc. * src/diff.c (PROGRAM_NAME, AUTHORS, main): Likewise. * src/diff3.c (PROGRAM_NAME, AUTHORS, main): Likewise. * src/sdiff.c (PROGRAM_NAME, AUTHORS, main): Likewise. * src/system.h: Include "propername.h".
* maint: no longer define *_FILENO constantsJim Meyering2009-11-161-9/+0
| | | | | * src/system.h (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): Remove definitions. Now guaranteed by gnulib.
* maint: bug-diffutils@gnu.org is the new bug-reporting addressJim Meyering2009-11-164-11/+10
| | | | | | | | | | | * 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.
* sdiff, diff3: exec diff, not $(bindir)/diffJim Meyering2009-11-161-1/+1
| | | | | | | | * 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.
* admin: update all copyright notices to include the year 2009Jim Meyering2009-11-1116-30/+30
|