107 Commits

Author SHA1 Message Date
Jim Meyering
bbc1bdb771 maint: update copyright dates 2026-01-02 16:52:26 -08:00
Paul Eggert
a709a0a2bd diff: simplify sigaction configuration
* configure.ac: Remove checks for sigaction, sigprocmask, sigblock.
The sigprocmask and sigblock checks were not being used anyway.
* src/sdiff.c: Use (defined SA_NOCLDSTOP) instead of HAVE_SIGACTION.
This is what other modules do.
2025-11-02 13:09:16 -08:00
Paul Eggert
6b9c726076 maint: use our textdomain for Gnulib
Support diffutils’ traditional way of getting translations,
by telling Gnulib to use diffutils’ message catalog.
* configure.ac (GNULIB_TEXT_DOMAIN): New macro.
* src/cmp.c, src/diff.c, src/diff3.c, src/sdiff.c (main):
Don’t call bindtextdomain ("gnulib", GNULIB_LOCALEDIR)
as the existing bindtextdomain (PACKAGE, LOCALEDIR) call suffices.
2025-09-09 10:23:01 -07:00
Paul Eggert
cf5648869a maint: use need-formatstring-macros
* configure.ac: Pass need-formatstring-macros, not merely
need-ngettext, to AM_GNU_GETTEXT.  This is mostly for show, as
diffutils has used format string macros for years and since nobody
uses ancient gettext any more nobody has noticed a problem.
2025-09-09 10:23:01 -07:00
Paul Eggert
e124541148 maint: reduce Gnulib module usage
Recentish changes to Gnulib have pulled in more dependencies
on multithreading, locking, and whatnot.  Revamp to remove
these unwanted dependencies.
* bootstrap.conf: Also avoid hard-locale, localcharset,
localename-unsafe, localename-unsafe-limited.
Stop avoiding localename.
(avoided_gnulib_tests): New var.  Avoid these tests too.
(gnulib-modules): Remove hard-locale, nstrftime.
Add nstrftime-limited.
* configure.ac (gl_cv_func_mbrtowc_C_locale_sans_EILSEQ)
(gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ):
New vars, so that we do not worry about multibyte C locales.
(gl_THREADLIB_DEFAULT_NO): New macro.
Not sure how much it helps, but it can’t hurt.
(SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME): New macro.
* src/cmp.c: Do not include hard-locale.h.
(hard_locale_LC_MESSAGES): Assume that LC_MESSAGES is hard
if and only if "(C)" gets translated.  This drags in fewer
dependencies than calling hard_locale.
* src/diff.c: Include strftime.h instead of hard-locale.h.
(hard_locale_LC_TIME): New function, that uses nstrftime
to infer whether the time locale is hard.
(main): Use it instead of hard_locale.

maint: default Gnulib to no multithreading

