1005 Commits

Author SHA1 Message Date
Jim Meyering
c61efccd23 tests: diff3: work around missing seq on some systems
* tests/diff3 (seq): Provide a seq replacement function,
since at least AIX, SunOS 5.10, OpenBSD-5.8 lack it.
Reported by Assaf Gordon in https://bugs.gnu.org/24227#8
2016-08-14 22:25:49 -07:00
Jim Meyering
edd942ca27 diff3: fix leaks, for real
* src/diff3.c (struct diff_block)[lint]: Add member, n2.
(free_diff_block, next_to_n2): New functions.
* tests/diff3: Add more test coverage.
2016-08-13 21:56:39 -07:00
Jim Meyering
b3def738f3 maint: require that commit messages be of a certain form
* bootstrap.conf (bootstrap_epilogue): Merge from coreutils, so that
a local commit hook will now help enforce consistent commit messages.
* Makefile.am (check-git-hook-script-sync): New rule, largely copied
from coreutils.
* scripts/git-hooks/commit-msg: New file, from coreutils, but
with adapted list of program names.
* scripts/git-hooks/applypatch-msg: New file, from git.
* scripts/git-hooks/pre-applypatch: Likewise.
* scripts/git-hooks/pre-commit: Likewise.
2016-08-13 21:56:16 -07:00
Bastian Beischer
1a0df4396e diff3: fix heap use-after-free; add minimal diff3 test coverage
Commit v3.3-42-g3b74a90, "FIXME: src/diff3: plug a leak" added an
invalid use of free, leading to use-after-free in nearly any invocation
of diff3.  Revert that commit.
* NEWS (Bug fixes): Mention it.
* tests/diff3: New file, to add minimal test coverage.
* tests/Makefile.am (TESTS): Add it.
Reported by Bastian Beischer in http://bugs.gnu.org/24210
2016-08-13 21:56:14 -07:00
Jim Meyering
88d911dbc7 build: ignore texinfo build artifacts
* .gitignore: Ignore texinfo artifacts in doc/.
2016-08-13 21:46:49 -07:00
Jim Meyering
1b3907f976 maint: diff3: remove an unreachable statement
* src/diff3.c (main): Remove unreachable "return" after exit from main.
2016-08-13 21:44:11 -07:00
Jim Meyering
697c1f4fa9 diff: disable colorization for TERM=dumb
* src/diff.c (main): With --color or --color=auto, when TERM is
"dumb", disable colorization.  Suggested by Daniel Colascione.
* NEWS (Bug fixes): Mention it.
* tests/colors: Add a test that would fail without this change,
yet passes with it.
2016-08-08 18:53:32 -07:00
Jim Meyering
0936993252 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2016-08-08 10:14:00 -07:00
Jim Meyering
5ac64141ed version 3.4
* NEWS: Record release date.
v3.4
2016-08-08 10:10:51 -07:00
Jim Meyering
05476e882f gnulib: update to latest 2016-08-06 13:50:06 -07:00
Jim Meyering
91d2340886 tests: tweak built_programs definition
* tests/Makefile.am (built_programs): Adjust to work around what
may be a problem due to interaction between Solaris 10's /bin/sh
and an old version of GNU make. Reported by Dagobert Michelsen
in https https://bugs.gnu.org/24137.
2016-08-06 11:19:07 -07:00
Jim Meyering
a37c584686 gnulib: update to latest 2016-08-02 19:09:20 -07:00
Jim Meyering
38e3a1dd49 tests: skip a /proc/self-dependent test on the Hurd
* tests/brief-vs-stat-zero-kernel-lies: The Hurd's /proc/self
is not useful, so detect that and skip the test that requires it.
Reported by Assaf Gordon in https://debbugs.gnu.org/24121#29
2016-08-02 09:30:06 -07:00
Jim Meyering
df14e616b3 tests/colors: fix portability problem with touch --date
* tests/colors (epoch): Don't use GNU touch's --date=$epoch option.
Use the portable -t 197001010000.00.
Reported by Assaf Gordon in https://debbugs.gnu.org/24121#8
2016-08-01 09:23:03 -07:00
Jim Meyering
47f84d5a75 build: Solaris 9: avoid link failure due to isblank use
* bootstrap.conf (gnulib_modules): Add isblank, to avoid a link
error on Solaris 9 Sparc.  Reported by Dagobert Michelsen.
2016-08-01 08:27:48 -07:00
Jim Meyering
b43e6fed25 test: improve test infrastructure
* tests/envvar-check: New file, copied from grep, with the addition
of the EDITOR and GREP_OPTIONS envvar names.
* tests/Makefile.am (EXTRA_DIST): Add it.
(TESTS_ENVIRONMENT): Revamp, to be more like that of grep.
2016-08-01 08:27:32 -07:00
Jim Meyering
e974118719 maint: remove gl/lib/reg*.c.diff; no longer needed
* gl/lib/regcomp.c.diff: Remove file, now that gnulib's
regcomp.c compiles regex.c with -Wno-unused-parameter.
* gl/lib/regex_internal.c.diff: This file induced a change to ensure
that the "Idx" type was unsigned and to remove a few "VAR < 0"
comparisons.  These days, it is probably fine to stay in sync with
gnulib/glibc's copies
of these files, so remove these patches, too.
* gl/lib/regexec.c.diff: Likewise.
Prompted by a report by Assaf Gordon and a suggestion from Paul Eggert.
2016-07-31 17:49:32 -07:00
Jim Meyering
55596fcd48 tests: colors: fix a portability problem and work around a shell bug
* tests/colors (e): Fix a portability bug: use printf '\033'
rather than '\e' to generate the required byte sequence, since
for some shells (at least dash 0.5.8), the latter doesn't work.
Work around a shell bug whereby "local tab=$(printf '\t')"
would result in an empty value for "$tab": hoist each "tab"
definition up/out of its function to global scope.
Reported by Assaf Gordon in http://debbugs.gnu.org/24116#8
2016-07-31 17:38:43 -07:00
Jim Meyering
0353af91a0 gnulib: update to latest; and tests/init.sh
* gnulib: Update to latest.
* init.sh: Update from gnulib.
2016-07-23 16:37:40 -07:00
Jim Meyering
a10ff125c8 maint: arrange for "make distcheck" to work with unreleased automake
* dist-check.mk (my-distcheck): Remove all .deps directories
before performing the recursive comparison.
2016-05-30 16:28:16 -07:00
Glenn Morris
752679190c doc: fix a reference to emacs' emerge node
* doc/diffutils.texi (Interactive Merging): Correct a reference to
emacs' emerge node: s/emerge/Emerge/.
This addresses http://debbugs.gnu.org/23613
2016-05-24 19:51:36 -07:00
Jim Meyering
8c19e4a18e maint: arrange for better URLs in generated announcement message
* cfg.mk (url_dir_list): Define.  I had been correcting the generated
URLs by hand, just before the announcement.  This is better.
2016-04-30 19:23:24 +01:00
Jim Meyering
5a485511d7 maint: don't ignore gitlog-to-changelog failure
* Makefile.am (gen-ChangeLog): Don't ignore failure of
gitlog-to-changelog. This syncs to coreutils' copy of this rule.
2016-03-15 10:38:23 -07:00
Giuseppe Scrivano
17e2698bcb diff: --color: fix an infinite recursion bug
* src/diff.h (presume_output_tty): New extern variable.
* src/diff.c (PRESUME_OUTPUT_TTY_OPTION): New enum.
(group_format_option): Add '-presume-output-tty'.
(main): Handle PRESUME_OUTPUT_TTY_OPTION.
* src/util.c: New variable `presume_output_tty'.
(check_color_output): Handle presume_output_tty.
(set_color_context): Call process_signals only when color_context is
not RESET_CONTEXT.
* tests/colors: Check that diff doesn't crash when interrupted
in the middle of a color sequence.

Reported by Gisle Vanem in http://debbugs.gnu.org/22067
2016-03-06 12:13:32 -08:00
Jim Meyering
3d8affcc9d maint: update prereq version of gettext
* configure.ac: Increase designated gettext version to 0.19.2
* bootstrap.conf (buildreq): Likewise.
Remove now-unnecessary code to remove gettext-provided files.
2016-01-31 18:01:27 -08:00
Jim Meyering
a19bcfd9e7 gnulib: update to latest 2016-01-31 16:54:44 -08:00
Jim Meyering
3b74a905c5 FIXME: src/diff3: plug a leak 2016-01-01 18:28:57 -08: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
Jim Meyering
a1140dd458 tests: arrange to print any skipped-test explanation to tty, too
I noticed that when a test was skipped, the reason was not printed.
This fixes it.  In coreutils, this variable is set in init.cfg,
but there is no point in putting the definition so far from the
code that chooses the file descriptor number in tests/Makefile.am.
* tests/Makefile.am (TESTS_ENVIRONMENT) [stderr_fileno_]: Define
here (to 9), right next to the companion "9>&2".
2015-12-06 11:22:45 -08:00
Jim Meyering
d77f95f8dc build: add gperf to the list of required programs
* bootstrap.conf (buildreq): Add gperf to the list.
Reported by Stephan Müller in http://debbugs.gnu.org/21945
2015-11-29 08:41:14 -08:00
Giuseppe Scrivano
875ca7183b tests: Add tests for --color and --palette
* tests/colors: New file.
* tests/Makefile.am (TESTS): Add colors.
2015-11-29 08:20:53 -08:00
Giuseppe Scrivano
0e72de4795 doc: mention --color and --palette in NEWS 2015-11-29 08:20:53 -08:00
Giuseppe Scrivano
04f6d57177 diff: add --palette
* bootstrap (gnulib_modules): Add 'argmatch'.
* doc/diffutils.texi: Add documentation for --palette
* src/diff.h (set_color_palette): New prototype.
* src/diff.c (set_color_palette): New function.
(color_palette): New variable.
* src/utils.c: Include "argmatch.h".
(struct bin_str): New struct.
(struct color_ext_type): New struct.
(color_indicator): New array.
(indicator_name): New array.
(indicator_no): New enum.
(parse_state): New enum.
(put_indicator): New function.
(get_funky_string): New function. Copied from coreutils ls.
(parse_diff_color):  New function. Copied from coreutils ls
"parse_ls_color" function.
(set_color_context): Use put_indicator instead of directly
outputting the sequence.
* po/POTFILES.in: Add 'lib/argmatch.c'
2015-11-29 08:20:53 -08:00
Giuseppe Scrivano
c0fa19fe92 diff: add support for --color
* doc/diffutils.texi (diff Options): Add documentation for --color.
Copied from coreutils ls --color.
* src/context.c (pr_unidiff_hunk): Set the color context.
(print_context_header): Likewise.
(pr_context_hunk): Likewise.
* src/diff.h (enum colors_style): New enum to record when to use colors.
(colors_style): New variable to memorize the argument value.
(set_color_context): Add function definition.
* src/diff.c: : Define COLOR_OPTION.
(specify_colors_style): New function.
(longopts): Add --color.
(main): Handle --color argument.
(option_help_msgid): Add usage string for --color.
* src/normal.c (print_normal_hunk): Set the color context.
* src/side.c (print_1sdiff_line): Likewise.
* src/util.c (print_1_line_nl): New function.
(print_1_line): Make it a wrapper of 'print_1_line_nl'.
(colors_enabled): New boolean variable.
(begin_output): Call check_color_output once the output file is
configured.
(output_1_line): Periodically call `process_signals'.
(caught_signals): New sigset_t.
(colors_enabled): New boolean variable.
(interrupt_signal): New sig_atomic_t.
(stop_signal_count): New sig_atomic_t.
(check_color_output): New function.
(install_signal_handlers): Likewise. Copied from coreutils ls.
(process_signals): Likewise.  Copied from coreutils ls.
(set_color_context): New function.
(sighandler): Likewise.  Copied from coreutils ls.
(stophandler): Likewise.  Copied from coreutils ls.
2015-11-29 08:20:53 -08:00
Andreas Grünbacher
b4efca9de4 diff: Improve help text of option --label
* src/diff.c (option_help_msgid): Improve help text of option --label.
2015-09-24 07:40:34 -07:00
Jim Meyering
2cd4ff3a5f build: correct man-page generation rule
The PATH was set incorrectly, so that the diff used by
help2man was the one from $PATH, rather than the just-built
one.
* man/Makefile.am (bin_dir): New variable, to...
(dist_man1_MANS): ...prepend ../src to PATH, not just "..".
Also, add a test to ensure that each $(bin_dir)/$$base is
executable, so this doesn't happen again.
In http://debbugs.gnu.org/21023, Rodrigo Valiña
Gutiérrez reported that diff.1 from the diffutils-3.3 tarball
contained no description of the then-new --no-dereference option.
2015-09-01 21:09:10 -07:00
Jim Meyering
5801f8add8 doc: --no-dereference: improve wording/description
* doc/diffutils.texi (Comparing Directories): Correct grammar.
(diff Options) [--no-dereference]: Say a little more.
2015-07-10 09:55:43 -07:00
Jim Meyering
29e8de4885 maint: update copyright year ranges to include 2015; update gnulib 2015-01-01 22:31:27 -08:00
KO Myung-Hun
ec60c3b6d1 diff: skip test if seek is not possible on OS/2 kLIBC
This fixes the problem that 'diff - file' and 'cat file | diff - file'
fail due to a seek failure with a message 'diff.exe: -: Invalid seek',
because seek does not work on stdin and a pipe on OS/2 kLIBC.

