summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Laszlo Ersek [Sun, 11 Sep 2022 12:32:37 +0000 (14:32 +0200)]
miniexpect.c: fix always-true comparison
According to <http://www.pcre.org/current/doc/html/pcre2api.html#SEC15>:
> STRING LENGTHS AND OFFSETS
>
> The PCRE2 API uses string lengths and offsets into strings of code units
> in several places. These values are always of type PCRE2_SIZE, which is
> an unsigned integer type, currently always defined as size_t. The
> largest value that can be stored in such a type (that is ~(PCRE2_SIZE)0)
> is reserved as a special indicator for zero-terminated strings and unset
> offsets. Therefore, the longest string that can be handled is one less
> than this maximum.
Therefore check the validity of ovector[1] with
ovector[1] != ~(PCRE2_SIZE)0
rather than the always-true
ovector[1] >= 0
This was caught by gcc's
> miniexpect.c:359:45: warning: comparison of unsigned expression in ‘>=
> 0’ is always true [-Wtype-limits]
which is part of "-Wextra".
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Richard W.M. Jones [Tue, 26 Jul 2022 17:09:06 +0000 (18:09 +0100)]
Add a bit of explanation of what "expect" is
Kids these days.
Richard W.M. Jones [Tue, 26 Jul 2022 09:08:12 +0000 (10:08 +0100)]
docs: Small revisions to the manual and readme file
Richard W.M. Jones [Tue, 26 Jul 2022 08:56:03 +0000 (09:56 +0100)]
tests: test-multi-match.c: Fix memory leaks in test
Richard W.M. Jones [Tue, 26 Jul 2022 08:55:45 +0000 (09:55 +0100)]
tests: valgrind: Rebuild tests before running them
Richard W.M. Jones [Mon, 25 Jul 2022 17:47:40 +0000 (18:47 +0100)]
docs: Fix example in the manual
It still contained references to PCRE functions pcre_exec and
pcre_compile. Replace with PCRE2 equivalents.
Fixes: commit
9a43a3bea411be5de83c64a2f1d28f365de7133f
Richard W.M. Jones [Mon, 25 Jul 2022 13:21:23 +0000 (14:21 +0100)]
Port to pcre2
The last version of PCRE (v1) 8.45 is end of life and will receive no
more updates. PCRE2 is its replacement and is widely available in
distros. So port the library to PCRE2.
Richard W.M. Jones [Mon, 25 Jul 2022 15:01:10 +0000 (16:01 +0100)]
miniexpect: Debug next_match field
Richard W.M. Jones [Wed, 11 Oct 2017 15:12:29 +0000 (16:12 +0100)]
Add debugging capability at runtime.
Debugging can now be enabled at runtime.
Richard W.M. Jones [Wed, 11 Oct 2017 14:39:30 +0000 (15:39 +0100)]
When debugging, escape the buffer output.
Richard W.M. Jones [Sun, 18 Dec 2016 14:22:23 +0000 (14:22 +0000)]
doc: Use -u (UTF8) flag when generating the man page.
Richard W.M. Jones [Sun, 18 Dec 2016 14:21:04 +0000 (14:21 +0000)]
documentation: Fix markup in flags.
Richard W.M. Jones [Sun, 18 Dec 2016 14:19:13 +0000 (14:19 +0000)]
Fix documentation of mexp_spawnl to include terminating NULL.
Code is correct, but the documentation was wrong.
Richard W.M. Jones [Tue, 26 Jul 2016 10:18:33 +0000 (11:18 +0100)]
int -> const int
Richard W.M. Jones [Wed, 29 Jun 2016 20:18:20 +0000 (21:18 +0100)]
Add mexp_send_interrupt, mexp_spawnvf, mexp_spawnlf and various flags.
Richard W.M. Jones [Wed, 29 Jun 2016 14:23:35 +0000 (15:23 +0100)]
Set signals to defaults and close other file descriptors after forking.
Richard W.M. Jones [Sun, 24 Jan 2016 17:26:29 +0000 (17:26 +0000)]
Small fix to documentation.
Richard W.M. Jones [Sun, 24 Jan 2016 17:19:07 +0000 (17:19 +0000)]
Document use of mexp_get_pcre_error when calling pcre_get_substring.
virt-p2v uses this, and it surprised me as well.
Richard W.M. Jones [Sun, 24 Jan 2016 14:59:55 +0000 (14:59 +0000)]
Introduce methods to access some fields in the handle.
Actually these are implemented as C macros.
Richard W.M. Jones [Sun, 24 Jan 2016 14:39:19 +0000 (14:39 +0000)]
Document how to handle errors from mexp_close.
Pino Toscano [Fri, 25 Jul 2014 15:36:14 +0000 (17:36 +0200)]
p2v: properly call va_end
Richard W.M. Jones [Fri, 11 Jul 2014 09:38:53 +0000 (10:38 +0100)]
RHEL 6: p2v: Add fix for older PCRE.
RHEL 6 pcre did not define PCRE_PARTIAL_SOFT. However PCRE_PARTIAL is
a synonym so use that.
Pino Toscano [Fri, 25 Jul 2014 15:36:17 +0000 (17:36 +0200)]
p2v: close the mexp handle if mexp_spawnv fails
Richard W.M. Jones [Thu, 15 May 2014 19:13:28 +0000 (20:13 +0100)]
Document behaviour when matching against multiple regular expressions.
Richard W.M. Jones [Thu, 15 May 2014 18:29:50 +0000 (19:29 +0100)]
Implement and test multi-matching on strings.
If the subprocess prints multiple matching strings, and you call
mexp_expect repeatedly, the code now does the right thing.
Richard W.M. Jones [Sat, 26 Apr 2014 18:38:22 +0000 (19:38 +0100)]
tests: Add 'make check-valgrind' to run test suite under valgrind.
Richard W.M. Jones [Sat, 26 Apr 2014 18:40:57 +0000 (19:40 +0100)]
Free handle storage.
Memory leak found by valgrind.
Richard W.M. Jones [Sat, 26 Apr 2014 18:24:36 +0000 (19:24 +0100)]
configure: Move AC_USE_SYSTEM_EXTENSIONS to avoid autoconf warning.
Richard W.M. Jones [Sat, 26 Apr 2014 17:53:15 +0000 (18:53 +0100)]
tests: Add a test of running 'ls --version' and matching the output.
Richard W.M. Jones [Sat, 26 Apr 2014 17:33:21 +0000 (18:33 +0100)]
tests: Accurately list sources of test-spawn program.
Richard W.M. Jones [Sat, 26 Apr 2014 16:37:18 +0000 (17:37 +0100)]
Minor updates to the manual page.
Richard W.M. Jones [Sat, 26 Apr 2014 11:03:55 +0000 (12:03 +0100)]
clean: Remove miniexpect.3 if we have pod2man, otherwise leave it.
Richard W.M. Jones [Sat, 26 Apr 2014 10:51:25 +0000 (11:51 +0100)]
Add a note about clearing the input buffer in mexp_expect.
Richard W.M. Jones [Sat, 26 Apr 2014 10:50:33 +0000 (11:50 +0100)]
miniexpect.h: Change the error codes again.
No functional change (although it changes the ABI).
Richard W.M. Jones [Sat, 26 Apr 2014 10:50:13 +0000 (11:50 +0100)]
Add a man page.
Move all the documentation from the header file to the man page.
Richard W.M. Jones [Fri, 25 Apr 2014 21:41:14 +0000 (22:41 +0100)]
miniexpect.h: Just some tidying up.
Richard W.M. Jones [Fri, 25 Apr 2014 21:19:03 +0000 (22:19 +0100)]
mexp_expect: Change the expect API to allow multiple regexps.
Richard W.M. Jones [Fri, 25 Apr 2014 13:09:02 +0000 (14:09 +0100)]
Add miniexpect library.