* configure.ac: Define gl_THREADLIB_DEFAULT_NO
so that Gnulib defaults to no multithreading.
2025-09-05 14:47:08 -07:00
Paul Eggert
2591992037 diff: reduce nstrftime dependency
* configure.ac (REQUIRE_GNUISH_STRFTIME_AM_PM):
Define to 0, since we don’t use AM or PM indicators.
2025-04-27 23:42:49 -07:00
Paul Eggert
33ee12e587 build: use system help2man
Instead of shipping an old ‘help2man’ that is not properly maintained,
use the system’s ‘help2man’.  It was already listed as a build
prerequisite, and being configured via AM_MISSING_PROG.
Problem for FreeBSD and NetBSD reported by Bruno Haible
<https://bugs.gnu.org/72235>.
* man/Makefile.am (EXTRA_DIST): Remove help2man.
($(dist_man1_MANS)): Do not depend on help2man.
Use $(HELP2MAN) instead.
* man/help2man: Remove.
2025-04-27 23:42:49 -07:00
Jim Meyering
ea7c073d2d maint: once again distribute .tar.gz files
* configure.ac: Reenable distribution of gzip-compressed tarballs,
to help reduce the size of the Guix seed, as discussed at
https://lists.gnu.org/r/coreutils/2020-02/msg00042.html and
https://lists.gnu.org/r/sed-devel/2020-01/msg00013.html
* NEWS (Release): Mention this.
Requested by Nicolas Boos
2025-02-02 11:23:56 -08:00
Bruno Haible
733e2f6d7f diff: Fix failure of --no-dereference option (regression 2023-07-01)
* configure.ac: Move system-related tests closer together. Define
O_PATH_SUPPORTS_FSTAT if O_PATH exists and is supported by fstat().
* src/diff.c (O_PATHSEARCH): Don't use O_PATH if it is defined but not
supported by fstat().
2025-01-05 09:49:41 -08:00
Jim Meyering
d65b41664a maint: update all copyright dates via "make update-copyright" 2025-01-03 09:47:07 -08:00
Collin Funk
4eb92b2a80 maint: use Gnulib's stat-time over our own version
* bootstrap.conf (gnulib_modules): Add stat-time.
* configure.ac: Remove check for the st_blksize in struct stat.
* src/system.h: Include stat-time.h.
(STAT_BLOCKSIZE): Remove definition.
* src/analyze.c (diff_2_files):
* src/cmp.c (main):
* src/diff3.c (read_diff):
* src/io.c (sip): Use ST_BLKSIZE instead of STAT_BLOCKSIZE.
2024-10-13 14:19:06 -07:00
Paul Eggert
e7387b4ce2 maint: adjust to Gnulib -Wsystem-headers change
* configure.ac (WERROR_CFLAGS): No need to disable
-Wsystem-headers as Gnulib no longer enables it by default.
2024-07-15 14:49:12 -07:00
Paul Eggert
8f8ee60502 maint: port ‘make distcheck’ to Ubuntu 24.04
* configure.ac: Don’t use -Wsystem-headers, as <stdbit.h>
uses static functions that couldn’t be called from
extern inline functions if they were in user code.
2024-06-11 11:59:34 -07:00
Jim Meyering
6c88db1f7b maint: make update-copyright 2024-01-05 09:01:59 -08:00
Paul Eggert
1cce5a2bae maint: define GNULIB_MBRTOC32_REGULAR
* configure.ac (GNULIB_MBRTOC32_REGULAR): Define.
diffutils itself already assumes this, so it might as well
assume it in Gnulib code as well.
2023-08-30 17:37:39 -07:00
Paul Eggert
05b21c3723 diff3: simplify by assuming !GCC_LINT
GCC's static checks no longer seem to warn about the code
protected by GCC_LINT, so remove its last uses, which were in diff3.
(Or perhaps it was valgrind or gcc -fsanitize=address leak
checking instead?  But in that case there are other false
positives and we don’t worry about them either.)  This code was
problematic anyway when introduced (as witness the corresponding
test case) and it slowed diff3 down a bit.
* configure.ac (GCC_LINT): Remove.  All uses removed.
* src/diff3.c: Simplify by assuming !GCC_LINT.
2023-07-25 10:53:27 -07:00
Bruno Haible
72160d1428 maint: Fix build failures mingw 10 and MSVC 14.30
* bootstrap.conf (gnulib_modules): Add popen, pclose, readdir,
readlinkat, sigaction.
* configure.ac: Don't enable _FORTIFY_SOURCE on mingw.
* src/util.c (process_signals): If SIGTSTP is not defined,
stop_signal_count is zero, therefore disable the stop signal processing.
(sig): If SIGHUP is not defined, don't list it. If SIGPIPE is not
defined, don't list it.
2023-07-25 10:53:27 -07:00
Paul Eggert
a30a8d4f4d diff: don’t think mbcel_strcasecmp preserves errno
* configure.ac: Do not check for strcasecoll (which doesn’t exist)
or stricoll (not worth the porting hassle, as it doesn’t set errno).
* src/dir.c: Always include mbcel.h, since we now always
use mbcel_strcasecmp.
(strcasecoll): Remove
(compare_collated, diff_dirs): Do the setjump business only when
not ignoring file name case, since mbcel_strcasecmp doesn’t fail
and doesn’t set errno.  This fixes a bug in recent changes,
which incorrectly assumed mbcel_strcasecmp preserves errno.

