mirror of git://git.sv.gnu.org/gnulib used by lbmk
Find a file
Paul Eggert 9f48fb992a filevercmp: fix several unexpected results
Problems reported by Michael Debertol in <https://bugs.gnu.org/49239>.
While looking into this, I spotted some more areas where the
code and documentation did not agree, or where the documentation
was unclear.  The biggest change needed by coreutils is a new
function filenvercmp that can compare byte strings containing NUL.
* lib/filevercmp.c: Do not include sys/types.h, stdlib.h, string.h.
Include idx.h, verify.h.
(match_suffix): Remove, replacing all uses with calls to ...
(file_prefixlen): ... this new function.  Simplify it by
avoiding the need for a confusing READ_ALPHA state variable.
Change its API to something more useful, with a *LEN arg.
it with a new *LEN arg.
(file_prefixlen, verrevcmp):
Prefer idx_t to size_t where either will do.
(order): Change args to S, POS, LEN instead of just S[POS].
This lets us handle NUL bytes correctly.  Callers changed.
Verify that ints are sufficiently wide for its API.
(verrevcmp): Don't assume that S1[S1_LEN] is a non-digit,
and likewise for S2[S2_LEN].  The byte might not be accessible
if filenvercmp is being called.
(filevercmp): Reimplement by calling filenvercmp.
(filenvercmp): New function, rewritten without the assumption
that the inputs are null-terminated.
Remove "easy comparison to see if strings are identical", as the
use of it later (a) was undocumented, and (b) caused sort -V to be
unstable.  When both strings start with ".", do not skip past
the "."s before looking for suffixes, as this disagreed
with the documentation.
* lib/filevercmp.h: Fix comments, which had many mistakes.
(filenvercmp): New decl.
* modules/filevercmp (Depends-on): Add idx, verify.  Remove string.
* tests/test-filevercmp.c: Include string.h.
(examples): Reorder examples ".0" and ".9" that matched the code
but not the documentation.  The code has been fixed to match the
documentation.  Add some examples involving \1 so that they
can be tried with both \1 and \0.  Add some other examples
taken from the bug report.
(equals): New set of test cases.
(sign, test_filevercmp): New functions.
(main): Remove test case where the fixed filevercmp disagrees with
strverscmp.  Use test_filevercmp instead of filevercmp, so that
we also test filenvercmp.  Test the newly-introduced EQUALS cases.
2022-02-12 16:34:01 -08:00
build-aux autoupdate 2022-02-09 14:01:03 -08:00
config license: fix GPLv3 texts to use a comma instead of semicolon. 2022-01-05 11:56:23 +01:00
doc gendocs: update copyright footer year 2022-01-30 11:27:01 +01:00
etc/license-notices license: fix GPLv3 texts to use a comma instead of semicolon. 2022-01-05 11:56:23 +01:00
examples Add another example. 2022-01-08 20:58:14 +01:00
lib filevercmp: fix several unexpected results 2022-02-12 16:34:01 -08:00
m4 terminfo, terminfo-h: New modules. 2022-01-30 17:00:25 +01:00
modules filevercmp: fix several unexpected results 2022-02-12 16:34:01 -08:00
pygnulib license: fix GPLv3 texts to use a comma instead of semicolon. 2022-01-05 11:56:23 +01:00
tests filevercmp: fix several unexpected results 2022-02-12 16:34:01 -08:00
top maintainer-makefile: fix sc_error_message_uppercase false failure 2022-01-28 15:03:19 +00:00
.cvsignore * .cvsignore: New file. 2007-04-13 01:02:05 +00:00
.gitattributes doc: improve git diff of texinfo files 2009-08-14 06:44:52 -06:00
.gitignore libposix: Revert the unreviewed part of yesterday's big merge. 2011-02-06 21:15:53 +01:00
cfg.mk main.mk: remove sc_program_name 2016-09-05 09:21:54 -07:00
ChangeLog filevercmp: fix several unexpected results 2022-02-12 16:34:01 -08:00
check-AC_LIBOBJ license: fix GPLv3 texts to use a comma instead of semicolon. 2022-01-05 11:56:23 +01:00
check-copyright license: fix GPLv3 texts to use a comma instead of semicolon. 2022-01-05 11:56:23 +01:00
check-module license: fix GPLv3 texts to use a comma instead of semicolon. 2022-01-05 11:56:23 +01:00
COPYING std-gnu11: new module 2016-02-02 14:42:24 -08:00
DEPENDENCIES DEPENDENCIES: Mention the requirement for 'join'. 2021-05-14 18:05:22 +02:00
gnulib-tool Remove influence of Automake conditionals on conditional dependencies. 2022-01-09 15:38:51 +01:00
gnulib-tool.py license: fix GPLv3 texts to use a comma instead of semicolon. 2022-01-05 11:56:23 +01:00
gnulib-tool.py.TODO Update gnulib-tool.py.TODO. 2020-02-22 15:20:34 +01:00
Makefile maint: fix ‘make update-copyright’ on symlinks 2022-01-01 10:25:39 -08:00
MODULES.html.sh license: fix GPLv3 texts to use a comma instead of semicolon. 2022-01-05 11:56:23 +01:00
NEWS stack: also update stack_size to return idx_t 2022-01-05 11:51:38 -08:00
posix-modules license: fix GPLv3 texts to use a comma instead of semicolon. 2022-01-05 11:56:23 +01:00
README README: Don't ask people to read a TeXinfo file. 2017-05-17 10:14:37 +02:00
STATUS-libposix maint: shorten https://lists.gnu.org/archive/html/... links 2017-11-12 09:13:30 -08:00
users.txt maint: run 'make update-copyright' 2022-01-01 09:44:11 -08:00

Please create and read the docs with

  $ cd doc
  $ make gnulib.html
  $ xdg-open gnulib.html

or read the online manual at

  https://www.gnu.org/software/gnulib/manual/gnulib.html