* src/io.c (sip): Set skip_test to true if seek is not possible on
OS/2 kLIBC.
2014-12-12 20:51:17 -08:00
Jim Meyering
ecf6a42058 gnulib: update to latest 2014-12-09 07:34:37 -08:00
KO Myung-Hun
3ef90a7e7c build: double-quote use of $PATH
* man/Makefile.am (dist_man1_MANS): On OS/2, PATH_SEPARATOR is ';',
but unquoted, that is interpreted as the shell's statement
terminator.  Quote it.
2014-12-09 07:34:37 -08:00
Paul Eggert
1fa6140faa diff: fix integer overflow problem with --tabsize
Reported by Tobias Stoeckmann in: http://bugs.gnu.org/18857
* src/diff.c (main): Don't overflow if INTMAX_MAX / 2 < tabsize.
* tests/bignum: New file, to test for this bug.
* tests/Makefile.am (TESTS): Add it.
2014-10-27 19:53:44 -07:00
Paul Eggert
df3af29627 doc: mention diff -B fix in NEWS 2014-09-03 16:02:35 -07:00
Paul Eggert
d2fd9d4683 diff: fix bug with diff -B and incomplete lines
Reported by Navin Kabra via Eric Blake in:
http://bugs.gnu.org/18402
* src/util.c (analyze_hunk): Don't mishandle incomplete
lines at end of file.
* tests/no-newline-at-eof: Test for the bug.
2014-09-03 15:59:24 -07:00
Paul Eggert
7bdd6479ce diff: fix performance bug with prefix computation
* src/io.c (find_identical_ends): Fix performance bug:
the test for when the prefix was needed messed up by
the 2002-02-28 integer-overflow fixes, causing performance to be
worse than it needed to be.
2014-09-03 15:59:24 -07:00
Jim Meyering
b6e6912772 gnulib: update to latest, as well as bootstrap 2014-08-23 14:10:43 -07:00
Jim Meyering
cfcba87350 maint: update copyright year range in texinfo documentation
* doc/diffutils.texi: Update copyright.
2014-08-23 14:06:31 -07:00
Jim Meyering
667864f284 maint: update bug-reporting address
* README: Change bug-gnu-utils@... to bug-diffutils@gnu.org.
* doc/diffutils.texi: Likewise.
Reported by Jamie Landeg Jones.
2014-04-15 08:05:55 -07:00
Paul Eggert
f6f1b1b49c diff: fix two "..." typos in --help output
* src/diff.c (option_help_msgid): Remove two "..." typos (Bug#17102).
2014-03-26 11:12:41 -07:00