* src/dir.c:
Always include mbcel.h, since we now always compile a call
to mbcel_strcasecmp.
(strcasecoll): Remove.  It’s not worth bothering to port to
Microsoft stricoll’s idiosyncrasies; mbcel_strcasecmp is good enough.
And nobody ever implemented strcasecoll.
2023-07-21 20:38:47 -07:00
Paul Eggert
5ce9ac138c maint: omit -Wstack-pointer
* configure.ac (WERROR_CFLAGS): Do not use -Wstack-protector.
It is not a correctness warning, and it causes a false
positive on Ubuntu 23.04 x86-64.
2023-06-20 15:27:35 -07:00
Paul Eggert
c89fd071d5 maint: tell Gnulib diffutils is single-threaded
* configure.ac (GNULIB_EXCLUDE_SINGLE_THREAD)
(GNULIB_MBRTOWC_SINGLE_THREAD, GNULIB_REGEX_SINGLE_THREAD)
(GNULIB_WCHAR_SINGLE_LOCALE):
Define, to improve performance a bit in Gnulib.
Diffutils is single-threaded and sets locales first.
2023-06-06 11:50:34 -07:00
Paul Eggert
73b5c504f6 maint: modernize GCC warnings, AC_INIT
* configure.ac: Pass new args to AC_INIT.
(gl_GCC_VERSION_IFELSE): New macro, taken from coreutils.
Modernize GCC warnings to agree more with coreutils.
2023-06-03 15:50:33 -07:00
Paul Eggert
e5e4200fce maint: remove AM_PROG_CC_C_O cruft
* bootstrap.conf (buildreq): Require Automake 1.14 instead of 1.12.2,
since AM_PROG_CC_C_O is obsolete as of 1.14.
* configure.ac: Don’t use obsolescent AM_PROG_CC_C_O.
2023-06-03 15:50:33 -07:00
Paul Eggert
a1a4c58d3d diff: remove CLOSEDIR_VOID cruft
* configure.ac: Don’t use AC_FUNC_CLOSEDIR_VOID; it’s obsolescent.
* src/dir.c (dir_read): Simplify by assuming !CLOSEDIR_VOID.
2023-06-03 15:50:33 -07: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
20ab8fc308 maint: lint → GCC_LINT
‘lint’ is for traditional lint and perhaps some other tools;
‘GCC_LINT’ is targeted more for what we do.
Gnulib accepts either, but we might as well be more accurate.
* configure.ac (GCC_LINT): Define this instead of ‘lint’.
All uses changed.
2021-08-22 14:02:22 -07:00
Paul Eggert
c21eddbfea maint: remove January workaround for Gnulib issue
* configure.ac: Don’t add -Wno-analyzer-null-argument, since
the issue is now fixed in Gnulib.
2021-08-22 14:02:21 -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
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
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
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
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
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
Bruno Haible
b18c0155f5 maint: don't use an undocumented Autoconf macro
* configure.ac: Use AC_CONFIG_HEADERS instead of AC_CONFIG_HEADER.
2018-12-27 23:14:28 -08:00
Jim Meyering
1505982238 build: make the autoconf-2.63 requirement explicit
* configure.ac: AC_PREREQ: Require 2.63, not 2.59. And quote properly.
Autoconf-2.63 has been required for some time via gnulib.
This merely makes it explicit.
2018-12-23 17:24:49 -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
81eea1db38 maint: suppress gcc's new -Wcast-function-type in gnulib
* configure.ac (WERROR_CFLAGS): Suppress gcc's new -Wcast-function-type
warning in gnulib, because it would trigger on this:
sig-handler.h:47:12: error: cast between incompatible function types\
  from 'void (* const)(int,  siginfo_t *, void *)' \
  {aka 'void (* const)(int,  struct <anonymous> *, void *)'} \
  to 'void (*)(int)' [-Werror=cast-function-type]
return (sa_handler_t) a->sa_sigaction;
2018-01-06 16:45:38 -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
24792668f0 build: arrange to build with -fno-common, when possible
* configure.ac (WERROR_CFLAGS): Add -fno-common, when possible.
This would have prevented the duplicate definition of
presume_output_tty that was fixed in v3.4-10-gc2dc91f.
2016-08-16 22:20:28 -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
29e8de4885 maint: update copyright year ranges to include 2015; update gnulib 2015-01-01 22:31:27 -08:00
Paul Eggert
1875453ee6 build: omit -Wsuggest-attribute=pure for lib
* configure.ac (WARN_CFLAGS): Omit -Wsuggest-attribute=pure
when compiling the lib subdirectory.  Reported for Fedora 19
by Eric Blake in <http://bugs.gnu.org/15463>.
2013-09-26 12:20:28 -07:00
Stefano Lattarini
d1d1df8e36 build: enable 'subdir-objects' automake option
The future major Automake version (2.0, ETA at least one year from now)
might enable that option unconditionally, so better get prepared in due
time.

* configure.ac (AM_INIT_AUTOMAKE): Adjust.
(AM_PROG_CC_C_O): New, required by Automake up to 1.13.x when the
'subdir-objects' is in use.
2013-05-06 06:12:22 -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