76 Commits

Author SHA1 Message Date
Jim Meyering
55260678d9 build: modernize bootstrap prerequsite tools
Following Pádraig Brady's example from coreutils, ...
* bootstrap.conf: Add an explicit requirement on m4.
Add an explicit requirement on texi2pdf which is often packaged
separately to makeinfo and induces a failure far down the
distribution phase if not present.
Replace the rsync dependency with wget,
which gnulib changed to in 2018.
Also, add an xz requirement and a version for autopoint.
2023-05-20 02:27:03 -07:00
Paul Eggert
d9c367b164 diff: use function for robust_output_style
* bootstrap.conf (gnulib_modules): Add extern-inline.
* src/diff.h: Use _GL_INLINE_HEADER_BEGIN and _GL_INLINE_HEADER_END.
(DIFF_INLINE): New macro.
(robust_output_style): Now an inline function, not a macro
ROBUST_OUTPUT_STYLE.  All uses changed.
2023-05-19 09:10:12 -07:00
Carlo Marcelo Arenas Belón
13a05d1e95 gnulib: fix Y2038 bug (again)
AC_SYS_LARGEFILE meaning has changed, need AC_SYS_YEAR2038 as well

* NEWS: mention this
* tests: add test
* bootstrap.conf: add year2038

Copyright-paperwork-exempt: yes
2023-05-13 22:23:57 -07:00
Paul Eggert
7e7ef707d6 build: update gnulib submodule to latest 2023-02-07 20:47:18 -08:00
Paul Eggert
7e7a21b05b diff: use C23 bool
* bootstrap.conf (gnulib_modules): Add stdbool.
* src/die.h, src/system.h: Do not include <stdbool.h>.
2023-02-05 14:01:54 -08:00
Paul Eggert
09f8e2b0a9 diff: prefer nullptr to NULL
* bootstrap.conf (gnulib_modules): Add c-nullptr.
* src/cmp.c (main):
* src/context.c (pr_context_hunk, pr_unidiff_hunk)
(mark_ignorable, find_function):
* src/diff.c (longopts, main, specify_value, specify_style)
(specify_colors_style, compare_files):
* src/diff3.c (main, process_diff):
* src/dir.c (find_dir_file_pathname):
* src/ifdef.c (scan_char_literal):
* src/sdiff.c (main):
* src/util.c (process_signals, install_signal_handlers)
(color_ext_list, color_indicator, indicator_name)
(parse_diff_color):
Prefer C23-style nullptr to NULL, as nullptr is a bit better.
2023-02-05 14:01:54 -08:00
Jim Meyering
cc41598038 tests: avoid large-subopt XPASS on systems without perl
* tests/large-subopt: Use $PERL, rather than hard-coding "perl".
* bootstrap.conf (gnulib_modules): Add "perl" to the list.
Reported by Bruno Haible in
https://lists.gnu.org/r/diffutils-devel/2023-01/msg00000.html
2023-01-05 22:44:07 -08:00
Jim Meyering
47a1f46f08 maint: update copyright dates 2023-01-01 17:19:37 -08:00
Jim Meyering
aec523d3a4 maint: make update-copyright 2022-01-03 11:49:11 -08:00
Paul Eggert
76f518677b doc: copy fdl.texi into git
This pacifies this notice from ./bootstrap: “Notice from module
fdl: Don't use this module! Instead, copy the referenced license
file into your version control repository.”
* bootstrap.conf (gnulib_modules): Remove fdl.
* doc/fdl.texi: New file, taken from Gnulib.
2021-10-16 01:11:15 -07:00
Paul Eggert
3e83dac7ad maint: direct dependency on time_rz now
Now that diff calls tzalloc, it depends directly on time_rz.
* bootstrap.conf (gnulib_modules): Add time_rz.
2021-10-16 01:11:15 -07:00
Paul Eggert
f1de694cbf maint: prefer attribute.h attributes
Prefer the macros used in attribute.h, and _Noreturn,
to the by-hand use of __attribute__, as this is more portable.
* bootstrap.conf (gnulib_modules): Add attribute.
* src/system.h: Include attribute.h.  All uses of
attributes changed to use the attribute.h macros.
Plus, use _Noreturn.
(FALLTHROUGH): Remove; attribute.h now defines this.
2021-08-30 10:32:18 -07:00
Paul Eggert
37ff1120ad diff: use variable arg list for messages
This simplifies the code by using varargs.
* bootstrap.conf (gnulib_modules): Add flexmember.
(XGETTEXT_OPTIONS): Do not flag message5.
* src/util.c: Include flexmember.h, stdarg.h.
(struct msg): New members msgid, argbytes.  args is now
FLEXIBLE_ARRAY_MEMBER, and does not contain msgid.
All uses changed.
(message): Now varargs.  Detect number of args by counting '%'s.
Use FLEXSIZEOF, to avoid problems on systems with buggy
allocators.  Avoid redundant ‘*p = 0’ when *p is already zero
after stpcpy.
(message5): Remove; all callers changed to use ‘message’.
(print_message_queue): Abort if too many args were passed;
this cannot happen with current diffutils.
2021-08-30 10:32:18 -07:00
Paul Eggert
9b20182d48 diff: cleanup signal handling just before exit
This should fix an unlikely signal handling bug with colored
output, and should also fix a Debian FTBFS (Fails To Build From
Source) on powerpc64le-linux.  See Bug#34519 and Frédéric
Bonnard’s report in:
https://bugs.debian.org/922552#19
* bootstrap.conf (gnulib_modules): Add raise, sigprocmask.
* src/diff.c (main): Call cleanup_signal_handlers before exiting.
Don’t bother calling ‘exit’; no longer needed nowadays.
* src/util.c (sigprocmask, siginterrupt) [!SA_NOCLDSTOP]:
Define to 0 instead of empty, since the results are now used.
(sigset_t) [!SA_NOCLDSTOP]: Remove; we now rely on Gnulib.
(xsigaction) [SA_NOCLDSTOP]: New function.
(xsigaddset, xsigismember, xsignal, xsigprocmask): New functions.
(some_signals_caught): New static var.
(process_signals): Omit a conditional branch.
Don’t bother loading interrupt_signal if stop_signal_count is nonzero.
(process_signals, install_signal_handlers):
Check for failures from sigprocmask etc.
(sig, nsig): Now at top level, since multiple functions need them.
(install_signal_handlers): No need for caught_sig array;
just use caught_signals.  However, set some_signals_caught.
(cleanup_signal_handlers): New function.
2021-08-28 23:55:27 -07:00
Paul Eggert
dadc7f231f diff: avoid sprintf %s
sprintf fails if the result contains more than INT_MAX bytes,
so rework the code to avoid usage of sprintf %s where the
string might be longer than that.
* bootstrap.conf (gnulib_modules): Remove xvasprintf.
* src/diff.c (specify_style):
* src/util.c (begin_output):
Rewrite to avoid sprintf %s.
* src/util.c: Do not include xvasprintf.h.
(concat): Remove, as it uses sprintf %s.  All uses rewritten.
2021-08-22 14:02:22 -07:00
Paul Eggert
31226b9bbe diff: use mempcpy
* bootstrap.conf (gnulib_modules): Add mempcpy, stpcpy.
* src/ifdef.c (do_printf_spec):
* src/sdiff.c (expand_name, lf_snarf, temporary_file):
* src/util.c (message5):
Prefer mempcpy to memcpy plus manual size-updating.
Prefer stpcpy to mempcpy plus manual size-spec.
2021-08-22 14:02:22 -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
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
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
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
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
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
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
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
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
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
4a38f715f1 maint: update gnulib and copyright dates for 2018
* gnulib: Update to latest.
* all files: Run "make update-copyright".
* bootstrap: Update from gnulib.
2018-01-06 16:51:19 -08:00
Jim Meyering
90106d33ab maint: update gnulib and copyright dates for 2017
* gnulib: Update to latest.
* all files: Run "make update-copyright".
2017-01-01 03:22:44 -08: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
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
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
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
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
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
Jim Meyering
29e8de4885 maint: update copyright year ranges to include 2015; update gnulib 2015-01-01 22:31:27 -08:00
Paul Eggert
59f4ef95f8 cmp, diff, sdiff: tune by using rawmemchr
On my platform (AMD Phenom II X4 910e, Fedora 17 x86-64), this sped up
'cmp -n 8GiB /dev/full /dev/zero' by a factor of 3.8, and
'cmp -sn 8GiB /dev/full /dev/zero' by a factor of 1.8.
* bootstrap.conf (gnulib_modules): Add rawmemchr.
* src/cmp.c (cmp): Optimize the common case where buffers are the same,
by using count_newlines rather than block_compare_and_count.
(block_compare_and_count): Remove.
(count_newlines): New function.
* src/cmp.c (count_newlines):
* src/io.c (prepare_text):
* src/sdiff.c (lf_copy, lf_skip, lf_snarf):
Use rawmemchr instead of memchr, for speed.
2013-08-22 15:46:27 -07:00
Paul Eggert
0c22f56ed7 maint: update build procedure to recent gettext etc.
* bootstrap.conf (gnulib_modules): Add vararrays.
(needed_gnulib_files, unnecessary_gettext_files): New vars.
(bootstrap_post_import_hook): New function, to implement these vars.
(excluded_files): Remove; 'bootstrap' no longer supports this.
Its function is now performed by unnecessary_gettext_files.
(buildreq): Update automake to 1.12.2, to avoid CVE-2012-3386.
* configure.ac (AM_GNU_GETTEXT_VERSION): Bump from 0.17 to 0.18.2,
to lessen the probability that we'll have outlandishly old files
during a build.
* m4/vararrays.m4: Remove from repository, as we now use the
gnulib version.
2013-03-23 00:26:36 -07:00
Jim Meyering
a0483cb2fc maint: update all copyright year number ranges
Run "make update-copyright".
2013-01-04 11:13:02 +01:00
Jim Meyering
221383bcb1 maint: use xasprintf in place of xmalloc+sprintf
* bootstrap.conf (gnulib_modules): Add gnulib's xvasprintf module.
* src/util.c: Include "xvasprintf.h".
(begin_output): Use xasprintf in place of xmalloc+sprintf.
2012-09-10 14:31:35 +02:00
Paul Eggert
3549f733b9 main: port subcommands to mingw
Problem reported by Eli Zaretskii in
<http://lists.gnu.org/archive/html/bug-gnu-utils/2012-05/msg00013.html>.
Approach suggested by Bruno Haible as option (4) in
<http://lists.gnu.org/archive/html/bug-gnu-utils/2012-05/msg00036.html>.
* bootstrap.conf (gnulib_modules): Add system-quote.
* src/diff3.c, src/sdiff.c, src/util.c:
Include <system-quote.h>, not <sh-quote.h>.
* src/diff3.c (read_diff):
* src/sdiff.c (main, edit):
* src/util.c (begin_output):
Use system_quote_argv, for portability to Mingw.
* src/sdiff.c (NUM_SIGS, handler_index_of_SIGINT): Now enum
values, not macros; this is cleaner and avoids a GCC warning if
!HAVE_WORKING_VFORK.
* src/util.c (begin_output) [! HAVE_WORKING_FORK]: Do not use -f,
for consistency with the HAVE_WORKING_FORK code.
2012-05-14 23:08:59 -07:00
Paul Eggert
b2892140d8 sdiff: remove dependency on sigprocmask
* bootstrap.conf (gnulib_modules): Remove sigprocmask.
* src/sdiff.c (temporary_file): No need to invoke sigprocmask
here, since the signal handler merely sets a flag.
2012-02-12 13:08:50 -08:00
Jim Meyering
301a23cdbb build: accommodate newer bootstrap from gnulib
* bootstrap.conf (gnulib_tool_option_extras): Add both --symlink
and --makefile-name=gnulib.mk.  Also remove now-obsolete $bt/ prefix.
* bootstrap: Update from gnulib.
* tests/init.sh: Update from gnulib.
* lib/Makefile.am: Initialize numerous variables, so that
generated code in gnulib.mk may use += to append to them.
2012-01-12 14:04:44 +01:00
Bruno Haible
e3324651cc New option --no-dereference.
* 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.
2012-01-08 21:26:27 +01:00
Jim Meyering
45110a7927 maint: update all copyright year number ranges
Run "make update-copyright".
2012-01-01 09:32:41 +01:00
Claudio Bley
7508234eab portability: use SET_BINARY rather than xfreopen (NULL, ...
* 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.
2011-10-04 13:55:49 +02:00
Paul Eggert
efb0557f4c * bootstrap.conf (gnulib_modules): Remove timegm.
This fixes a problem noted by Andreas Schwab in:
http://lists.gnu.org/archive/html/bug-diffutils/2011-08/msg00035.html
2011-08-13 15:12:35 -07:00
Jim Meyering
3edb801c06 build: use largefile module and update to latest gnulib
* configure.ac: Remove AC_SYS_LARGEFILE, subsumed by ...
* bootstrap.conf (gnulib_modules): ...this.  Use largefile module.
* gnulib: Update to latest.
2011-08-10 10:21:14 +02:00
Paul Eggert
a3318fdbca bootstrap: Avoid multithreading.
* bootstrap.conf (gnulib_tool_option_extras):
Add "--avoid=localename --avoid=lock", because we don't want to
bring in the multithreading code that recent gnulib changes would
otherwise bring in.
(excluded_files): Remove m4/lock.m4; no longer needed, now that
we use --avoid=lock.
2011-05-27 23:41:07 -07:00
Jim Meyering
39213a3bbc maint: use gnulib's new readme-release module
* bootstrap.conf (gnulib_modules): Add readme-release.
(bootstrap_epilogue): Add the recommended perl one-liner.
* README-release: Remove file; it is now generated from gnulib.
* .gitignore: Add it.
2011-05-18 20:31:42 +02:00