* doc/diffutils.texi (Unusual File Names): Rewrite to reflect
that file names with e.g., NL and TAB are now quoted.
Reported by Matěj Cepl in <https://bugs.gnu.org/68695>.
This closes some more races, by using openat+fstat instead
of fstatat+openat which can get confused by some other process
renaming files in the meantime. Not all races are closed of course.
* bootstrap.conf (gnulib_modules): Add d-type.
* src/diff.c (errno_encode, errno_decode): Remove, as file
descriptors are no longer portmanteau variables. All uses removed.
(detype_from_mode): New function.
(dir_p): Use detype, not stat.st_mode.
(compare_files): New args DETYPE0 and DETYPE1. All uses changed.
Update detype and err as new info arrives.
Adjust to desc's new use (no longer encodes errno).
Do not ignore lseek failures on regular files.
Prefer openat+fstat to fstatat+openat when detype shows that it's safe,
and avoid both fstat and fstatat if detype suffices.
Use ‘error’ with errno value rather than setting error
and then calling perror_with_name. Coalesce two of these
error diagnostics into one by moving an error check before
the diagnostic is output. Coalesce two calls to diff_dirs.
Print file type based on detype if available,
in case neither fstat nor fstatat was called.
* src/diff.h (enum detype): New type.
(struct file_data): New slots err, detype.
(NONEXISTENT, UNOPENED): Renumber so that -1 stands for open failed.
* src/dir.c (HAVE_STRUCT_DIRENT_D_TYPE): Default to false.
(dir_read): Return to caller the d_type, if available.
(diff_dirs): Pass detype to compare_files.
* bootstrap.conf (gnulib_modules): Add c32isspace, c32tolower.
* lib/Makefile.am (noinst_HEADERS): Add mbcel.h.
(libdiffutils_a_SOURCES): Add mbcel.c
* lib/mbcel.c, lib/mbcel.h: New files.
* src/io.c: Include mbcel.h, uchar.h.
(hash): 2nd arg is now hash_value, not merely unsigned char,
since the caller might pass a char32_t now.
(find_and_hash_each_line): Support multi-byte input.
* src/util.c: Include mbcel.h, uchar.h.
(lines_differ): New args S1LEN, S2LEN, needed for mbcel_scan.
Caller changed. Support multi-byte input.
* tests/ignore-case: New file.
* tests/Makefile.am (TESTS): Add it.
* tests/ignore-tab-expansion: Add UTF-8 test.
* tests/init.cfg (require_utf8_locale_): New function.
* tests/side-by-side: Use it. Add a column-counting test.
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.
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.
* 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.
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.
* 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.
* doc/diffutils.texi: Remove all uses of @acronym{...},
per recommendation by Karl Berry.
* cfg.mk (local-checks-to-skip): Remove exemption, enabling
the @acronym{-prohibiting syntax-check rule.
This improves on yesterday's change, following up on a
remark by Jim Meyering (Bug#22816#21).
* doc/diffutils.texi (Invoking cmp, cmp Options): Follow POSIX more
closely in the documentation of the information appended to the EOF
diagnostic.
* src/cmp.c (cmp): Be more specific about the shorter file's length
and fix some off-by-1 issues in reporting line counts.
* tests/cmp: Adjust to match new behavior.
Don't assume internal details about stdio buffering.
This avoids a new syntax-check failure.
* ChangeLog-2008: Perform that change.
* doc/diffutils.texi: Likewise.
* NEWS: Likewise.
* cfg.mk: Update the old news hash accordingly.
* NEWS, doc/diffutils.texi (Overview): Document this.
* src/analyze.c (diff_2_files): Restore too_expensive heuristic,
but this time with a floor that is 16 times the old floor. This
should fix Bug#16848, by generating good-quality output for its
test case, while not introducing Bug#24715, by running nearly as
fast as diff-3.3 for that test case.
* 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'
* 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.
See Bug#17075.
* doc/diffutils.texi (Comparison): Say that files need not be read.
(Invoking diff): Remove confusing remark about 'diff - -'.
It's not that useful, and it's not portable anyway.
Problem reported by Vincent Lefevre in <http://bugs.gnu.org/16848>.
The simplest solution is to remove the TOO_EXPENSIVE heuristic
that I added to GNU diff in 1993. Although appropriate for
circa-1993 hardware, these days the heuristic seems to be more
trouble than it's worth.
* NEWS: Document this.
* doc/diffutils.texi (Overview): Modernize citations.
Remove mention of TOO_EXPENSIVE heuristic.
* src/analyze.c (diff_2_files): Adjust to TOO_EXPENSIVE-related
API changes in gnulib's diffseq module.
Problem reported by Vincent Lefevre in <http://bugs.gnu.org/16608>.
* NEWS:
* doc/diffutils.texi (Binary, Invoking diff): Document this.
* src/analyze.c (briefly_report): Return void, not int.
All uses changed. Do not futz with exit status. Simplify.
* tests/binary: Adjust to match new behavior.
* NEWS: Document this.
* doc/diffutils.texi (Comparing Directories): Likewise.
Also, document that these options work at the top level.
* src/diff.c (compare_files): Treat EBADF like ENOENT, to handle
the case where "-" is closed. Allow the other file to be
STDIN_FILENO, in case it's "-".
* tests/Makefile.am (TESTS): Add new-file.
* tests/new-file: New file.
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.
This makes the .texi basename the same as the package name,
which is consistent with most other GNU packages.
* doc/diffutils.texi: Rename from...
* doc/diff.texi: ...removed.
* doc/Makefile.am (info_TEXINFOS): Reflect name change.
(diffutils_TEXINFOS): Likewise.
* cfg.mk (gendocs_options_): Remove this customization. It is no
longer needed, now that the .texi name matches that of the package.
* man/Makefile.am ($(dist_man1_MANS)): Remove now-unnecessary sed
filter.
* README: Update references to diffutils.texi etc. here, too.
* .gitignore: Update here, too.
Suggested by Karl Berry.