1113 Commits

Author SHA1 Message Date
Jim Meyering
42868488c7 version 3.8
* NEWS: Record release date.
v3.8
2021-08-01 18:55:07 -07:00
Jim Meyering
498f88de4d build: update gnulib to latest 2021-08-01 12:31:59 -07:00
Jim Meyering
8d941fc5ad cmp: avoid reading uninitialized memory
[This *is* useful, so reapply. ]
When comparing buffers a word at a time, cmp could read up to
sizeof (word) - 1 uninitialized bytes.
* src/cmp.c (cmp): Set not just a single guaranteed-differing
sentinel byte just beyond any final read byte, but also ensure
that any following bytes are defined, if those may be read via
block_compare's word-at-a-time comparison.  Reported by Bruno Haible
in https://lists.gnu.org/r/diffutils-devel/2021-07/msg00003.html
2021-07-31 21:37:15 -07:00
Bruno Haible
cae1a3d257 cmp: avoid reading uninitialized memory
One or both of the sentinel bytes were copies of uninitialized values.
* src/cmp.c (cmp): Use arbitrary initialized values for the
sentinel bytes.
2021-07-28 19:01:26 -07:00
Jim Meyering
a9191e5588 cmp: revert preceding change
It did not solve the problem. The next patch does.
2021-07-28 18:56:33 -07:00
Jim Meyering
1aa7ccfca4 cmp: avoid reading uninitialized memory
When comparing buffers a word at a time, cmp could read up to
sizeof (word) - 1 uninitialized bytes.
* src/cmp.c (cmp): Set not just a single guaranteed-differing
sentinel byte just beyond any final read byte, but also ensure
that any following bytes are defined, if those may be read via
block_compare's word-at-a-time comparison.  Reported by Bruno Haible
in https://lists.gnu.org/r/diffutils-devel/2021-07/msg00003.html
2021-07-27 18:22:56 -07:00
Paul Eggert
747551b880 build: update gnulib submodule to latest 2021-07-19 16:17:38 -05:00
Paul Eggert
caf365bc32 diff: better --color help
* src/diff.c (option_help_msgid): Reword --color help without
using the confusing word “default”.  Problem reported
by Peter Oliver (Bug#48532).
2021-05-21 00:11:29 -07:00
Paul Eggert
4c42ca30c6 doc: fix URL in HACKING 2021-05-20 23:56:08 -07:00
Paul Eggert
cc1477078d diff: pacify compiler re style
* src/diff.c (usage): Prefer &"string"[N] to "string" + N.
Some compilers complain about the latter, as they worry C++
refugees will think it’s string concatnation.
2021-03-24 16:08:22 -07:00
Paul Eggert
4c92a42eb8 diff3: avoid signed int overflow
* src/diff3.c (main): Avoid signed integer overflow in the very
unlikely case of more than INT_MAX incompatible options.  Instead,
use one bit to record the presence of each type of incompatible
option, and report an error if more than one bit is set.
2021-03-24 16:08:22 -07:00
Paul Eggert
6feddb95b4 maint: don’t bother with -Wno-return-local-addr
* configure.ac (WERROR_CFLAGS): Don’t bother with
-Wno-return-local-addr as it doesn’t seem to work.
Anyway, it’s no longer needed on Ubuntu 20.10.
2021-03-24 16:08:21 -07:00
Paul Eggert
db2fa35597 maint: disable -Wstack-protector
* configure.ac (WERROR_CFLAGS): Disable -Wstack-protector, as it
has a false alarm with lib/vasnprintf.c on Ubuntu 20.10 and it’s
not worth working around.  Coreutils already disables it.
2021-03-24 16:08:21 -07:00
Paul Eggert
1399b225eb diff: plug memory leak in ifdef.c
Problem reported by Than (Bug#47362).
Fix the bug by using xmalloca instead of vararrays.
* bootstrap.conf (gnulib_modules): Add xmalloca; remove vararrays.
* configure.ac: Remove AC_C_VARARRAYS.
* src/ifdef.c: Include xmalloca.h instead of xalloc.h.
(do_printf_spec): Use xmalloca instead of an xmalloc
that lacks a corresponding ‘free’ if HAVE_C_VARARRAYS
due to a typo in 2017-05-18T05:51:31Z!meyering@fb.com.
2021-03-24 14:12:48 -07:00
Paul Eggert
b48581daa8 build: update gnulib submodule to latest 2021-03-24 14:12:48 -07:00
Paul Eggert
f88b033174 maint: work around GCC -Wreturn-local-addr bug
* configure.ac: Do not use -Wreturn-local-addr in Gnulib,
to suppress a false alarm in vasnprintf.c.
2021-01-02 19:08:22 -08:00
Jim Meyering
22fb055cca maint: update all copyright year number ranges
Run "make update-copyright" and then...
* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
2021-01-01 17:37:49 -08:00
Jim Meyering
9181dae4bf build: require autoconf-2.64
* configure.ac: Require 2.64, up from 2.63, to align with gnulib.
2020-12-05 17:42:45 -08:00
Jim Meyering
7c13bbbeca build: update gnulib to latest 2020-03-15 06:57:38 -07:00
Jim Meyering
9c1447f661 doc: adjust formatting to make apropos (man -k) work better
* man/Makefile.am $(dist_man1_MANS): Adjust sed substitution
to also remove the space after "GNU". This avoids the single
leading space on each man page title line.  I'm guessing that
interfered with indexing/searching, causing "man -k diff3" to
print this: diff3 (1) - (unknown subject).
Reported by Dan Jacobon in http://bugs.gnu.org/39769.
2020-03-15 06:57:15 -07:00
Jim Meyering
2280c5b4a5 doc: correct an ancient "At present"
* doc/diffutils.texi (Unified Format): Correct the now
seriously outdated "At present" (referring to early 1990s)
statement to be more of a historical note.
Reported by Roland Illig in http://bugs.gnu.org/39184.
2020-01-19 08:48:21 -08:00
Jim Meyering
91eebc4b86 doc: use program name, not "GNU", in the nroff/man header
* man/Makefile.am (dist_man1_MANS): Elide "GNU " prefix
from the generated prog+one-line-summary, so that help2man
uses the program name rather than "GNU" as the nroff "name".
Reported by Dan Jacobson in http://bugs.gnu.org/38574.
2020-01-05 11:33:46 -08:00
Jim Meyering
351f87d0c4 maint: update all copyright year number ranges
Run "make update-copyright" and then...
* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
2020-01-01 09:33:03 -08:00
Jim Meyering
db5ff0eb0a maint: avoid gnulib-tool deprecation warnings, and build failure
* bootstrap.conf (gnulib_modules): Use getopt-gnu, rather than
obsolete "getopt" module. Use nstrftime in place of strftime.
(avoided_gnulib_modules): Do not avoid the "lock" module. That
would lead to a build failure due to "glthread/lock.h not found".
2019-12-29 12:08:46 -08:00
Jim Meyering
a7808608fc maint: avoid syntax-check failure
* po/POTFILES.in: Add argmatch.h; remove xstrtol-error.c
2019-12-29 08:58:09 -08:00
Jim Meyering
f76d6a01dc maint: disable two and reenable many warning options
* configure.ac (GNULIB_WARN_CFLAGS): Disable -Wduplicated-branches
and -Wreturn-local-addr, due to a couple of false-positive warnings.
(WARN_CFLAGS): Reenable many warnings that now (with recent gcc)
provoke no false positive.
2019-12-29 08:56:43 -08:00
Jim Meyering
b4d66bbc06 maint: avoid gnulib's lock-tests module
* bootstrap.conf (avoided_gnulib_modules): Also --avoid=lock-tests
to avoid gnulib-related build failure.
2019-12-29 08:46:37 -08:00
Jim Meyering
98f55d7bf2 build: update gnulib to latest
* gnulib: Update submodule to latest.
* bootstrap: Copy from gnulib.
* tests/init.sh: Likewise.
2019-12-23 12:15:37 -08:00
Jim Meyering
3e0ece09ae maint: tweak bootstrap.conf
* bootstrap.conf (buildreq): Require at least autoconf 2.62,
up from 2.61, just as grep and coreutils do.
(bootstrap_post_import_hook): "Copy pkg-config's pkg.m4 ...",
copied from grep's bootstrap.conf.
(avoided_gnulib_modules): Pull this definition to the top.
Formatting.
2019-12-20 11:31:47 -08:00
Dave Odell
ee869b17b1 cmp: add test case for Bug#37558
* tests/cmp: New test case (Bug#37558).
Copyright-paperwork-exempt: yes
2019-10-01 11:15:38 -07:00
Paul Eggert
1a9db80899 cmp: fix -l width bug
Problem reported by Dave Odell (Bug#37558).
* src/cmp.c (cmp): Treat negative ‘bytes’ as infinite, fixing a
bug introduced in the 2019-08-27 patch that fixed Bug#35256.
2019-10-01 11:15:38 -07:00
Paul Eggert
8d26b1403e diff: don’t mistreat -N in arg as a large number
Problem reported by alec (Bug#35256).
* NEWS: Mention the fix.
* bootstrap.conf (gnulib_modules): Use strtoimax and xstrtoimax,
not strtoumax and strtoumax.
* src/cmp.c (bytes): Now signed, with -1 representing no limit.
All uses changed.
* src/cmp.c (specify_ignore_initial, main):
* src/diff.c (main):
* src/ifdef.c (format_group):
* src/sdiff.c (interact):
Use strtoimax, not strtoumax.
2019-08-27 16:17:08 -07:00
Paul Eggert
c12acba737 build: update gnulib submodule to latest 2019-08-27 16:17:08 -07:00
Paul Eggert
c65f4d64b1 maint: ignore ‘configure’ temporaries
* .gitignore: Ignore confdefs*, conftest*.
2019-07-19 14:11:10 -07:00
Paul Eggert
592e123468 maint: avoid Gnulib setlocale module
Problem reported for MS-Windows by Richard Gering (Bug#34376).
Diffutils doesn’t need any of the Gnulib fixes for setlocale.
* bootstrap.conf (gnulib_tool_option_extras):
Avoid the setlocale module.
2019-07-19 14:11:10 -07:00
KO Myung-Hun
1d19852975 tests: init.cfg: use $PATH_SEPARATOR not ':'
On OS/2, a path separator is semi-colon ';' not colon ':'.
* tests/init.cfg: Replace ':' with $PATH_SEPARATOR.
2019-05-24 13:36:51 -07:00
Jim Meyering
3600e8d4f0 build: ensure no VLA is used
Cause developer builds to fail for any use of a VLA.
VLAs (variable length arrays) limit portability.
* configure.ac (nw): Remove -Wvla from the list of disabled warnings,
thus enabling the warning when configured with --enable-gcc-warnings.
(GNULIB_NO_VLA) Define, disabling use of VLAs in gnulib.  This commit
is functionally equivalent to coreutils' v8.30-44-gd26dece5d.
2019-01-20 22:29:01 -08:00
Jim Meyering
0c8f1ff314 build: update gnulib to latest
* gnulib: Update to latest.
* po/POTFILES.in: Add lib/xstdopen.c.
2019-01-20 22:28:39 -08:00
Paul Eggert
db6d5f7240 diff: use xstdopen, not stdopen
* bootstrap.conf (gnulib_modules):
* src/cmp.c, src/diff.c, src/diff3.c, src/sdiff.c (main):
Use xstdopen, not stdopen.
2019-01-06 17:23:17 -08:00
Paul Eggert
86ece0ee21 build: update gnulib submodule to latest 2019-01-06 17:23:17 -08:00
Jim Meyering
badccffea4 maint: convert all TABs to equivalent spaces in indentation
Using this file,

cat > leading-blank.exempt <<\EOF
(\.gitmodules|help2man|pre-commit)$
(?:^|\/)ChangeLog[^/]*$
(?:^|\/)(?:GNU)?[Mm]akefile[^/]*$
\.(?:am|mk)$
EOF

run the following command to convert all non-conforming leading white
space to be all spaces:

git ls-files \
  | pcregrep -vf leading-blank.exempt \
  | xargs pcregrep -l '^ *\t' \
  | xargs perl -MText::Tabs -ni -le \
    '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'

Since that changed old NEWS, I also ran "make update-NEWS-hash"
to update the old_NEWS_hash value in cfg.mk.
2019-01-05 22:47:23 -08:00
Paul Eggert
601eceb57c diff: fix cmp, diff3, sdiff with stdin closed
* NEWS: Mention this.
* src/cmp.c, src/diff3.c, src/sdiff.c: Include stdopen.h.
(main): Call stdopen early.
* src/cmp.c (main): Simplify now that we need not worry about
stdin being closed.
* src/diff.c (main): Translate stdopen diagnostic.
2019-01-05 20:02:02 -08:00
Paul Eggert
2c9d956aac diff: remove unportable ‘diff -N - f <&-’ feature
* NEWS: Mention this.
* bootstrap.conf (gnulib_modules): Add stdopen.
* doc/diffutils.texi (Comparing Directories):
Do not document behavior if stdin is closed.
* src/diff.c: Include stdopen.h.
(main): Call stdopen early.
(compare_files) [__hpux]: Remove recently-introduced
special case for HP-UX exec with stdin closed.
* tests/new-file: Remove tests of the removed feature.
2019-01-05 19:20:36 -08:00
Paul Eggert
1104d02651 build: update gnulib submodule to latest 2019-01-05 19:20:36 -08:00
Bruno Haible
b09adbffd5 diff: recognize file descriptors closed by the parent process on HP-UX
* src/diff.c (compare_files): Use fcntl to distinguish a file
descriptor closed by the parent process from a file descriptor
that references /dev/null.
2019-01-03 22:08:56 -08:00
Jim Meyering
197d7d492f maint: update all copyright dates via "make update-copyright"
* gnulib: Also update submodule for its copyright updates.
2019-01-01 19:02:28 -08:00
Jim Meyering
70d787ef44 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2018-12-31 17:58:56 -08:00
Jim Meyering
2de623e7a1 version 3.7
* NEWS: Record release date.
v3.7
2018-12-31 17:56:36 -08:00
Jim Meyering
04c64737c5 maint: distribute new file, init.cfg
Otherwise, strip-trailing-cr would fail on a system without valgrind.
* tests/Makefile.am (EXTRA_DIST): Include init.cfg.
2018-12-31 17:56:23 -08:00
Dennis Lambe Jr
aaf0efa70d diff: adjust ANSI escapes for compatibility with less -R
GNU less can display ANSI-colored text with the -R flag, but this
support has some limitations. One of them is that if an escape
sequence starts on one line and ends on a different line, only the
first line will be colored in less.

As a result, when diff creates colored output with multi-line deletes
or adds, less will only color the first line.

This change resets ANSI color to the default at the end of
each line and restarts it at the beginning of the next. It patches
normal and context mode. Side-by-side already worked in my testing.
* src/context.c (print_context_label, pr_context_hunk): As above.
(pr_unidiff_hunk, print_context_header): Likewise.
* src/normal.c (print_normal_hunk): Likewise.
* tests/colors: Adjust existing tests to accommodate this.
* NEWS (Improvements): Mention it.
Proposed in http://bugs.gnu.org/31105
2018-12-30 22:22:10 -08:00